Commit Graph

27 Commits

Author SHA1 Message Date
Renato Alcara df1acc8f0c chore(logs): reduce decrypt-error noise (~75% fewer lines per recover… (#391)
chore(logs): reduce decrypt-error noise (~75% fewer lines per recover… (#391)
2026-04-26 11:36:21 -03:00
Renato Alcara d233a7856f fix: eliminate 40s message delivery delay caused by libsignal console dumps
fix: eliminate 40s message delivery delay caused by libsignal console dumps
2026-02-27 08:43:54 -03:00
Claude 4b02652369 style: auto-fix lint errors and formatting issues
Applied yarn lint --fix to auto-correct:
- Import spacing and sorting across multiple files
- Trailing commas
- Arrow function formatting
- Object literal formatting
- Indentation consistency
- Removed unused imports (BaileysEventType, jest from tests)

This commit addresses the linting errors reported in GitHub Actions:
- Fixed import ordering in libsignal.ts
- Fixed trailing commas in Defaults/index.ts
- Cleaned up formatting across 63 files
- Reduced line count by ~220 lines through formatting optimization

Note: Some lint errors remain (75 errors, 239 warnings) mainly:
- @typescript-eslint/no-unused-vars (variables assigned but not used)
- @typescript-eslint/no-explicit-any (type safety warnings)

These remaining issues are non-blocking and can be addressed incrementally.

https://claude.ai/code/session_015R3U3kiprQiNTTNNt31Sg6
2026-02-13 21:59:35 +00:00
Claude be88bc870c fix: address all 6 Copilot AI review comments from PR #154
Fixes all valid issues identified by Copilot AI review:

1. 🔴 CRITICAL: Fix deduplication key collision risk
   - Before: Used maskedJid in dedupe key (e.g., "4680****7890")
   - Problem: Different JIDs with same first/last 4 digits collide
   - After: Use original unmasked JID for dedup key
   - Impact: Prevents legitimate errors from being suppressed

2. 🟡 Fix JID masking logic flaw
   - Before: Masked full JID string including domain (e.g., "1234****.net")
   - Problem: Obscures useful info while masking wrong part
   - After: Decode JID, mask only user portion, preserve domain
   - Result: "4680****7890@s.whatsapp.net" instead of "1234****.net"

3. 🟡 Add structured logging context
   - Before: logger.info(string) - loses queryability
   - After: logger.info({ jid, maskedJid, targetedDevices }, message)
   - Impact: Maintains observability and log filtering capability

4. 🟡 Fix misleading deletion count wording
   - Before: "Cleared: X devices" (implies actual deletions)
   - Problem: deleteSession() returns void, count is targeted
   - After: "Targeted: X devices" (reflects actual behavior)

5. 🟢 Remove unused variable
   - Removed _origConsoleLog (dead code after removing console.log interceptor)
   - Prevents no-unused-vars lint failure

6. 🟢 Fix semicolon format violation
   - Repository config: semi: false (Prettier)
   - Removed trailing semicolon from JID extraction line
   - Prevents eslint-plugin-prettier check failure

All changes maintain backward compatibility while fixing correctness,
observability, and code quality issues.

https://claude.ai/code/session_01TvSrN9JmHZDdKMZDFWEcUS
2026-02-12 21:27:37 +00:00
Claude 1ef4095fee refactor: improve libsignal error logging and deduplication
Implements 4 key improvements to reduce log noise and duplicates:

1.  Remove console.log interceptor
   - Libsignal only uses console.error for errors
   - Eliminates duplicate interception (was logging 2x per error)
   - Reduces code by 50+ lines

2.  Increase deduplication window (100ms → 150ms)
   - Better coverage for rapid sequential errors
   - Configurable via DEDUP_WINDOW_MS constant

3.  Type + JID tracking for smart deduplication
   - Uses Map<string, number> instead of single variable
   - Deduplication key: "errorType:maskedJID"
   - Prevents false positives (different error types now tracked separately)
   - Memory-safe: auto-cleanup keeps last 50 entries max

4.  Concise session recreation summary
   - Before: Verbose multi-line debug logs
   - After: Single line "🔄 Session Reset | JID: 4680****_1.0 | Cleared: 6 devices"
   - Shows masked JID, deleted count, and next action
   - cleanupCorruptedSession() now returns deletion count

Expected log improvement:
- Before: 3-9 duplicate logs per error burst
- After: 1 log per unique error type per contact

https://claude.ai/code/session_01TvSrN9JmHZDdKMZDFWEcUS
2026-02-12 20:36:45 +00:00
Claude 6c6f49d93f fix: apply PR review feedback corrections
Addresses valid Copilot AI review comments from PR #152:

1.  Add 'Failed to decrypt' check to console.error handler
   - Fixes inconsistency between console.log and console.error
   - Both handlers now detect all error types uniformly

2.  Fix double space in emoji error messages
   - Changed '⚠️  Session Error' to '⚠️ Session Error'
   - Consistent with other emoji messages (one space)

3.  Add type safety to args[1] concatenation
   - Changed (args[1] || '') to String(args[1] ?? '')
   - Prevents "[object Object]" when args[1] is an object

https://claude.ai/code/session_01TvSrN9JmHZDdKMZDFWEcUS
2026-02-12 18:57:48 +00:00
Claude aca49891e5 feat: format session error logs cleanly
Replace verbose libsignal session errors with clean, readable format.

Before:
Session error:Error: Bad MAC Error: Bad MAC
    at Object.verifyMAC (.../libsignal/src/crypto.js:87:15)
    at SessionCipher.doDecryptWhisperMessage (.../session_cipher.js:250:16)
    at async SessionCipher.decryptWithSessions (.../session_cipher.js:147:29)
    ...

After:
🔐 Bad MAC Error | JID: 4680****1027

Changes:
- Intercepts console.log and console.error from libsignal
- Detects error type (Bad MAC, Counter Error, Decryption Failed)
- Extracts and masks JID for privacy
- Avoids duplicate logs within 100ms
- Simple and direct - no configuration needed

https://claude.ai/code/session_01TvSrN9JmHZDdKMZDFWEcUS
2026-02-12 03:49:15 +00:00
Claude ce68035261 fix: move console.log suppression to index.ts entrypoint
CRITICAL FIX: Console.log override must run BEFORE libsignal loads

**Problem:**
- libsignal makes console.log calls directly in session_cipher.js
- Previous override in Signal/libsignal.ts loaded too late
- libsignal already had references to original console.log

**Solution:**
- Move override to src/index.ts (library entrypoint)
- Runs before ANY imports, including libsignal
- Now intercepts all libsignal logs successfully

**Testing:**
- Logs from /node_modules/@whiskeysockets/infiniteapi/node_modules/libsignal/
- Should now be suppressed

https://claude.ai/code/session_01SoNUGBEWbJwWWws3F2fuzh
2026-02-11 05:12:50 +00:00
Claude 6f9fd27321 fix: add isJidUser alias for zpro.io compatibility
Adds backward compatibility alias:
- isJidUser -> isPersonJid

This allows zpro.io and other consumers that depend on the old
isJidUser function name to continue working without changes.
2026-01-24 20:31:49 +00:00
Claude 76e080daec feat: add makeWASocketAutoVersion for automatic version fetching
Adds a new async function that automatically fetches the latest
WhatsApp Web version from web.whatsapp.com before connecting.

Usage:
```typescript
// Option 1: Auto-fetch version (recommended)
const sock = await makeWASocketAutoVersion({ auth: state })

// Option 2: Manual version (existing behavior)
const sock = makeWASocket({ auth: state })
```

Benefits:
- No need to update library for version changes
- Automatic fallback to bundled version if fetch fails
- Logged warnings when using fallback
2026-01-21 16:38:46 +00:00
Rajeh Taher 8dc852ee89 proto: fix proto generation, tsc: fix node imports of compiled code 2025-07-19 23:16:35 +03:00
AstroX11 aa0579d12d adjustment(remove non existentant exports) (#1305) 2025-03-10 23:33:40 +02:00
Rajeh Taher f1f49ad2c8 Usync: Barebones Usync Protocol support (#960)
* feature(feature/usync-mex): initial commit

* chore: fix merge commit

* chore:lint
2024-12-22 23:38:41 +02:00
Rajeh Taher 306e1c1355 WEB WAM IMPLEMENTATION!!!!! (#708)
* feat(WAM): initial commit

* fix(wam-development): I made a whoopsie

* Update Example/example.ts

Co-authored-by: Javier Cuevas <javiercr@gmail.com>

---------

Co-authored-by: Javier Cuevas <javiercr@gmail.com>
2024-04-28 14:03:24 +03:00
Eko Eryanto a1fb826cea feat: expose makeWASocket as named (#190) 2023-07-08 18:42:56 -03:00
Adhiraj Singh e7f6838fa4 chore: remove legacy code 2022-09-19 14:59:35 +05:30
Adhiraj Singh fb66733b61 feat: implement in memory store
1. the store works as a temporary store for connection data such as chats, messages & contacts
2. the store is primarily meant to illustrate the usage of the event emitter as a way to construct the state of the connection. This will likely be very inefficient to perform well at scale
3. the store is meant to be a quick way to have some visibility of data while testing
4. the store works for both legacy & MD connections
2022-01-19 21:35:59 +05:30
Adhiraj Singh 8f11f0be76 chore: add linting 2022-01-19 15:54:02 +05:30
Adhiraj Singh a723b50741 chore: add type distinguisher for sockets 2021-12-18 19:54:08 +05:30
Adhiraj Singh c803e22e8a feat: functional legacy socket 2021-12-17 20:58:33 +05:30
Adhiraj Singh de8e281103 export WABinay in default export 2021-10-01 13:47:02 +05:30
Adhiraj Singh f267f27ada finalize multi-device 2021-09-22 22:19:53 +05:30
Adhiraj Singh b5ee036ae9 update proto 2021-07-29 20:33:19 +05:30
Adhiraj Singh 71e34fc5f8 Cleanup + add remaining utils 2021-07-12 23:50:08 +05:30
Adhiraj Singh 89cf8004e9 Wrap up connection + in memory store 2021-07-09 20:35:07 +05:30
Adhiraj Singh 0344d6336c Stream uploads + downloads + allow for remote url uploads
- Switch to using got
- Use encryption/decryption streams for speed & lesser memory consumption
- Allow for stream based download & simultaneous upload of media
2021-01-13 22:48:28 +05:30
Edgard 8651299ec2 Improved typedoc page 2020-12-18 09:14:59 -03:00