@xbibzlibrary/whatsbibz 1.3.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/CHANGELOG.md +93 -0
- package/LICENSE +22 -0
- package/LICENSE.upstream +21 -0
- package/README.md +280 -0
- package/VERIFIKASI-IDENTITAS-2026-09-03.md +138 -0
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +6035 -0
- package/WAProto/fix-imports.js +81 -0
- package/WAProto/index.d.ts +15314 -0
- package/WAProto/index.js +132326 -0
- package/assets/logo/README.md +21 -0
- package/assets/logo/png/banner-1200x360.png +0 -0
- package/assets/logo/png/icon-1024.png +0 -0
- package/assets/logo/png/icon-128.png +0 -0
- package/assets/logo/png/icon-16.png +0 -0
- package/assets/logo/png/icon-24.png +0 -0
- package/assets/logo/png/icon-256.png +0 -0
- package/assets/logo/png/icon-32.png +0 -0
- package/assets/logo/png/icon-48.png +0 -0
- package/assets/logo/png/icon-512.png +0 -0
- package/assets/logo/png/icon-64.png +0 -0
- package/assets/logo/png/mark-512.png +0 -0
- package/assets/logo/preview.png +0 -0
- package/assets/logo/whatsbibz.ico +0 -0
- package/lib/BibzWhats/client.d.ts +95 -0
- package/lib/BibzWhats/client.js +501 -0
- package/lib/BibzWhats/device-identity.d.ts +60 -0
- package/lib/BibzWhats/device-identity.js +234 -0
- package/lib/BibzWhats/extract.d.ts +29 -0
- package/lib/BibzWhats/extract.js +115 -0
- package/lib/BibzWhats/index.d.ts +7 -0
- package/lib/BibzWhats/index.js +8 -0
- package/lib/BibzWhats/jid.d.ts +22 -0
- package/lib/BibzWhats/jid.js +98 -0
- package/lib/BibzWhats/pairing.d.ts +35 -0
- package/lib/BibzWhats/pairing.js +186 -0
- package/lib/BibzWhats/send.d.ts +9 -0
- package/lib/BibzWhats/send.js +107 -0
- package/lib/BibzWhats/version.d.ts +6 -0
- package/lib/BibzWhats/version.js +7 -0
- package/lib/Defaults/index.d.ts +73 -0
- package/lib/Defaults/index.js +141 -0
- package/lib/Modded/message_builder.d.ts +15 -0
- package/lib/Modded/message_builder.js +2330 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +11 -0
- package/lib/Signal/Group/group-session-builder.d.ts +14 -0
- package/lib/Signal/Group/group-session-builder.js +29 -0
- package/lib/Signal/Group/group_cipher.d.ts +16 -0
- package/lib/Signal/Group/group_cipher.js +81 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +11 -0
- package/lib/Signal/Group/keyhelper.d.ts +10 -0
- package/lib/Signal/Group/keyhelper.js +17 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +25 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +65 -0
- package/lib/Signal/Group/sender-key-name.d.ts +17 -0
- package/lib/Signal/Group/sender-key-name.js +47 -0
- package/lib/Signal/Group/sender-key-record.d.ts +30 -0
- package/lib/Signal/Group/sender-key-record.js +40 -0
- package/lib/Signal/Group/sender-key-state.d.ts +38 -0
- package/lib/Signal/Group/sender-key-state.js +83 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +25 -0
- package/lib/Signal/libsignal.d.ts +4 -0
- package/lib/Signal/libsignal.js +406 -0
- package/lib/Signal/lid-mapping.d.ts +18 -0
- package/lib/Signal/lid-mapping.js +276 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +2 -0
- package/lib/Socket/Client/types.d.ts +15 -0
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +53 -0
- package/lib/Socket/business.d.ts +537 -0
- package/lib/Socket/business.js +421 -0
- package/lib/Socket/chats.d.ts +110 -0
- package/lib/Socket/chats.js +1006 -0
- package/lib/Socket/communities.d.ts +646 -0
- package/lib/Socket/communities.js +430 -0
- package/lib/Socket/engine.d.ts +129 -0
- package/lib/Socket/engine.js +767 -0
- package/lib/Socket/groups.d.ts +149 -0
- package/lib/Socket/groups.js +326 -0
- package/lib/Socket/index.d.ts +637 -0
- package/lib/Socket/index.js +14 -0
- package/lib/Socket/messages-recv.d.ts +239 -0
- package/lib/Socket/messages-recv.js +1307 -0
- package/lib/Socket/messages-send.d.ts +580 -0
- package/lib/Socket/messages-send.js +1639 -0
- package/lib/Socket/mex.d.ts +2 -0
- package/lib/Socket/mex.js +47 -0
- package/lib/Socket/newsletter.d.ts +176 -0
- package/lib/Socket/newsletter.js +456 -0
- package/lib/Socket/socket.d.ts +56 -0
- package/lib/Socket/socket.js +998 -0
- package/lib/Types/Auth.d.ts +115 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.d.ts +36 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.d.ts +14 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +124 -0
- package/lib/Types/Chat.js +7 -0
- package/lib/Types/Contact.d.ts +23 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +241 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +67 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +46 -0
- package/lib/Types/Label.js +24 -0
- package/lib/Types/LabelAssociation.d.ts +29 -0
- package/lib/Types/LabelAssociation.js +6 -0
- package/lib/Types/Message.d.ts +427 -0
- package/lib/Types/Message.js +10 -0
- package/lib/Types/Newsletter.d.ts +134 -0
- package/lib/Types/Newsletter.js +30 -0
- package/lib/Types/Product.d.ts +78 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/Signal.d.ts +77 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +173 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/State.d.ts +38 -0
- package/lib/Types/State.js +12 -0
- package/lib/Types/USync.d.ts +25 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +75 -0
- package/lib/Types/index.js +32 -0
- package/lib/Utils/auth-utils.d.ts +18 -0
- package/lib/Utils/auth-utils.js +289 -0
- package/lib/Utils/browser-utils.d.ts +3 -0
- package/lib/Utils/browser-utils.js +47 -0
- package/lib/Utils/business.d.ts +22 -0
- package/lib/Utils/business.js +230 -0
- package/lib/Utils/chat-utils.d.ts +69 -0
- package/lib/Utils/chat-utils.js +811 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +20 -0
- package/lib/Utils/companion-reg-client-utils.js +66 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/crypto.js +117 -0
- package/lib/Utils/decode-wa-message.d.ts +47 -0
- package/lib/Utils/decode-wa-message.js +282 -0
- package/lib/Utils/event-buffer.d.ts +35 -0
- package/lib/Utils/event-buffer.js +590 -0
- package/lib/Utils/generics.d.ts +90 -0
- package/lib/Utils/generics.js +384 -0
- package/lib/Utils/history.d.ts +21 -0
- package/lib/Utils/history.js +130 -0
- package/lib/Utils/identity-change-handler.d.ts +36 -0
- package/lib/Utils/identity-change-handler.js +48 -0
- package/lib/Utils/index.d.ts +25 -0
- package/lib/Utils/index.js +24 -0
- package/lib/Utils/link-preview.d.ts +20 -0
- package/lib/Utils/link-preview.js +84 -0
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.js +2 -0
- package/lib/Utils/lt-hash.d.ts +10 -0
- package/lib/Utils/lt-hash.js +7 -0
- package/lib/Utils/make-mutex.d.ts +8 -0
- package/lib/Utils/make-mutex.js +32 -0
- package/lib/Utils/message-retry-manager.d.ts +109 -0
- package/lib/Utils/message-retry-manager.js +224 -0
- package/lib/Utils/messages-media.d.ts +129 -0
- package/lib/Utils/messages-media.js +784 -0
- package/lib/Utils/messages.d.ts +90 -0
- package/lib/Utils/messages.js +1240 -0
- package/lib/Utils/noise-handler.d.ts +19 -0
- package/lib/Utils/noise-handler.js +200 -0
- package/lib/Utils/offline-node-processor.d.ts +16 -0
- package/lib/Utils/offline-node-processor.js +39 -0
- package/lib/Utils/platform-identity.d.ts +14 -0
- package/lib/Utils/platform-identity.js +148 -0
- package/lib/Utils/pre-key-manager.d.ts +27 -0
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.d.ts +59 -0
- package/lib/Utils/process-message.js +544 -0
- package/lib/Utils/reporting-utils.d.ts +10 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-messages.d.ts +276 -0
- package/lib/Utils/rich-messages.js +1143 -0
- package/lib/Utils/signal.d.ts +33 -0
- package/lib/Utils/signal.js +158 -0
- package/lib/Utils/stanza-ack.d.ts +10 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/sticker-pack.d.ts +10 -0
- package/lib/Utils/sticker-pack.js +111 -0
- package/lib/Utils/sync-action-utils.d.ts +18 -0
- package/lib/Utils/sync-action-utils.js +47 -0
- package/lib/Utils/tc-token-utils.d.ts +8 -0
- package/lib/Utils/tc-token-utils.js +45 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-multi-file-auth-state.js +120 -0
- package/lib/Utils/validate-connection.d.ts +10 -0
- package/lib/Utils/validate-connection.js +222 -0
- package/lib/VoIP/audio-feeder.d.ts +15 -0
- package/lib/VoIP/audio-feeder.js +136 -0
- package/lib/VoIP/index.d.ts +12 -0
- package/lib/VoIP/index.js +282 -0
- package/lib/VoIP/relay-transport.d.ts +43 -0
- package/lib/VoIP/relay-transport.js +559 -0
- package/lib/VoIP/signaling.js +603 -0
- package/lib/VoIP/types.d.ts +69 -0
- package/lib/VoIP/types.js +17 -0
- package/lib/VoIP/wasm-engine.d.ts +103 -0
- package/lib/VoIP/wasm-engine.js +1214 -0
- package/lib/VoIP/worker-bootstrap.js +1042 -0
- package/lib/WABinary/constants.d.ts +27 -0
- package/lib/WABinary/constants.js +1300 -0
- package/lib/WABinary/decode.d.ts +6 -0
- package/lib/WABinary/decode.js +261 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +219 -0
- package/lib/WABinary/generic-utils.d.ts +16 -0
- package/lib/WABinary/generic-utils.js +190 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +5 -0
- package/lib/WABinary/jid-utils.d.ts +47 -0
- package/lib/WABinary/jid-utils.js +95 -0
- package/lib/WABinary/types.d.ts +18 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -0
- package/lib/WAM/BinaryInfo.js +9 -0
- package/lib/WAM/constants.d.ts +39 -0
- package/lib/WAM/constants.js +22852 -0
- package/lib/WAM/encode.d.ts +2 -0
- package/lib/WAM/encode.js +149 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/lib/WAUSync/Protocols/index.d.ts +4 -0
- package/lib/WAUSync/Protocols/index.js +4 -0
- package/lib/WAUSync/USyncQuery.d.ts +28 -0
- package/lib/WAUSync/USyncQuery.js +93 -0
- package/lib/WAUSync/USyncUser.d.ts +12 -0
- package/lib/WAUSync/USyncUser.js +22 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/assets/wasm/loader.js +5 -0
- package/lib/assets/wasm/whatsapp.wasm +0 -0
- package/lib/assets/wasm/worker-modules.js +273 -0
- package/lib/index.d.ts +21 -0
- package/lib/index.js +22 -0
- package/package.json +111 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Changelog — @xbibzlibrary/whatsbibz
|
|
2
|
+
|
|
3
|
+
## 1.3.0 — identitas perangkat tertaut: kustom atau otomatis; rilis npm `@xbibzlibrary/whatsbibz` (2026-09-03)
|
|
4
|
+
|
|
5
|
+
- **Dipublish ke npm sebagai `@xbibzlibrary/whatsbibz`** (nama tampilan *WhatsBibz*; API `createBibzWhats`/`BIBZWHATS_*`
|
|
6
|
+
tidak berubah, ditambah alias `createWhatsBibz`, `makeWhatsBibzSocket`, `Browsers.whatsbibz`, `BIBZWHATS_PACKAGE`).
|
|
7
|
+
- Logo baru (gelembung + buku, `assets/logo/preview.png`) menggantikan set vektor "b"; ikon/ICO/banner diturunkan ulang.
|
|
8
|
+
- `prepublishOnly` menjalankan seluruh test + `scripts/check.js`, jadi rilis rusak tidak bisa terpublish.
|
|
9
|
+
|
|
10
|
+
- **Identitas perangkat tertaut: kustom atau otomatis** (`lib/BibzWhats/device-identity.js`). Default `identity: 'auto'`
|
|
11
|
+
memilih profil paling stabil (Mac OS/Chrome) dan **berpindah otomatis** bila server menolak (428 sebelum QR / 400 pairing /
|
|
12
|
+
405) — diuji live: 428→pindah→pairing OK dalam 2,5 s; 400→pindah→sambung ulang→pairing OK dalam 3 s. Profil yang berhasil
|
|
13
|
+
disimpan di `<authDir>/identity.json` (bertahan melewati wipe sesi) agar nama perangkat konsisten antar restart.
|
|
14
|
+
Kustom lewat `identity` (tuple / `'archLinux:Firefox'` / `'Mac OS/Safari/15.6.1'` / id profil), alias lama `browser`,
|
|
15
|
+
atau env `BIBZ_BROWSER` / `BIBZ_DEVICE_OS|BROWSER|VERSION` — dipakai apa adanya, tidak pernah diganti diam-diam.
|
|
16
|
+
Event baru `identity-changed`; `client.identity` kini {mode, source, profileId, linkedDeviceName, pairingDisplay, tried}.
|
|
17
|
+
`createPairingController` mendapat hook `onRejected`.
|
|
18
|
+
- **Perbaikan hasil uji produksi (ditemukan saat verifikasi rilis):**
|
|
19
|
+
- `close()` kini membatalkan reconnect yang sudah terjadwal & `connect()` menolak berjalan setelah ditutup — sebelumnya setiap
|
|
20
|
+
client meninggalkan satu timer hidup (proses tidak bisa keluar sendiri, socket "hantu" bisa tersambung lagi). Diuji 40 siklus
|
|
21
|
+
create→close offline + 3 siklus live: 0 timer tersisa, heap stabil (Δ 3 MB).
|
|
22
|
+
- Putus jaringan setelah pairing code terbit: server menjawab **401 "pairing tertunda"** untuk kredensial yang sama. Dulu itu
|
|
23
|
+
dihitung sebagai wipe 401 biasa (jeda 10 s + 10 s, dan mengikis kuota `maxSessionWipes`). Kini dikenali: kredensial diganti,
|
|
24
|
+
kode diminta ulang dalam 2 s, tidak mengurangi kuota; percobaan pertama setelah putus jaringan pada koneksi sehat = 1 s
|
|
25
|
+
(bukan backoff 10 s). Live: pairing code kedua terbit 10 s setelah putus paksa (sebelumnya 22 s).
|
|
26
|
+
- **TypeScript**: `WAProto/index.d.ts` dibangkitkan ulang (866 KB, 217 namespace proto — upstream mengirim berkas 2 baris kosong
|
|
27
|
+
sehingga `import { proto }` gagal kompilasi); `@types/ws` & `long` jadi dependensi; `.d.ts` tidak lagi bergantung pada
|
|
28
|
+
deklarasi `whatsapp-rust-bridge` yang rusak. Konsumen TS kini lolos `tsc --strict` bahkan dengan `skipLibCheck: false`.
|
|
29
|
+
- Versi WA Web bawaan → 2.3000.1046721733 (server 2026-09-03 siang).
|
|
30
|
+
- Test: 54 offline (+3 `lifecycle.test.js`, +2 pemulihan pairing) + 11 live. Node 20/22/24/26 hijau.
|
|
31
|
+
- Bot tidak diubah: `conn/connection.js` masih meneruskan `browser` eksplisit (mode kustom, identitas valid).
|
|
32
|
+
|
|
33
|
+
## 1.2.0 — identitas platform Mac OS & Arch Linux (2026-09-03)
|
|
34
|
+
Diukur langsung ke server produksi WhatsApp (WA Web 2.3000.1046672143) dengan 70+ kombinasi identitas; semua hasil
|
|
35
|
+
ada di `BibzWhats/test/identity-live.test.js` dan laporan `VERIFIKASI-IDENTITAS-2026-09-03.md`.
|
|
36
|
+
- **`Browsers.macOS('Desktop')` + `syncFullHistory` kini berhasil**: `WebSubPlatform.DARWIN` ditutup server (428 sebelum QR,
|
|
37
|
+
upstream masih mengirimnya) → BibzWhats mengirim `WEB_BROWSER` dan riwayat penuh tetap diminta lewat `requireFullSync`.
|
|
38
|
+
- **`companion_platform_display` (pairing kode) memakai allow-list hasil ukur**: `Arch Linux`, `Desktop`, nama produk,
|
|
39
|
+
`Mac OS X`, `GNU/Linux` dll. ditolak 400 oleh server. Modul baru `lib/Utils/platform-identity.js` menurunkan nilai yang
|
|
40
|
+
pasti valid (`derivePairingDisplay`): Arch Linux → `Chrome (Linux)`, Mac OS Desktop → `Chrome (Mac OS)`, nama produk → OS host.
|
|
41
|
+
Nama di *Perangkat tertaut* (`DeviceProps.os`) tetap apa adanya ("Arch Linux").
|
|
42
|
+
- Preset baru `Browsers.archLinux(b)` = `['Arch Linux', b, '6.12.44']`, `Browsers.linux(b)`; `Browsers.macOS` → versi `15.6.1`;
|
|
43
|
+
`Browsers.appropriate` membaca distro dari `/etc/os-release` (Arch → "Arch Linux", bukan "Ubuntu").
|
|
44
|
+
- Opsi socket baru: `companionPlatformId`, `webSubPlatform` (override eksplisit, angka enum atau nama).
|
|
45
|
+
- `createBibzWhats`: `lintIdentity` memberi peringatan dini bila `companionPlatformDisplay` pasti 400; properti `client.identity`.
|
|
46
|
+
- Pesan error 400 di `PairingController` diperbaiki (menyebut allow-list, bukan menyarankan 'Chrome (Windows)' saja).
|
|
47
|
+
- Versi WA Web fallback → 2.3000.1046672143 (live 2026-09-03). Test: 37 offline (+11 identitas) + 5 live (`npm run test:live`),
|
|
48
|
+
lulus di Node 20.20 / 22.23 (Arch `nodejs-lts-jod`, brew `node@22`) / 24.20 / 26.8 (Arch `nodejs`, brew `node`).
|
|
49
|
+
|
|
50
|
+
## Library baru: `BibzWhats/` (package `bibzwhats` 1.0.0)
|
|
51
|
+
- Fork vendored penuh dari `ourin-baileys@9.0.21` (Baileys v7). Semua API lama diekspor apa adanya → kompatibel 100%.
|
|
52
|
+
- **Handler `companion_reg_refresh` tertanam di source** (`lib/Socket/socket.js` + `lib/Utils/companion-reg-client-utils.js`).
|
|
53
|
+
Tidak ada lagi `scripts/patch-baileys.js` maupun `postinstall`.
|
|
54
|
+
- Rebrand: `Dugong` → `BibzWhatsEngine` (`lib/Socket/engine.js`), `sock.ourin` → `sock.bibz` (alias `sock.ourin` tetap),
|
|
55
|
+
logger class `bibzwhats`, publisher sticker pack `BibzWhats`, `Browsers.bibzwhats('Chrome')`, alias tipe `BibzWhatsEventMap`, dsb.
|
|
56
|
+
- Keamanan/etika: **auto-follow newsletter/channel dimatikan** (`autoFollowNewsletterOnConnect=false`, JID default kosong).
|
|
57
|
+
- Lapisan API baru (`lib/BibzWhats/`):
|
|
58
|
+
- `createBibzWhats(opts)` — versi WA web terbaru per connect, pairing code custom/acak + fallback QR,
|
|
59
|
+
515 → reconnect, backoff reconnect, wipe sesi otomatis (401/500/411/korup, maks 3×), cache metadata grup, event emitter.
|
|
60
|
+
- `createPairingController` (dipindahkan dari `conn/connection.js` bot, perilaku identik + opsi `refreshMs/backoffMaxMs`).
|
|
61
|
+
- Helper: `sendText` (split ≤4000 + retry + whatsappify), `sendMedia` (fallback dokumen), `react`, `presence`,
|
|
62
|
+
`extractMessage`/`unwrapMessage`/`messageTimestampMs`, `LidMap` + util JID.
|
|
63
|
+
- Source map dibuang (ukuran paket 4.1 MB terkompres / 19.8 MB unpacked); `.d.ts` dilengkapi untuk modul baru + Modded/VoIP.
|
|
64
|
+
- Test: `npm --prefix BibzWhats test` (13 test) dan `scripts/check.js` (verifikasi export).
|
|
65
|
+
|
|
66
|
+
## Perubahan di bot
|
|
67
|
+
- `package.json`: `"bibzwhats": "file:./BibzWhats"` menggantikan `"baileys": "npm:ourin-baileys"`; `postinstall` & langkah
|
|
68
|
+
`patch-baileys` di `start` dihapus; `npm test` juga menjalankan test library.
|
|
69
|
+
- `conn/connection.js`: kini tipis — memakai `createBibzWhats`, hanya banner pairing/QR + callback. Export lama
|
|
70
|
+
(`createPairingController`, `wipeAuthDir`, `PAIRING_REFRESH_MS`, `makeSocketNetworkOptions`) dipertahankan untuk tests.
|
|
71
|
+
- `server.js`: import `downloadMediaMessage` dari `bibzwhats`; import patch dihapus.
|
|
72
|
+
- `tests/patch-baileys.test.js` → diganti `tests/bibzwhats-integration.test.js`.
|
|
73
|
+
- Dockerfile menyalin `BibzWhats/` sebelum `npm install`; `.gitignore`/`.dockerignore` mengabaikan `BibzWhats/node_modules/`.
|
|
74
|
+
- README, egg, komentar diperbarui.
|
|
75
|
+
|
|
76
|
+
## Hasil verifikasi
|
|
77
|
+
- `node --check` semua file: OK. Import graph `server.js` → `bibzwhats`: OK (322 export).
|
|
78
|
+
- Test bot: 338/341 lulus (2 gagal = `ffmpeg` tidak terpasang di sandbox, bukan terkait library; 1 skipped).
|
|
79
|
+
- Smoke test nyata ke server WhatsApp: handshake noise + `pair-device` diterima, QR ter-generate & di-refresh (60 dtk) — jalur pairing hidup.
|
|
80
|
+
|
|
81
|
+
## 1.1.0 — sinkron protokol WhatsApp Web (2026-09-02)
|
|
82
|
+
Verifikasi ulang terhadap `web.whatsapp.com` (client_revision **1046603545**), Baileys `7.0.0-rc14` + master, dan issue/PR upstream Agustus 2026.
|
|
83
|
+
Temuan: basis ourin 9.0.21 = Baileys rc10; ada patch rc11–rc14/master yang belum masuk. Semua di-port ke `BibzWhats/lib`:
|
|
84
|
+
- **WIN32 → WIN_HYBRID** (`validate-connection.js`, upstream #2741): sejak ~2026-06-30 server menolak handshake (428 sebelum QR) untuk `Browsers.windows('Desktop')`.
|
|
85
|
+
- **Versi WA Web bawaan** `2.3000.1043857760` → **`2.3000.1046603545`** (Defaults + generics + `BIBZWHATS_WA_WEB_VERSION`); `createBibzWhats` tidak lagi menurunkan versi bila fetch gagal (issue #2777).
|
|
86
|
+
- **`requestPairingCode`** (PR #2769): `query()` bukan `sendNode()`, `creds.me` disimpan hanya setelah server ACK, timeout → error 408, opsi `companionPlatformDisplay` & `pairingRequestTimeoutMs`. `PairingController` mengenali 400 bad-request / timeout dengan pesan yang jelas (`isRegistrationRejected`, `isTimeoutError`, `pairingErrorCode`).
|
|
87
|
+
- **tctoken** (rc11+/#2607): atribut `t`, token kedaluwarsa (~28 hari)/tanpa timestamp dibuang, `profilePictureUrl` menyarangkan token di `<picture>` dan melewatinya untuk JID sendiri/grup.
|
|
88
|
+
- **Guard `protocolMessage` self-only** (rc12), **`Browsers.android()`** + platform ANDROID (#2201), **`groupOnlineCount`** (#2545), **presence tanpa nama tidak dikirim** (PR #2789), **`directPath` diutamakan** saat download (PR #2778), **`lottieStickerMessage`** di-unwrap (PR #2776), **guard dispatcher fetch** (#2557), **cleanup memori** `ev.destroy()`/`signalRepository.close()`/`registerSocketEndHandler` (#2191).
|
|
89
|
+
- Deps: `whatsapp-rust-bridge` 0.5.2 → **0.5.5**, `protobufjs` ^7.5.6, `music-metadata` ^11.12.3. `.d.ts` diperbarui.
|
|
90
|
+
- `createBibzWhats`: event **`ready` kini per socket baru** (start + tiap reconnect; `readyOnEveryConnect:false` = perilaku lama) + event `first-ready`. Memperbaiki bug lama bot: setelah reconnect handler pesan tidak terpasang di socket baru.
|
|
91
|
+
- Bot: `conn/connection.js` memakai `readyOnEveryConnect` + env `BIBZ_PLATFORM_DISPLAY`; test `tests/bibzwhats-integration.test.js` +1, library `test/compat-2026-09.test.js` (12 test).
|
|
92
|
+
- **Bugfix `client.sock`**: getter dilewatkan lewat `Object.assign` → nilainya disalin sekali dan membeku di socket pertama setelah reconnect (ditemukan smoke test reconnect). Kini `Object.defineProperty` — `client.sock` selalu socket aktif.
|
|
93
|
+
- Verifikasi: library 26/26 test; smoke test nyata: handshake + QR OK dengan versi 2.3000.1046603545, `requestPairingCode` kini melempar error (bukan sukses palsu) dan `creds.me` tetap kosong.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Xbibz Developer (BibzWhats)
|
|
4
|
+
Copyright (c) 2025 Rajeh Taher / WhiskeySockets (Baileys) — lihat LICENSE.upstream
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
package/LICENSE.upstream
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,280 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/xbibzlibrary/whatsbibz/main/assets/logo/preview.png" alt="WhatsBibz" width="420"
|
|
3
|
+
onerror="this.src='assets/logo/preview.png'">
|
|
4
|
+
</p>
|
|
5
|
+
|
|
6
|
+
# WhatsBibz
|
|
7
|
+
|
|
8
|
+
[](https://www.npmjs.com/package/@xbibzlibrary/whatsbibz)
|
|
9
|
+
[](#instalasi)
|
|
10
|
+
[](LICENSE)
|
|
11
|
+
|
|
12
|
+
> Paket npm: **`@xbibzlibrary/whatsbibz`** — nama API internal tetap `BibzWhats`
|
|
13
|
+
> (`createBibzWhats`, `BIBZWHATS_*`); alias `createWhatsBibz` juga tersedia.
|
|
14
|
+
|
|
15
|
+
Library WhatsApp Web multi-device untuk ekosistem **Xbibz** — fork dari
|
|
16
|
+
Baileys v7 (basis `ourin-baileys@9.0.21`) dengan lapisan API tingkat tinggi,
|
|
17
|
+
pairing code custom, self-healing session, dan handler protokol terbaru
|
|
18
|
+
(`companion_reg_refresh`) yang **sudah tertanam di source** (tidak perlu
|
|
19
|
+
patch `postinstall`).
|
|
20
|
+
|
|
21
|
+
- ESM only, Node.js ≥ 20
|
|
22
|
+
- Seluruh API Baileys/ourin tetap diekspor → kode lama jalan tanpa perubahan
|
|
23
|
+
- `createBibzWhats()` = koneksi + pairing + reconnect + wipe sesi otomatis dalam satu panggilan
|
|
24
|
+
|
|
25
|
+
## Instalasi
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @xbibzlibrary/whatsbibz
|
|
29
|
+
# atau lokal (vendored di proyek):
|
|
30
|
+
npm install ./BibzWhats
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Semua contoh di bawah memakai specifier `@xbibzlibrary/whatsbibz`. Bila kamu memasangnya
|
|
34
|
+
sebagai vendored `bibzwhats` (`"bibzwhats": "file:./BibzWhats"`), cukup ganti specifier-nya —
|
|
35
|
+
API-nya sama persis.
|
|
36
|
+
|
|
37
|
+
Dependensi opsional (peer): `sharp` (thumbnail media), `qrcode-terminal`
|
|
38
|
+
(QR ASCII saat fallback), `link-preview-js`, `jimp`, `audio-decode`,
|
|
39
|
+
`@roamhq/wrtc` (VoIP).
|
|
40
|
+
|
|
41
|
+
## Mulai cepat — `createBibzWhats()`
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import { createBibzWhats, extractMessage, sendText } from '@xbibzlibrary/whatsbibz';
|
|
45
|
+
|
|
46
|
+
const client = await createBibzWhats({
|
|
47
|
+
phone: '6281234567890', // nomor bot (digit + kode negara)
|
|
48
|
+
pairingCode: 'XBIBZPRO', // opsional: kode custom 8 karakter A-Z0-9
|
|
49
|
+
authDir: 'bibzwhats-session',
|
|
50
|
+
printQR: true, // QR ASCII bila pairing code tak kunjung diterima
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
client.on('pairing-code', (code, { custom }) =>
|
|
54
|
+
console.log(`PAIRING CODE: ${code} ${custom ? '(custom)' : '(acak)'}`));
|
|
55
|
+
|
|
56
|
+
client.on('ready', (sock) => {
|
|
57
|
+
console.log('terhubung sebagai', sock.user?.id);
|
|
58
|
+
sock.ev.on('messages.upsert', async ({ messages, type }) => {
|
|
59
|
+
if (type !== 'notify') return;
|
|
60
|
+
for (const m of messages) {
|
|
61
|
+
if (m.key.fromMe) continue;
|
|
62
|
+
const item = extractMessage(m);
|
|
63
|
+
if (item?.type === 'text' && /^ping$/i.test(item.text)) {
|
|
64
|
+
await sendText(sock, m.key.remoteJid, '*pong* dari BibzWhats', { quoted: m });
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`client` adalah `EventEmitter`:
|
|
72
|
+
|
|
73
|
+
| Event | Payload | Keterangan |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| `pairing-code` | `(code, {custom, fallback})` | kode siap dimasukkan di HP |
|
|
76
|
+
| `qr` | `(qr)` | fallback QR (setelah `qrFallbackAfterMs`, atau langsung bila `phone` kosong) |
|
|
77
|
+
| `ready` | `(sock)` | socket **baru** siap dipakai — pasang handler di sini. Dipancarkan saat start **dan tiap reconnect** (socket lama mati, listener ikut hilang). Set `readyOnEveryConnect:false` untuk perilaku lama (sekali) |
|
|
78
|
+
| `first-ready` | `(sock)` | hanya sekali seumur client |
|
|
79
|
+
| `open` / `close` | `(sock)` / `({status, error})` | tiap kali koneksi buka/tutup |
|
|
80
|
+
| `user` | `(digits)` | nomor bot terdeteksi (persist bila perlu) |
|
|
81
|
+
| `reconnecting` | `({delay, attempt, fresh})` | reconnect dijadwalkan |
|
|
82
|
+
| `session-wiped` | `(reason)` | sesi dihapus (401/500/411/korup) |
|
|
83
|
+
| `give-up` | `(message)` | berhenti mencoba — perlu campur tangan manusia |
|
|
84
|
+
|
|
85
|
+
Properti/metode: `client.sock` (socket aktif; berubah setelah reconnect),
|
|
86
|
+
`client.isConnected()`, `client.close()`, `client.logout()`.
|
|
87
|
+
|
|
88
|
+
### Perilaku bawaan
|
|
89
|
+
|
|
90
|
+
- **Versi WA Web terbaru** diambil di setiap connect (`fetchLatestWaWebVersion`) — server menolak pairing dari klien yang versinya tertinggal. Bila fetch gagal, versi **tidak diturunkan** (dipakai versi bawaan library `BIBZWHATS_WA_WEB_VERSION`, diperbarui 2026-09-03 → `2.3000.1046721733`; upstream issue #2777: versi lama = 408 loop).
|
|
91
|
+
- **Pairing code diverifikasi server**: `requestPairingCode()` menunggu jawaban `companion_hello` (upstream PR #2769). Penolakan (`400 bad-request`, `429 rate-overlimit`) atau timeout kini **terlihat sebagai error** dan `creds.me` tidak tersimpan untuk perangkat yang tak pernah diakui — dulu kode "sukses" palsu muncul tapi notifikasi tautkan perangkat tidak pernah datang di HP.
|
|
92
|
+
- `companion_platform_display` **divalidasi WhatsApp dengan allow-list**. Sejak 1.2.0 library menurunkannya otomatis ke nilai yang pasti valid (`Browsers.macOS` → `"Chrome (Mac OS)"`, `Browsers.archLinux` → `"Chrome (Linux)"`, nama produk → OS host). Override manual tetap dihormati apa adanya — lihat § Identitas platform.
|
|
93
|
+
- **515 restartRequired** setelah pairing = normal → reconnect otomatis 2 dtk.
|
|
94
|
+
- **401 loggedOut / 500 badSession / 411 / sesi korup** → folder sesi dihapus, kredensial baru, pairing ulang (maks. `maxSessionWipes`, default 3). Identitas perangkat yang sudah terbukti diterima (`identity.json`) **tidak** ikut dihapus.
|
|
95
|
+
- **401 saat pairing masih tertunda** (koneksi putus setelah kode terbit, lalu sambung ulang) dikenali terpisah: kredensial diganti dan kode diminta ulang dalam 2 s, tanpa mengurangi kuota `maxSessionWipes`. Event `reconnecting` membawa `pairingPending: true`.
|
|
96
|
+
- **Reconnect** biasa dengan backoff 10 s × percobaan (maks. 60 s, `maxReconnectAttempts` = 10); koneksi yang sudah sehat lalu putus jaringan mencoba lagi dalam 1 s dulu.
|
|
97
|
+
- **`client.close()` bersih**: reconnect terjadwal dibatalkan, tidak ada timer tersisa — proses bisa keluar sendiri (diuji 40 siklus create→close).
|
|
98
|
+
- **Pairing controller**: satu request in-flight, refresh 150 dtk (kode yang sedang diketik tidak hangus), custom code ditolak → fallback acak sekali, 428/429 → backoff eksponensial sampai 10 menit.
|
|
99
|
+
- **IPv4 dipaksa** untuk upload media (`forceIPv4`, bisa dimatikan).
|
|
100
|
+
- Cache metadata grup 5 menit (`cachedGroupMetadata`) — hemat query saat kirim ke grup.
|
|
101
|
+
- **Tidak ada auto-follow channel/newsletter diam-diam** (`autoFollowNewsletterOnConnect` default `false`).
|
|
102
|
+
|
|
103
|
+
Semua opsi bisa dioverride; opsi mentah `makeWASocket` lewat `socketConfig`.
|
|
104
|
+
|
|
105
|
+
## API tingkat rendah (kompatibel Baileys)
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
import makeWASocket, { useMultiFileAuthState, DisconnectReason, fetchLatestWaWebVersion, downloadMediaMessage } from '@xbibzlibrary/whatsbibz';
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Semua yang ada di Baileys v7 / ourin-baileys tersedia: `makeWASocket`,
|
|
112
|
+
`useMultiFileAuthState`, `DisconnectReason`, `downloadMediaMessage`, `proto`,
|
|
113
|
+
`Browsers`, `jidNormalizedUser`, interactive message (`sock.sendMessage(jid, { interactiveButtons: [...] })`),
|
|
114
|
+
album, newsletter, `Button`/`Carousel`/`AIRich` builder, `VoipClient`, dll.
|
|
115
|
+
|
|
116
|
+
Penyesuaian nama: `Dugong` → `BibzWhatsEngine`, `sock.ourin` → `sock.bibz`
|
|
117
|
+
(alias `sock.ourin` dipertahankan), `Browsers.whatsbibz('Chrome')` tersedia (alias `Browsers.bibzwhats`).
|
|
118
|
+
|
|
119
|
+
## Helper BibzWhats
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
import {
|
|
123
|
+
sendText, sendMedia, react, presence, sendWithRetry, splitText, whatsappify,
|
|
124
|
+
extractMessage, unwrapMessage, messageTimestampMs,
|
|
125
|
+
LidMap, digitsOf, pnJid, lidJid, isGroupJid, isLidJid, sameUser, normalizeJid,
|
|
126
|
+
createPairingController, normalizePairingCode, wipeAuthDir,
|
|
127
|
+
} from '@xbibzlibrary/whatsbibz';
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- `sendText(sock, jid, text, {quoted, format})` — pecah otomatis ≤ 4000 karakter, retry 3×, markdown ChatGPT → format WA.
|
|
131
|
+
- `sendMedia(sock, jid, content, {quoted, fallbackToDocument})` — bila media ditolak, dikirim ulang sebagai dokumen.
|
|
132
|
+
- `extractMessage(m)` — `{type, text, participant, mentions, quoted, imageMsg|audioMsg|...}`; unwrap ephemeral/view-once/edited otomatis; tombol/list/poll/interactive response → `type: 'button' | 'poll'`.
|
|
133
|
+
- `LidMap` — peta LID ↔ nomor (`learnFromMessage(m)`, `canonical(jid)`, `variants(jid)`, `toJSON()/fromJSON()`).
|
|
134
|
+
|
|
135
|
+
## Handler `companion_reg_refresh` (bawaan)
|
|
136
|
+
|
|
137
|
+
Sejak 2026-07-28 server WA mengirim notification `companion_reg_refresh` /
|
|
138
|
+
`pair-device-rotate-qr` yang menyita material registrasi perangkat yang belum
|
|
139
|
+
paired. BibzWhats menanganinya di `lib/Socket/socket.js`: rotate adv secret
|
|
140
|
+
(32 byte CSPRNG) → `creds.update` → render ulang QR **ref yang sama** (pool ref
|
|
141
|
+
tidak habis). Bila `creds.me` sudah ada (pairing code sudah diminta / pair
|
|
142
|
+
sukses) adv secret dipertahankan agar verifikasi tidak rusak.
|
|
143
|
+
|
|
144
|
+
Fungsi murni untuk pengujian: `makePairingQRRenderer`, `handleCompanionRegRefresh`
|
|
145
|
+
(`import ... from '@xbibzlibrary/whatsbibz'`).
|
|
146
|
+
|
|
147
|
+
## Struktur
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
lib/
|
|
151
|
+
BibzWhats/ client.js (createBibzWhats), pairing.js, send.js, extract.js, jid.js
|
|
152
|
+
Socket/ socket.js (+ handler refresh), engine.js (BibzWhatsEngine), messages-*.js, ...
|
|
153
|
+
Utils/ companion-reg-client-utils.js (baru), generics.js, messages-media.js, ...
|
|
154
|
+
Defaults/ Signal/ Types/ WABinary/ WAM/ WAUSync/ VoIP/ Modded/
|
|
155
|
+
WAProto/ protobuf WhatsApp
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Identitas perangkat tertaut: kustom atau otomatis (paling stabil)
|
|
159
|
+
|
|
160
|
+
Yang tampil di HP sebagai *Perangkat tertaut* ditentukan oleh `browser = [os, browser, version]`.
|
|
161
|
+
Sejak 1.3.0 ada dua mode:
|
|
162
|
+
|
|
163
|
+
**Otomatis (default — tidak perlu setel apa pun).** Library memilih profil dengan skor stabilitas
|
|
164
|
+
tertinggi (`Mac OS / Chrome`), lalu **berpindah sendiri** bila server menolaknya — `428` sebelum QR,
|
|
165
|
+
`400 bad-request` saat pairing kode, atau `405` — ke profil berikutnya (`Mac OS/Safari` → `Windows/Chrome`
|
|
166
|
+
→ `Linux/Chrome` → `Ubuntu/Chrome` → …). Profil yang terbukti bekerja disimpan di `<authDir>/identity.json`
|
|
167
|
+
sehingga setelah restart identitasnya tetap sama (nama perangkat di HP tidak berubah-ubah).
|
|
168
|
+
|
|
169
|
+
```js
|
|
170
|
+
const client = await createBibzWhats({ phone }); // identity: 'auto'
|
|
171
|
+
client.on('identity-changed', (i) => console.log('ganti identitas →', i.linkedDeviceName, i.reason));
|
|
172
|
+
console.log(client.identity);
|
|
173
|
+
// { mode:'auto', profileId:'macos-chrome', linkedDeviceName:'Chrome (Mac OS)',
|
|
174
|
+
// pairingDisplay:'Chrome (Mac OS)', pairingDisplayAccepted:true, tried:[] }
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Kustom.** Identitas yang kamu tentukan dipakai **apa adanya** — tidak pernah diganti diam-diam. Bila
|
|
178
|
+
server menolaknya kamu mendapat log error yang jelas, bukan identitas lain. Semua bentuk ini setara:
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
createBibzWhats({ phone, identity: Browsers.archLinux('Chrome') }); // tuple preset
|
|
182
|
+
createBibzWhats({ phone, identity: ['Arch Linux', 'Firefox', '6.16.4'] }); // tuple bebas
|
|
183
|
+
createBibzWhats({ phone, identity: 'archLinux:Firefox' }); // "preset:Browser"
|
|
184
|
+
createBibzWhats({ phone, identity: 'Mac OS/Safari/15.6.1' }); // "OS/Browser/Versi"
|
|
185
|
+
createBibzWhats({ phone, identity: 'linux-chrome' }); // id profil
|
|
186
|
+
createBibzWhats({ phone, browser: ['Mac OS', 'Chrome', '14.4.1'] }); // alias lama, tetap jalan
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Lewat environment (tanpa ubah kode): `BIBZ_BROWSER="archLinux:Chrome"` atau `BIBZ_BROWSER="Arch Linux/Firefox/6.16"`,
|
|
190
|
+
atau trio `BIBZ_DEVICE_OS="Arch Linux" BIBZ_DEVICE_BROWSER="Chrome" BIBZ_DEVICE_VERSION="6.16"`. `BIBZ_BROWSER=auto`
|
|
191
|
+
memaksa mode otomatis. Prioritas: opsi di kode → env → otomatis.
|
|
192
|
+
|
|
193
|
+
| Profil auto (urutan) | Nama di HP | Display pairing |
|
|
194
|
+
|---|---|---|
|
|
195
|
+
| `macos-chrome` (skor 100) | Chrome (Mac OS) | Chrome (Mac OS) |
|
|
196
|
+
| `macos-safari` 95 · `windows-chrome` 92 · `linux-chrome` 90 · `ubuntu-chrome` 88 | … | sama dengan nama |
|
|
197
|
+
| `macos-firefox` 85 · `windows-edge` 84 · `archlinux-chrome` 80 | Chrome (Arch Linux) | Chrome (Linux) |
|
|
198
|
+
| `macos-desktop` / `windows-desktop` (hanya bila diminta eksplisit; butuh `syncFullHistory`) | Desktop (…) | Chrome (…) |
|
|
199
|
+
|
|
200
|
+
Opsi terkait: `maxIdentityRotations` (default 4). Fungsi yang diekspor: `resolveDeviceIdentity`,
|
|
201
|
+
`parseBrowserSpec`, `identityFromEnv`, `IDENTITY_PROFILES`, `describeIdentity`, `createIdentityRotator`.
|
|
202
|
+
|
|
203
|
+
## Identitas platform — Mac OS & Arch Linux (diukur ke server 2026-09-03)
|
|
204
|
+
|
|
205
|
+
Identitas companion adalah tuple `browser = [os, browser, version]`. Ia dipakai di **tiga**
|
|
206
|
+
tempat dengan aturan berbeda, dan BibzWhats menangani ketiganya:
|
|
207
|
+
|
|
208
|
+
| Tempat | Dipakai untuk | Aturan server | Yang dilakukan BibzWhats |
|
|
209
|
+
|---|---|---|---|
|
|
210
|
+
| `DeviceProps.os` (= `browser[0]`) | teks di *Perangkat tertaut* di HP | bebas | dikirim apa adanya: **"Mac OS"**, **"Arch Linux"** |
|
|
211
|
+
| `companion_platform_display` (pairing kode) | validasi `link_code_companion_reg` | **allow-list** — tak dikenal = `400 bad-request`, HP tak dapat notifikasi | diturunkan otomatis ke padanan valid (`derivePairingDisplay`) |
|
|
212
|
+
| `WebInfo.webSubPlatform` (`Desktop` + `syncFullHistory`) | jenis klien desktop | `DARWIN`/`APP_STORE` **ditutup** (428 sebelum QR), `WIN_HYBRID`/`WEB_BROWSER` OK | Mac OS Desktop → `WEB_BROWSER` (riwayat penuh tetap via `requireFullSync`) |
|
|
213
|
+
|
|
214
|
+
```js
|
|
215
|
+
import { createBibzWhats, Browsers } from '@xbibzlibrary/whatsbibz';
|
|
216
|
+
|
|
217
|
+
// macOS — tampil "Chrome (Mac OS)" / "Safari (Mac OS)" di HP
|
|
218
|
+
await createBibzWhats({ phone, browser: Browsers.macOS('Chrome') }); // default library
|
|
219
|
+
|
|
220
|
+
// Arch Linux — tampil "Chrome (Arch Linux)" di HP; pairing kode memakai "Chrome (Linux)"
|
|
221
|
+
await createBibzWhats({ phone, browser: Browsers.archLinux('Chrome') });
|
|
222
|
+
|
|
223
|
+
// mengikuti host: macOS → "Mac OS", Arch → "Arch Linux" (dibaca dari /etc/os-release), Windows → "Windows"
|
|
224
|
+
await createBibzWhats({ phone, browser: Browsers.appropriate('Chrome') });
|
|
225
|
+
|
|
226
|
+
client.identity // → { browser: ['Arch Linux','Chrome','6.12.44'], pairingDisplay: 'Chrome (Linux)' }
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Hasil pengukuran `companion_platform_display` terhadap server produksi (WA Web 2.3000.1046672143):
|
|
230
|
+
|
|
231
|
+
| Diterima | Ditolak (400) |
|
|
232
|
+
|---|---|
|
|
233
|
+
| OS: `Mac OS`, `macOS`, `Windows`, `Linux`, `Ubuntu`, `Debian`, `Fedora`, `CentOS`, `Gentoo`, `Manjaro`, `Chromium OS`, `Android`, `iOS` | OS: `Arch Linux`, `Arch`, `ArchLinux`, `GNU/Linux`, `Mac OS X`, `Linux Mint`, `openSUSE`, `Kali`, `NixOS`, `Pop!_OS`, `FreeBSD`, `Chrome OS`, nama produk apa pun |
|
|
234
|
+
| Browser: `Chrome`, `Chromium`, `Firefox`, `Safari`, `Edge`, `Opera`, `Brave`, `Vivaldi`, `Arc` | Browser: `Desktop`, nama produk |
|
|
235
|
+
|
|
236
|
+
Helper yang diekspor: `derivePairingDisplay(browser)`, `isPairingDisplayAccepted(str)`,
|
|
237
|
+
`resolvePairingOs(os)`, `lintIdentity({browser, companionPlatformDisplay})`, `hostOsLabel()`,
|
|
238
|
+
`linuxDistroName()`. Opsi socket baru: `companionPlatformId`, `webSubPlatform` (override eksplisit).
|
|
239
|
+
|
|
240
|
+
Uji hidup ke server (tanpa HP, nomor fiktif Ofcom +44 7700 900xxx): `npm run test:live`.
|
|
241
|
+
|
|
242
|
+
## Kompatibilitas WhatsApp Web (sinkron 2026-09-02)
|
|
243
|
+
|
|
244
|
+
Basis `ourin-baileys@9.0.21` setara Baileys **7.0.0-rc10** (Mei 2026). Patch upstream rc11 → rc14 → master + PR terbuka yang relevan sudah di-port:
|
|
245
|
+
|
|
246
|
+
| Patch | Sumber | Dampak |
|
|
247
|
+
|---|---|---|
|
|
248
|
+
| `WIN32` → `WIN_HYBRID` untuk `Browsers.windows('Desktop')` | master #2741 (2026-08-04) | server menutup 428 sebelum QR bila WIN32 diiklankan |
|
|
249
|
+
| versi WA Web bawaan `2.3000.1046721733` | web.whatsapp.com (2026-09-03) | fallback tidak lagi tertinggal |
|
|
250
|
+
| `requestPairingCode` pakai `query()`, `creds.me` setelah ACK, `companionPlatformDisplay` | PR #2769 | pairing kode gagal kini terdeteksi, sesi tidak teracuni |
|
|
251
|
+
| tctoken: atribut `t`, token kedaluwarsa/tanpa timestamp dibuang, bersarang di `<picture>`, tidak untuk JID sendiri | rc11+, #2607 | `profilePictureUrl` & kirim 1:1 sesuai WA Web |
|
|
252
|
+
| guard `protocolMessage` self-only (history sync / app-state key / LID migration / PDO) | rc12 | pengirim asing tidak bisa memalsukan state lokal |
|
|
253
|
+
| `Browsers.android()` + platform ANDROID (eksperimental) | #2201 | companion Android (bisa terima view-once) |
|
|
254
|
+
| `DARWIN` → `WEB_BROWSER` untuk `Browsers.macOS('Desktop')`; `companion_platform_display` allow-list; `Browsers.archLinux/linux`; `appropriate()` sadar distro | pengukuran BibzWhats 2026-09-03 (belum ada di upstream) | Mac OS Desktop tidak lagi 428; Arch Linux bisa pairing kode |
|
|
255
|
+
| `groupOnlineCount` di presence grup | #2545 | data tambahan `presence.update` |
|
|
256
|
+
| `<presence/>` tidak dikirim pada `creds.update` parsial | PR #2789 | `markOnlineOnConnect:false` dihormati, notifikasi HP tidak tersedot |
|
|
257
|
+
| `downloadContentFromMessage` mengutamakan `directPath` | PR #2778 | hindari `ENOTFOUND a.whatsapp.net` |
|
|
258
|
+
| `lottieStickerMessage` di-unwrap | PR #2776 | stiker Lottie terdeteksi sebagai sticker |
|
|
259
|
+
| guard `dispatcher` fetch (hanya Undici) | #2557 | `https.Agent` tidak bikin fetch error |
|
|
260
|
+
| `ev.destroy()`, `signalRepository.close()`, `registerSocketEndHandler` | #2191 | tidak bocor memori setelah reconnect berulang |
|
|
261
|
+
| `whatsapp-rust-bridge` 0.5.5 | upstream rc14 | dukungan CPU tanpa SIMD |
|
|
262
|
+
|
|
263
|
+
Cek sendiri kapan saja: `node -e "import('@xbibzlibrary/whatsbibz').then(m=>m.fetchLatestWaWebVersion().then(console.log))"`.
|
|
264
|
+
|
|
265
|
+
## TypeScript
|
|
266
|
+
|
|
267
|
+
Deklarasi tipe ikut di paket (`lib/index.d.ts`, `WAProto/index.d.ts` lengkap 217 namespace `proto`). Diverifikasi dengan
|
|
268
|
+
`tsc --strict`, `moduleResolution: NodeNext`, dan `skipLibCheck: false` — tidak perlu `@types` tambahan selain `@types/node`.
|
|
269
|
+
|
|
270
|
+
```ts
|
|
271
|
+
import { createBibzWhats, type BibzWhatsClient, type ResolvedIdentity } from '@xbibzlibrary/whatsbibz';
|
|
272
|
+
const client: BibzWhatsClient = await createBibzWhats({ phone: '628…', identity: 'archLinux:Chrome' });
|
|
273
|
+
client.on('identity-changed', (i) => console.log(i.linkedDeviceName));
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Catatan
|
|
277
|
+
|
|
278
|
+
- Logo & ikon (PNG/ICO) ada di `assets/logo/` — lihat `assets/logo/README.md`.
|
|
279
|
+
- WhatsApp Web API tidak resmi — gunakan nomor khusus, hindari spam (risiko banned).
|
|
280
|
+
- Lisensi MIT (WhatsBibz/BibzWhats) di atas MIT Baileys — lihat `LICENSE` dan `LICENSE.upstream`.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# BibzWhats 1.2.0 — Verifikasi identitas platform Mac OS & Arch Linux
|
|
2
|
+
|
|
3
|
+
Tanggal: 2026-09-03 (WIB) · Server: web.whatsapp.com, WA Web **2.3000.1046672143** (client_revision live saat uji)
|
|
4
|
+
Lingkup: **library saja** (`BibzWhats/`), tanpa menyentuh bot. Metode: unit test offline + koneksi nyata ke
|
|
5
|
+
server WhatsApp (handshake Noise → QR → `requestPairingCode`) dengan kredensial baru per kasus dan nomor fiktif
|
|
6
|
+
Ofcom (+44 7700 900xxx — rentang drama, tidak pernah dialokasikan; server tetap memvalidasi payload).
|
|
7
|
+
Tidak ada HP yang menerima notifikasi dan tidak ada sesi yang disimpan.
|
|
8
|
+
|
|
9
|
+
## 1. Ringkasan
|
|
10
|
+
|
|
11
|
+
| Pertanyaan | Jawaban |
|
|
12
|
+
|---|---|
|
|
13
|
+
| Bisa tampil sebagai **Mac OS** di perangkat tertaut? | Ya — `Browsers.macOS('Chrome'|'Safari'|'Firefox'|'Edge')`: QR OK, pairing kode **diterima** |
|
|
14
|
+
| Bisa tampil sebagai **Arch Linux**? | Ya — `Browsers.archLinux(...)`: `DeviceProps.os = "Arch Linux"`; QR OK; pairing kode **diterima** setelah display diturunkan otomatis ke `Chrome (Linux)` (nilai literal `Chrome (Arch Linux)` ditolak 400 oleh server) |
|
|
15
|
+
| `Browsers.macOS('Desktop')` + `syncFullHistory` (riwayat penuh)? | **Sekarang berhasil.** Sebelumnya (dan di upstream Baileys sampai hari ini) mengirim `WebSubPlatform.DARWIN` → server memutus **428 sebelum QR**. BibzWhats mengirim `WEB_BROWSER`; QR OK & pairing diterima; `requireFullSync=true` tetap terkirim |
|
|
16
|
+
| Jalan di Node yang dipakai macOS/Arch? | Lulus di Node **20.20.2** (sandbox), **22.23.2** (Arch `nodejs-lts-jod`, brew `node@22`), **24.20.0**, **26.8.1** (Arch `extra/nodejs`, brew `node`) — offline 37/37 dan live 5/5 |
|
|
17
|
+
|
|
18
|
+
## 2. Apa yang diubah (semua di `BibzWhats/lib`)
|
|
19
|
+
|
|
20
|
+
| Berkas | Perubahan |
|
|
21
|
+
|---|---|
|
|
22
|
+
| `Utils/platform-identity.js` (**baru**) + `.d.ts` | allow-list OS/browser hasil ukur, `derivePairingDisplay`, `isPairingDisplayAccepted`, `resolvePairingOs/Browser`, `hostOsLabel`, `linuxDistroName` (/etc/os-release), `lintIdentity` |
|
|
23
|
+
| `Utils/browser-utils.js` | `Browsers.archLinux`, `Browsers.linux`, `macOS` → `15.6.1`, `bibzwhats` → `1.2.0`, `appropriate()` memakai nama distro nyata |
|
|
24
|
+
| `Utils/validate-connection.js` | `PLATFORM_MAP['Mac OS'] = WEB_BROWSER` (bukan DARWIN); opsi `webSubPlatform` override |
|
|
25
|
+
| `Socket/socket.js` | `companion_platform_display = config.companionPlatformDisplay ?? derivePairingDisplay(browser)`; `companion_platform_id` bisa di-override (`companionPlatformId`) |
|
|
26
|
+
| `BibzWhats/client.js` (+`.d.ts`) | `lintIdentity` saat start (peringatan dini), `client.identity` |
|
|
27
|
+
| `BibzWhats/pairing.js` | pesan error 400 menyebut allow-list |
|
|
28
|
+
| `Types/index.d.ts`, `Types/Socket.d.ts` | tipe untuk preset & opsi baru |
|
|
29
|
+
| `Defaults`, `Utils/generics.js`, `BibzWhats/version.js` | versi WA fallback 2.3000.1046672143; `BIBZWHATS_VERSION = 1.2.0` |
|
|
30
|
+
| `test/identity.test.js` (**baru**, 11) · `test/identity-live.test.js` (**baru**, 5, aktif dgn `BIBZ_LIVE=1`) | — |
|
|
31
|
+
|
|
32
|
+
Tidak ada perubahan API yang memutus kompatibilitas: semua export lama tetap; default `Browsers.macOS('Chrome')` tetap.
|
|
33
|
+
|
|
34
|
+
## 3. Hasil pengukuran ke server (mentah)
|
|
35
|
+
|
|
36
|
+
### 3a. Handshake + registrasi (QR) per identitas — semua kredensial baru
|
|
37
|
+
| Identitas (`browser`, opsi) | webSubPlatform terkirim | Hasil |
|
|
38
|
+
|---|---|---|
|
|
39
|
+
| Mac OS / Chrome, Safari, Firefox, Edge | WEB_BROWSER | QR OK (0,3–0,6 s) |
|
|
40
|
+
| Mac OS / Desktop, tanpa sync | WEB_BROWSER | QR OK |
|
|
41
|
+
| Mac OS / Desktop + syncFullHistory — **kode lama** | **DARWIN (3)** | **FAIL 428 "Connection Terminated" sebelum QR** |
|
|
42
|
+
| Mac OS / Desktop + syncFullHistory — **1.2.0** | WEB_BROWSER (0) | QR OK, pairing diterima |
|
|
43
|
+
| Mac OS / Desktop + sync, override `WIN_HYBRID` | WIN_HYBRID (5) | QR OK, pairing diterima |
|
|
44
|
+
| Mac OS / Desktop + sync, override `APP_STORE` | APP_STORE (1) | FAIL 428 |
|
|
45
|
+
| Arch Linux / Chrome, Firefox | WEB_BROWSER | QR OK |
|
|
46
|
+
| Arch Linux / Desktop + syncFullHistory | WEB_BROWSER | QR OK |
|
|
47
|
+
| Linux / Chrome · Ubuntu / Chrome · Debian / Chrome | WEB_BROWSER | QR OK |
|
|
48
|
+
| Windows / Desktop + syncFullHistory | WIN_HYBRID | QR OK |
|
|
49
|
+
|
|
50
|
+
### 3b. `companion_platform_display` pada `link_code_companion_reg stage=companion_hello`
|
|
51
|
+
Server menjawab `<iq type='result'><link_code_companion_reg stage='companion_hello'><link_code_pairing_ref>…` (diterima)
|
|
52
|
+
atau `<error code='400' text='bad-request'/>` (ditolak). Format wajib `"<Browser> (<OS>)"`; huruf besar-kecil bebas.
|
|
53
|
+
|
|
54
|
+
| Nilai | Hasil |
|
|
55
|
+
|---|---|
|
|
56
|
+
| Chrome (Mac OS) · Safari (Mac OS) · Firefox (Mac OS) · Edge (Mac OS) · Opera (Mac OS) · Chromium (Mac OS) · Brave (Mac OS) · Vivaldi (Mac OS) · Arc (Mac OS) · Mobile Safari (Mac OS) · chrome (mac os) · Chrome (macOS) | **diterima** |
|
|
57
|
+
| Chrome (Linux) · Firefox (Linux) · Safari (Linux) · Chrome (Ubuntu) · Chrome (Debian) · Chrome (Fedora) · Chrome (CentOS) · Chrome (Gentoo) · Chrome (Manjaro) · Chrome (Chromium OS) · Chrome (Windows) · Edge (Windows) · Chrome (Android) · Safari (iOS) | **diterima** |
|
|
58
|
+
| **Chrome (Arch Linux)** · Chrome (Arch) · Chrome (ArchLinux) · Chrome (Arch Linux ARM) · Chrome (GNU/Linux) · Chrome (Linux Mint) · Chrome (Mint) · Chrome (openSUSE) · Chrome (Kali) · Chrome (Pop!_OS) · Chrome (NixOS) · Chrome (FreeBSD) · Chrome (Chrome OS) · Chrome (Mac OS X) | **400 bad-request** |
|
|
59
|
+
| **Desktop (Mac OS)** · **Desktop (Windows)** · Foo (Mac OS) · Chrome (BibzWhats) | **400 bad-request** |
|
|
60
|
+
|
|
61
|
+
`companion_platform_id` (0 UNKNOWN, 1 Chrome, 3 Firefox, 5/6 Safari, 7 Desktop/Electron, 8 UWP, 9 OTHER) **tidak** memengaruhi
|
|
62
|
+
hasil — hanya string display yang divalidasi. Kesimpulan ini konsisten dengan kode WA Web sendiri
|
|
63
|
+
(`WAWebAltDeviceLinkingIq`: `companionPlatformDisplayElementValue: browser.name + " (" + os.name + ")"` dari ua-parser).
|
|
64
|
+
|
|
65
|
+
### 3c. Perilaku `requestPairingCode` (nomor/kode)
|
|
66
|
+
| Kasus | Hasil |
|
|
67
|
+
|---|---|
|
|
68
|
+
| nomor valid 12 digit · nomor 20 digit | diterima, `creds.me` terisi setelah ACK |
|
|
69
|
+
| nomor 3 digit · `+44 7700…` (dengan +/spasi) · `0447…` | **408 Timed Out** (server tidak menjawab) — `creds.me` tetap kosong (tidak meracuni sesi) |
|
|
70
|
+
| kode custom `XBIBZPRO` / `xbibzpro` | diterima; server tidak mengubah huruf |
|
|
71
|
+
| kode custom 7 karakter | ditolak lokal sebelum kirim |
|
|
72
|
+
| rate-limit | `500 rate-overlimit` (terjadi bila 1 nomor dipakai berulang dalam waktu singkat; harness memakai nomor berbeda per kasus) |
|
|
73
|
+
|
|
74
|
+
### 3d. `createBibzWhats` end-to-end (jalur nyata library)
|
|
75
|
+
Mac OS/Chrome dan Arch Linux/Chrome, `pairingCode: 'XBIBZPRO'`: event `pairing-code` `{custom:true}` dalam <3 s,
|
|
76
|
+
`client.identity.pairingDisplay` = `Chrome (Mac OS)` / `Chrome (Linux)`, `creds.me` & `creds.pairingCode` tersimpan,
|
|
77
|
+
putus paksa → `close 428` → `reconnecting` otomatis.
|
|
78
|
+
|
|
79
|
+
## 4. Cara mengulang
|
|
80
|
+
```bash
|
|
81
|
+
cd BibzWhats
|
|
82
|
+
npm install
|
|
83
|
+
npm test # 42 test: 37 offline lulus, 5 live di-skip
|
|
84
|
+
npm run test:live # 5 test ke server WA nyata (≈40 s), nomor fiktif, tanpa HP
|
|
85
|
+
```
|
|
86
|
+
Bila suatu hari `Chrome (Linux)` ikut ditolak, ubah tabel di `lib/Utils/platform-identity.js` (`PAIRING_ACCEPTED_OS`)
|
|
87
|
+
dan jalankan `npm run test:live` untuk memverifikasi.
|
|
88
|
+
|
|
89
|
+
## 5. Catatan jujur
|
|
90
|
+
- **Belum diuji**: pairing tuntas sampai HP sungguhan menampilkan "Arch Linux"/"Mac OS" di *Perangkat tertaut* — butuh HP
|
|
91
|
+
pemilik nomor. Teks itu berasal dari `DeviceProps.os` yang terkirim di registrasi (diverifikasi byte-nya dikirim dan diterima
|
|
92
|
+
server tanpa penolakan), jadi risikonya kecil.
|
|
93
|
+
- Allow-list server bisa berubah tanpa pemberitahuan; tabel di atas adalah potret 2026-09-03.
|
|
94
|
+
- `Browsers.appropriate()` di sandbox uji menghasilkan `"Debian"` (host Debian 13); di Arch akan menghasilkan `"Arch Linux"`
|
|
95
|
+
(diuji dengan `/etc/os-release` tiruan di `test/identity.test.js`).
|
|
96
|
+
|
|
97
|
+
## 6. Identitas kustom vs otomatis (ditambahkan setelah § 1–5)
|
|
98
|
+
|
|
99
|
+
Permintaan: identitas perangkat tertaut harus bisa disetel kustom, dan bila tidak disetel library otomatis memakai yang
|
|
100
|
+
paling stabil. Implementasi di `lib/BibzWhats/device-identity.js`, terintegrasi ke `createBibzWhats`.
|
|
101
|
+
|
|
102
|
+
| Skenario (live, server produksi, nomor fiktif) | Hasil |
|
|
103
|
+
|---|---|
|
|
104
|
+
| Tidak ada setelan → auto | profil `macos-chrome` langsung stabil; `pairing-code` 0,9 s; `identity.json` reason `pairing-accepted` |
|
|
105
|
+
| Auto, profil pertama disabotase saat handshake (DARWIN → 428 sebelum QR) | `identity-changed` → `macos-safari` pada 0,9 s; reconnect 1 s; pairing diakui pada 2,5 s |
|
|
106
|
+
| Auto, profil pertama disabotase saat pairing (display tak valid → 400) | `identity-changed` pada 1,2 s; socket ditutup & disambung ulang dengan identitas baru; pairing diakui pada 3,2 s |
|
|
107
|
+
| Auto, restart proses setelah rotasi | identitas tersimpan (`macos-safari`) dilanjutkan (`source: auto+saved`), tidak mulai lagi dari `macos-chrome` |
|
|
108
|
+
| Kustom `archLinux:Chrome` | dipakai apa adanya; nama HP `Chrome (Arch Linux)`, display pairing `Chrome (Linux)`; pairing diakui |
|
|
109
|
+
| Kustom yang ditolak server (`Mac OS/Desktop` + DARWIN paksa) | **tidak** diganti: log error jelas, tidak ada `identity-changed`, reconnect biasa |
|
|
110
|
+
|
|
111
|
+
Semua skenario di atas ada di `test/identity-live.test.js` (10 test live) dan logikanya di `test/device-identity.test.js`
|
|
112
|
+
(12 test offline). Total suite: 59 test (49 lulus, 10 live di-skip tanpa `BIBZ_LIVE=1`) di Node 20.20 / 22.23 / 24.20 / 26.8.
|
|
113
|
+
|
|
114
|
+
Aturan yang dipilih dan alasannya:
|
|
115
|
+
- Rotasi hanya pada sinyal **penolakan identitas** (428 sebelum QR, 400 pairing, 405). 401/408/429/515 bukan alasan ganti
|
|
116
|
+
identitas — mengganti identitas saat rate-limit hanya memperburuk.
|
|
117
|
+
- Rotasi hanya sebelum perangkat terdaftar. Setelah terdaftar, identitas dikunci (mengubahnya = perangkat "lain" di HP).
|
|
118
|
+
- Wipe sesi (401/500/411) **mempertahankan** `identity.json` bila alasannya `qr-received|pairing-accepted|open`.
|
|
119
|
+
- Mode kustom tidak pernah dirotasi: pilihan pemakai adalah kontrak; library hanya memberi peringatan (`lintIdentity`) dan
|
|
120
|
+
error yang menyebut penyebabnya.
|
|
121
|
+
|
|
122
|
+
## 7. Verifikasi kesiapan produksi & rilis npm `@xbibzlibrary/whatsbibz` 1.3.0
|
|
123
|
+
|
|
124
|
+
| Pemeriksaan | Hasil |
|
|
125
|
+
|---|---|
|
|
126
|
+
| Sintaks semua berkas `lib/**` (Node 20) | 0 error |
|
|
127
|
+
| Suite offline (`npm test`) | 54 lulus / 0 gagal (11 live di-skip) di Node 20.20, 22.23, 24.20, 26.8 |
|
|
128
|
+
| Suite live (`BIBZ_LIVE=1`) | 11/11 — QR, pairing, auto-rotasi 428 & 400, kustom, kontrol negatif, ketahanan putus jaringan |
|
|
129
|
+
| Kebocoran siklus hidup | 40× create→close offline + 3× live: resource aktif tersisa hanya stdio, proses keluar sendiri |
|
|
130
|
+
| TypeScript konsumen (`tsc --strict`, `skipLibCheck:false`, NodeNext) | 0 error; kontrol negatif (tipe salah) ditolak 5 error |
|
|
131
|
+
| `npm pack` → install di proyek kosong | ESM, CJS (`import()`), subpath `lib/*` & `package.json`, `fetchLatestWaWebVersion()` OK |
|
|
132
|
+
| `npm audit --omit=dev` | 0 kerentanan |
|
|
133
|
+
| Isi tarball | 5,3 MB / 21,8 MB terbuka / 260 berkas; tanpa test/example/scripts/harness/sesi |
|
|
134
|
+
| Integrasi bot (`tests/bibzwhats-integration.test.js`) | 6/6 |
|
|
135
|
+
|
|
136
|
+
Temuan yang diperbaiki sebelum publish: timer reconnect bocor setelah `close()`; 401 "pairing tertunda" setelah putus jaringan
|
|
137
|
+
diperlakukan sebagai kegagalan nomor; `WAProto/index.d.ts` kosong dari upstream (TS tidak bisa kompilasi); `.d.ts` bergantung
|
|
138
|
+
deklarasi `whatsapp-rust-bridge` yang rusak.
|
|
@@ -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
|