whalibmob 5.5.28 → 5.5.30

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/lib/Client.js CHANGED
@@ -790,7 +790,7 @@ class WhalibmobClient extends EventEmitter {
790
790
  }
791
791
 
792
792
  const fromStr = attrs.from ? String(attrs.from) : '';
793
- // Extract bare phone number: "407xxx@s.whatsapp.net" → "407xxxx"
793
+ // Extract bare phone number: "40756469325@s.whatsapp.net" → "40756469325"
794
794
  const recipientPhone = fromStr.split('@')[0].split('.')[0];
795
795
 
796
796
  process.stderr.write('[DBG] RETRY_RECV msgId=' + msgId + ' from=' + fromStr + ' — clearing session + resending\n');
@@ -1589,7 +1589,7 @@ class WhalibmobClient extends EventEmitter {
1589
1589
  */
1590
1590
  _reissueTcTokenAfterIdentityChange(from) {
1591
1591
  if (!this._tcTokenStore || !from) return;
1592
- const { normalizeJidForTcToken, isTcTokenExpired } = require('./messages/TcTokenStore');
1592
+ const { normalizeJidForTcToken, tcTokenExpired } = require('./messages/TcTokenStore');
1593
1593
 
1594
1594
  void (async () => {
1595
1595
  try {
@@ -1601,7 +1601,7 @@ class WhalibmobClient extends EventEmitter {
1601
1601
 
1602
1602
  const entry = this._tcTokenStore.get(tcJid);
1603
1603
  const senderTs = entry && entry.senderTimestamp;
1604
- if (!senderTs || isTcTokenExpired(senderTs)) {
1604
+ if (!senderTs || tcTokenExpired(senderTs)) {
1605
1605
  // No previous issuance — nothing to re-issue
1606
1606
  return;
1607
1607
  }
@@ -889,6 +889,23 @@ class MessageSender {
889
889
  client._issuePrivacyTokens(ackFrom || tcJid, issueTs)
890
890
  .then(result => client._storeTcTokenFromIqResult(result, tcJid, issueTs))
891
891
  .then(() => {
892
+ // Verify that real token bytes were received from the server.
893
+ // If the IQ timed out (result=NULL) or the server refused to
894
+ // issue (restricted account), tokenBytes=0 — re-sending would
895
+ // just get another 463 immediately. Reject with a clear message.
896
+ const tcStore = client._tcTokenStore;
897
+ const entry = tcStore && tcStore.get(tcJid);
898
+ const hasToken = entry && entry.token && entry.token.length > 0;
899
+ if (!hasToken) {
900
+ process.stderr.write(
901
+ '[DBG] ACK_463 IQ timeout or server refused — no token bytes stored for ' +
902
+ tcJid + ', giving up (account may be restricted)\n'
903
+ );
904
+ throw new Error(
905
+ 'Send error 463: server did not issue a tctoken for ' + tcJid +
906
+ ' (IQ timeout or account restricted)'
907
+ );
908
+ }
892
909
  process.stderr.write('[DBG] ACK_463 token stored for ' + tcJid + ' — retrying send\n');
893
910
  const retryId = crypto.randomBytes(8).toString('hex').toUpperCase();
894
911
  const retryNode = new BinaryNode(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whalibmob",
3
- "version": "5.5.28",
3
+ "version": "5.5.30",
4
4
  "description": "WhatsApp library for interaction with WhatsApp Mobile API no web",
5
5
  "author": "Kunboruto20",
6
6
  "main": "index.js",