aunubaileys 1.0.47 β†’ 1.0.48

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 CHANGED
@@ -64,6 +64,10 @@ 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.48 / Baru di 1.0.48
68
+
69
+ - 🩹 **Group Bad MAC now heals both layers.** The "Bad MAC" error (from Tenka's live log on 11 Nov 2026, the same LID address as the B-01 finding and the 1.0.46 flood) is thrown by `SessionCipher` β€” the whisper/E2E session layer β€” and in groups it can equally come from the sender-key layer. The old strike-limit path (1.0.14) for groups deleted only the sender key, so a rotten E2E session of the author was never touched and the failures repeated forever: the same wrong-layer class that 1.0.46 closed for session failures, now closed on the strike path. At the 3-failure limit, groups now reset the author's E2E session (including the alternate PN↔LID address record) AND drop the sender key, with the retry receipt carrying fresh keys. DM behaviour and the 3-strike threshold are unchanged. The `messages.decrypt-failure` event now distinguishes `errorClass: 'bad-mac'` from `'session'`/`'other'` (new exported predicate: `isBadMacError(text)`).
70
+
67
71
  ### πŸ§ͺ What's new in 1.0.47 / Baru di 1.0.47 β€” EXPERIMENTAL
68
72
 
69
73
  - πŸ§ͺ **Five experimental features that exist only in AunuBaileys**, in a single version. All are attached automatically to the socket returned by `makeWASocket` and are explicitly experimental β€” semantics may change in any release: (1) **Invisible text watermark** β€” `sock.aunuWatermark(text, tag)` hides a short tag (bot name, campaign, build) inside message text as zero-width characters for leak tracing and fingerprinting; the visible text is unchanged; companions `aunuReadWatermark(text)` and `aunuStripWatermark(text)`, plus root utils `encodeWatermark`/`appendWatermark`/`extractWatermark`/`stripWatermark`. (2) **Human send** β€” `sock.aunuHumanSend(jid, content)`: shows "composing" for a plausible typing duration derived from the text length (util `computeTypingDuration`, clamped 700–8000 ms, Β±20% jitter), then sends. (3) **Scheduled send** β€” `sock.aunuSchedule(jid, content, when)` (ms delay or Date) with `aunuCancelScheduled(id)` and `aunuListScheduled()`; in-memory, lost on restart. (4) **Self-destruct** β€” `sock.aunuSelfDestruct(jid, content, seconds)`: sends, then revokes the message for everyone after N seconds; `aunuCancelSelfDestruct(messageId)` cancels. (5) **Connection doctor** β€” `sock.aunuDoctor()`: one structured health snapshot (bundled WA version, registration state, open transport, known LID pair count, pending experimental timers).
@@ -5,7 +5,7 @@ import Long from 'long';
5
5
  import { proto } from '../../WAProto/index.js';
6
6
  import { DEFAULT_CACHE_TTLS, KEY_BUNDLE_TYPE, MIN_PREKEY_COUNT } from '../Defaults/index.js';
7
7
  import { WAMessageStatus, WAMessageStubType } from '../Types/index.js';
8
- import { aesDecryptCTR, aesEncryptGCM, cleanMessage, Curve, decodeMediaRetryNode, decodeMessageNode, decryptMessageNode, delay, derivePairingCodeKey, encodeBigEndian, encodeSignedDeviceIdentity, getCallStatusFromNode, getHistoryMsg, getNextPreKeys, getStatusFromReceiptType, hkdf, isUnrecoverableSessionError, MISSING_KEYS_ERROR_TEXT, NACK_REASONS, NO_MESSAGE_FOUND_ERROR_TEXT, buildCallControlStanza, parseRetryReceiptSession, unixTimestampSeconds, xmppPreKey, xmppSignedPreKey } from '../Utils/index.js';
8
+ import { aesDecryptCTR, aesEncryptGCM, cleanMessage, Curve, decodeMediaRetryNode, decodeMessageNode, decryptMessageNode, delay, derivePairingCodeKey, encodeBigEndian, encodeSignedDeviceIdentity, getCallStatusFromNode, getHistoryMsg, getNextPreKeys, getStatusFromReceiptType, hkdf, isBadMacError, isUnrecoverableSessionError, MISSING_KEYS_ERROR_TEXT, NACK_REASONS, NO_MESSAGE_FOUND_ERROR_TEXT, buildCallControlStanza, parseRetryReceiptSession, unixTimestampSeconds, xmppPreKey, xmppSignedPreKey } from '../Utils/index.js';
9
9
  import { makeMutex } from '../Utils/make-mutex.js';
10
10
  import { sentMessageCacheFor } from '../Utils/sent-message-cache.js';
11
11
  import { areJidsSameUser, getAllBinaryNodeChildren, getBinaryNodeChild, getBinaryNodeChildBuffer, getBinaryNodeChildren, getBinaryNodeChildString, isJidGroup, isJidStatusBroadcast, isJidUser, isLidUser, jidDecode, jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary/index.js';
@@ -789,8 +789,15 @@ export const makeMessagesRecvSocket = (config) => {
789
789
  }
790
790
  else if (fails >= DECRYPT_FAIL_SESSION_RESET_LIMIT) {
791
791
  if (isGroupMsg) {
792
+ // AunuBaileys (1.0.48): Bad MAC adalah error
793
+ // lapis whisper/sesi E2E (SessionCipher), dan
794
+ // di grup ia juga bisa datang dari lapis
795
+ // sender key β€” menghapus sender key SAJA
796
+ // (perilaku 1.0.14) tidak menyentuh sesi E2E
797
+ // penulis yang busuk. Bersihkan keduanya.
798
+ await resetE2ESession();
792
799
  await signalRepository.deleteSenderKey(msg.key.remoteJid, author);
793
- logger.warn({ author, group: msg.key.remoteJid }, 'aunu: deleted stale sender-key record after repeated group decrypt failures; retry request asks the author to resend with a fresh distribution message');
800
+ logger.warn({ author, group: msg.key.remoteJid }, 'aunu: reset E2E session and deleted stale sender-key record after repeated group decrypt failures; retry receipt carries fresh keys');
794
801
  }
795
802
  else {
796
803
  await resetE2ESession();
@@ -813,7 +820,7 @@ export const makeMessagesRecvSocket = (config) => {
813
820
  isGroup: isGroupMsg,
814
821
  failures: fails,
815
822
  healed,
816
- errorClass: sessionLayerFailure ? 'session' : 'other',
823
+ errorClass: sessionLayerFailure ? 'session' : (isBadMacError(msg?.messageStubParameters?.[0]) ? 'bad-mac' : 'other'),
817
824
  messageId: node.attrs.id,
818
825
  timestamp: Date.now()
819
826
  });
@@ -3,6 +3,7 @@ import { type BinaryNode } from '../WABinary/index.js';
3
3
  import type { ILogger } from './logger.js';
4
4
  export declare const NO_MESSAGE_FOUND_ERROR_TEXT = "Message absent from node";
5
5
  export declare const isUnrecoverableSessionError: (text: unknown) => boolean;
6
+ export declare const isBadMacError: (text: unknown) => boolean;
6
7
  export declare const MISSING_KEYS_ERROR_TEXT = "Key used already or never filled";
7
8
  export declare const NACK_REASONS: {
8
9
  ParsingError: number;
@@ -227,4 +227,11 @@ export const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
227
227
  */
228
228
  export const isUnrecoverableSessionError = (text) => typeof text === 'string' &&
229
229
  /no matching sessions found|no session record|no sessions available/i.test(text);
230
+ /**
231
+ * AunuBaileys: true when a decrypt failure text is a MAC verification
232
+ * failure ("Bad MAC") β€” the stored session/sender-key state and the
233
+ * sender's state disagree about the message authentication code, the
234
+ * classic symptom of a desynchronised ratchet on either side.
235
+ */
236
+ export const isBadMacError = (text) => typeof text === 'string' && /bad mac/i.test(text);
230
237
  //# sourceMappingURL=decode-wa-message.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aunubaileys",
3
3
  "type": "module",
4
- "version": "1.0.47",
4
+ "version": "1.0.48",
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",