aunubaileys 1.0.14 โ 1.0.16
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/README.md +8 -0
- package/lib/Socket/messages-recv.js +13 -2
- package/lib/Socket/messages-send.js +17 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,14 @@ Everything else is pure upstream. When upstream moves, we rebase the patch layer
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
### ๐ What's new in 1.0.16 / Baru di 1.0.16
|
|
68
|
+
|
|
69
|
+
- ๐ชช **Identity changes are handled, not just logged** โ when WhatsApp notifies that a contact's identity changed (new phone / reinstall / recycled number), upstream Baileys logs โidentity changedโ and does nothing, leaving your stored session bound to the old identity so that contact's messages keep failing. AunuBaileys now deletes the stored session for that JID on the spot, so the next exchange re-initiates cleanly against the new identity.
|
|
70
|
+
|
|
71
|
+
### ๐ What's new in 1.0.15 / Baru di 1.0.15
|
|
72
|
+
|
|
73
|
+
- ๐ค **Send-side session heal** โ the twin of 1.0.14 for outgoing messages: when the stored session for a JID is corrupt, `encryptMessage` throws and every send to that contact fails permanently. Now a session-flavoured encrypt error triggers an automatic heal โ drop the session, fetch a fresh bundle from the server, encrypt once more. Non-session errors pass through untouched, and a second failure propagates (no retry loop).
|
|
74
|
+
|
|
67
75
|
### ๐ What's new in 1.0.14 / Baru di 1.0.14
|
|
68
76
|
|
|
69
77
|
- ๐ **Bad MAC self-heal** โ when a contact's E2E session rots (classic after re-pairing: every message from that one contact fails with โBad MACโ forever), upstream Baileys just retries against the same stale session endlessly. AunuBaileys now counts consecutive decrypt failures per identity; at the 3rd, it **deletes the stale session** (new `signalRepository.deleteSession`) and forces the next retry receipt to carry fresh keys, so the peer re-initiates a clean session โ the same reset dance official clients use. A successful decrypt zeroes the counter. Groups are excluded (sender-key class, handled separately).
|
|
@@ -176,8 +176,19 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
176
176
|
const identityNode = getBinaryNodeChild(node, 'identity');
|
|
177
177
|
if (identityNode) {
|
|
178
178
|
logger.info({ jid: from }, 'identity changed');
|
|
179
|
-
//
|
|
180
|
-
//
|
|
179
|
+
// AunuBaileys: upstream logged this and did nothing, leaving the
|
|
180
|
+
// OLD session bound to the OLD identity โ every later message from
|
|
181
|
+
// that contact then fails against the archived session (Bad MAC
|
|
182
|
+
// class) until the peer happens to send a pre-key message. Drop
|
|
183
|
+
// the stored session now (1.0.14 machinery) so the next exchange
|
|
184
|
+
// re-initiates cleanly against the new identity.
|
|
185
|
+
try {
|
|
186
|
+
await signalRepository.deleteSession(from);
|
|
187
|
+
logger.warn({ jid: from }, 'aunu: deleted stored session after identity change; next message re-initiates a fresh session');
|
|
188
|
+
}
|
|
189
|
+
catch (delErr) {
|
|
190
|
+
logger.debug({ err: delErr }, 'aunu: session delete on identity change failed');
|
|
191
|
+
}
|
|
181
192
|
}
|
|
182
193
|
else {
|
|
183
194
|
logger.info({ node }, 'unknown encrypt notification');
|
|
@@ -229,7 +229,23 @@ export const makeMessagesSocket = (config) => {
|
|
|
229
229
|
return {};
|
|
230
230
|
}
|
|
231
231
|
const bytes = encodeWAMessage(patchedMessage);
|
|
232
|
-
|
|
232
|
+
let encResult;
|
|
233
|
+
try {
|
|
234
|
+
encResult = await signalRepository.encryptMessage({ jid, data: bytes });
|
|
235
|
+
}
|
|
236
|
+
catch (encErr) {
|
|
237
|
+
// AunuBaileys: a corrupt/rotten stored session makes EVERY send to
|
|
238
|
+
// this JID fail at encrypt time, forever. Heal it the Signal way:
|
|
239
|
+
// drop the session, fetch a fresh bundle, encrypt once more.
|
|
240
|
+
if (!/session/i.test(String(encErr?.message || encErr))) {
|
|
241
|
+
throw encErr;
|
|
242
|
+
}
|
|
243
|
+
logger.warn({ jid, err: encErr?.message }, 'aunu: encrypt failed on a stale session; refreshing the session and retrying once');
|
|
244
|
+
await signalRepository.deleteSession(jid);
|
|
245
|
+
await assertSessions([jid], true);
|
|
246
|
+
encResult = await signalRepository.encryptMessage({ jid, data: bytes });
|
|
247
|
+
}
|
|
248
|
+
const { type, ciphertext } = encResult;
|
|
233
249
|
if (type === 'pkmsg') {
|
|
234
250
|
shouldIncludeDeviceIdentity = true;
|
|
235
251
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aunubaileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.16",
|
|
5
5
|
"description": "AunuBaileys \u2014 a WhatsApp Web API for bots that never sleep. Full upstream power with the beloved in-memory store restored and pairing that just works. Forged by AunuCore.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|