@badzz88/baileys 8.4.9 → 8.5.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.
Files changed (153) hide show
  1. package/WAProto/WAProto.proto +6 -347
  2. package/WAProto/fix-imports.js +85 -86
  3. package/WAProto/index.d.ts +25 -4913
  4. package/WAProto/index.js +93 -14069
  5. package/{src → lib}/Defaults/index.js +2 -13
  6. package/{src → lib}/Signal/Group/group_cipher.js +5 -5
  7. package/{src → lib}/Signal/Group/keyhelper.js +4 -4
  8. package/{src → lib}/Signal/Group/sender-chain-key.js +2 -2
  9. package/{src → lib}/Signal/Group/sender-key-distribution-message.js +1 -1
  10. package/{src → lib}/Signal/Group/sender-key-message.js +3 -3
  11. package/{src → lib}/Signal/Group/sender-key-record.js +1 -1
  12. package/{src → lib}/Signal/Group/sender-message-key.js +2 -2
  13. package/{src → lib}/Signal/libsignal.js +26 -6
  14. package/{src → lib}/Socket/chats.js +58 -616
  15. package/{src → lib}/Socket/communities.js +28 -59
  16. package/{src → lib}/Socket/graphql.js +103 -362
  17. package/{src → lib}/Socket/groups.js +29 -77
  18. package/{src → lib}/Socket/index.js +5 -3
  19. package/{src → lib}/Socket/interactive-handler.js +60 -117
  20. package/{src → lib}/Socket/interop.js +19 -36
  21. package/lib/Socket/luxu.js +387 -0
  22. package/{src → lib}/Socket/managed-account.js +27 -58
  23. package/{src → lib}/Socket/messages-recv.js +143 -715
  24. package/{src → lib}/Socket/messages-send.js +102 -412
  25. package/lib/Socket/mex.js +60 -0
  26. package/{src → lib}/Socket/newsletter.js +23 -266
  27. package/{src → lib}/Socket/privacy.js +38 -41
  28. package/{src → lib}/Socket/registration.js +106 -113
  29. package/{src → lib}/Socket/socket.js +101 -88
  30. package/{src → lib}/Socket/text-router.js +17 -1
  31. package/lib/Socket/username.js +243 -0
  32. package/lib/Store/keyed-db.js +108 -0
  33. package/{src → lib}/Store/make-in-memory-store.js +104 -6
  34. package/lib/Types/Mex.js +112 -0
  35. package/{src → lib}/Types/Newsletter.js +41 -72
  36. package/{src → lib}/Types/index.js +1 -0
  37. package/{src → lib}/Utils/chat-utils.js +9 -73
  38. package/lib/Utils/command-loader.d.ts +31 -0
  39. package/lib/Utils/command-loader.js +100 -0
  40. package/lib/Utils/companion-reg-client-utils.js +42 -0
  41. package/lib/Utils/crypto.js +155 -0
  42. package/lib/Utils/curve25519-js.js +275 -0
  43. package/{src → lib}/Utils/decode-wa-message.js +36 -284
  44. package/{src → lib}/Utils/event-buffer.js +27 -6
  45. package/{src → lib}/Utils/generics.js +37 -114
  46. package/{src → lib}/Utils/index.js +5 -1
  47. package/lib/Utils/lt-hash.js +39 -0
  48. package/{src → lib}/Utils/message-retry-manager.js +39 -0
  49. package/{src → lib}/Utils/messages-media.js +58 -105
  50. package/{src → lib}/Utils/messages.js +529 -115
  51. package/lib/Utils/meta-ai-msmsg.js +262 -0
  52. package/lib/Utils/native-bridge.js +82 -0
  53. package/{src → lib}/Utils/noise-handler.js +15 -13
  54. package/{src → lib}/Utils/process-message.js +55 -54
  55. package/{src → lib}/Utils/reporting-utils.js +2 -2
  56. package/lib/Utils/session-pool.d.ts +16 -0
  57. package/lib/Utils/session-pool.js +94 -0
  58. package/{src → lib}/Utils/signal.js +51 -19
  59. package/{src → lib}/Utils/stanza-ack.js +2 -36
  60. package/lib/Utils/sticker.d.ts +17 -0
  61. package/lib/Utils/sticker.js +145 -0
  62. package/{src → lib}/Utils/tc-token-utils.js +1 -1
  63. package/{src → lib}/Utils/validate-connection.js +11 -40
  64. package/lib/Utils/view-once-cache.d.ts +9 -0
  65. package/lib/Utils/view-once-cache.js +79 -0
  66. package/{src → lib}/WABinary/decode.js +4 -38
  67. package/lib/WABinary/encode.js +228 -0
  68. package/{src → lib}/WABinary/generic-utils.js +93 -1
  69. package/{src → lib}/WABinary/jid-utils.js +3 -16
  70. package/{src → lib}/WAM/encode.js +1 -1
  71. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +43 -0
  72. package/{src → lib}/WAUSync/Protocols/USyncContactProtocol.js +1 -7
  73. package/{src → lib}/WAUSync/Protocols/USyncDeviceProtocol.js +5 -13
  74. package/{src → lib}/WAUSync/Protocols/USyncDisappearingModeProtocol.js +4 -1
  75. package/{src → lib}/WAUSync/Protocols/USyncFeatureProtocol.js +2 -17
  76. package/{src → lib}/WAUSync/Protocols/USyncStatusProtocol.js +2 -7
  77. package/{src → lib}/WAUSync/Protocols/USyncUsernameProtocol.js +1 -2
  78. package/{src → lib}/WAUSync/Protocols/index.js +0 -1
  79. package/{src → lib}/WAUSync/USyncQuery.js +6 -77
  80. package/{src → lib}/WAUSync/USyncUser.js +8 -16
  81. package/{src → lib}/WAUSync/index.js +0 -1
  82. package/{src → lib}/antiban.js +266 -355
  83. package/{src → lib}/index.js +2 -2
  84. package/package.json +18 -15
  85. package/WAProto/fix-import.js +0 -38
  86. package/src/Socket/mex.js +0 -47
  87. package/src/Socket/username.js +0 -234
  88. package/src/Utils/crypto.js +0 -125
  89. package/src/Utils/lt-hash.js +0 -10
  90. package/src/Utils/message-inspect.js +0 -400
  91. package/src/Utils/meta-ai-msmsg.js +0 -133
  92. package/src/WABinary/encode.js +0 -58
  93. package/src/WAUSync/Protocols/USyncBusinessProtocol.js +0 -100
  94. package/src/WAUSync/USyncBackoff.js +0 -31
  95. /package/{src → lib}/Defaults/phonenumber-mcc.json +0 -0
  96. /package/{src → lib}/Signal/Group/ciphertext-message.js +0 -0
  97. /package/{src → lib}/Signal/Group/group-session-builder.js +0 -0
  98. /package/{src → lib}/Signal/Group/index.js +0 -0
  99. /package/{src → lib}/Signal/Group/sender-key-name.js +0 -0
  100. /package/{src → lib}/Signal/Group/sender-key-state.js +0 -0
  101. /package/{src → lib}/Signal/lid-mapping.js +0 -0
  102. /package/{src → lib}/Socket/Client/index.js +0 -0
  103. /package/{src → lib}/Socket/Client/types.js +0 -0
  104. /package/{src → lib}/Socket/Client/websocket.js +0 -0
  105. /package/{src → lib}/Socket/aigroups.js +0 -0
  106. /package/{src → lib}/Socket/business.js +0 -0
  107. /package/{src → lib}/Store/index.js +0 -0
  108. /package/{src → lib}/Store/make-cache-manager-store.js +0 -0
  109. /package/{src → lib}/Store/make-ordered-dictionary.js +0 -0
  110. /package/{src → lib}/Store/object-repository.js +0 -0
  111. /package/{src → lib}/Types/Auth.js +0 -0
  112. /package/{src → lib}/Types/Bussines.js +0 -0
  113. /package/{src → lib}/Types/Call.js +0 -0
  114. /package/{src → lib}/Types/Chat.js +0 -0
  115. /package/{src → lib}/Types/Contact.js +0 -0
  116. /package/{src → lib}/Types/Events.js +0 -0
  117. /package/{src → lib}/Types/GroupMetadata.js +0 -0
  118. /package/{src → lib}/Types/Label.js +0 -0
  119. /package/{src → lib}/Types/LabelAssociation.js +0 -0
  120. /package/{src → lib}/Types/Message.js +0 -0
  121. /package/{src → lib}/Types/Product.js +0 -0
  122. /package/{src → lib}/Types/Signal.js +0 -0
  123. /package/{src → lib}/Types/Socket.js +0 -0
  124. /package/{src → lib}/Types/State.js +0 -0
  125. /package/{src → lib}/Types/USync.js +0 -0
  126. /package/{src → lib}/Utils/auth-utils.js +0 -0
  127. /package/{src → lib}/Utils/browser-utils.js +0 -0
  128. /package/{src → lib}/Utils/business.js +0 -0
  129. /package/{src → lib}/Utils/consumer-application.js +0 -0
  130. /package/{src → lib}/Utils/group-history.js +0 -0
  131. /package/{src → lib}/Utils/history.js +0 -0
  132. /package/{src → lib}/Utils/identity-change-handler.js +0 -0
  133. /package/{src → lib}/Utils/jid-display-normalization.js +0 -0
  134. /package/{src → lib}/Utils/link-preview.js +0 -0
  135. /package/{src → lib}/Utils/logger.js +0 -0
  136. /package/{src → lib}/Utils/make-mutex.js +0 -0
  137. /package/{src → lib}/Utils/message-composer.js +0 -0
  138. /package/{src → lib}/Utils/offline-node-processor.js +0 -0
  139. /package/{src → lib}/Utils/pre-key-manager.js +0 -0
  140. /package/{src → lib}/Utils/sync-action-utils.js +0 -0
  141. /package/{src → lib}/Utils/use-multi-file-auth-state.js +0 -0
  142. /package/{src → lib}/Utils/voip-rekey.js +0 -0
  143. /package/{src → lib}/WABinary/constants.js +0 -0
  144. /package/{src → lib}/WABinary/index.js +0 -0
  145. /package/{src → lib}/WABinary/types.js +0 -0
  146. /package/{src → lib}/WAM/BinaryInfo.js +0 -0
  147. /package/{src → lib}/WAM/constants.js +0 -0
  148. /package/{src → lib}/WAM/index.js +0 -0
  149. /package/{src → lib}/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -0
  150. /package/{src → lib}/WAUSync/Protocols/USyncLIDProtocol.js +0 -0
  151. /package/{src → lib}/WAUSync/Protocols/USyncPictureProtocol.js +0 -0
  152. /package/{src → lib}/WAUSync/Protocols/USyncSidelistProtocol.js +0 -0
  153. /package/{src → lib}/WAUSync/Protocols/USyncTextStatusProtocol.js +0 -0
@@ -26,8 +26,6 @@ exports.VERSION =
26
26
  exports.PLACEHOLDER_MAX_AGE_SECONDS =
27
27
  exports.STATUS_EXPIRY_SECONDS =
28
28
  exports.WA_DEFAULT_EPHEMERAL =
29
- exports.WA_ADV_HOSTED_KEY_INDEX_LIST_SIG_PREFIX =
30
- exports.WA_ADV_KEY_INDEX_LIST_SIG_PREFIX =
31
29
  exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX =
32
30
  exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX =
33
31
  exports.WA_ADV_DEVICE_SIG_PREFIX =
@@ -44,8 +42,7 @@ const index_js_1 = require('../../WAProto/index.js')
44
42
  const libsignal_1 = require('../Signal/libsignal')
45
43
  const browser_utils_1 = require('../Utils/browser-utils')
46
44
  const logger_1 = __importDefault(require('../Utils/logger'))
47
- // [major, 3000, client_revision] — client_revision is fetched from web.whatsapp.com/sw.js
48
- const version = [2, 3000, 1043437050]
45
+ const version = [2, 3000, 1041467552]
49
46
  exports.VERSION = version
50
47
  exports.UNAUTHORIZED_CODES = [401, 403, 419]
51
48
  exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com'
@@ -58,9 +55,6 @@ exports.WA_ADV_ACCOUNT_SIG_PREFIX = Buffer.from([6, 0])
58
55
  exports.WA_ADV_DEVICE_SIG_PREFIX = Buffer.from([6, 1])
59
56
  exports.WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX = Buffer.from([6, 5])
60
57
  exports.WA_ADV_HOSTED_DEVICE_SIG_PREFIX = Buffer.from([6, 6])
61
- // Prefix for the key-index-list ADV signature (CompanionDeviceAdvUtil, C08C.A0J / A0K)
62
- exports.WA_ADV_KEY_INDEX_LIST_SIG_PREFIX = Buffer.from([6, 2])
63
- exports.WA_ADV_HOSTED_KEY_INDEX_LIST_SIG_PREFIX = Buffer.from([6, 7])
64
58
  exports.WA_DEFAULT_EPHEMERAL = 7 * 24 * 60 * 60
65
59
  /** Status messages older than 24 hours are considered expired */
66
60
  exports.STATUS_EXPIRY_SECONDS = 24 * 60 * 60
@@ -93,6 +87,7 @@ exports.DEFAULT_CONNECTION_CONFIG = {
93
87
  waWebSocketUrl: 'wss://web.whatsapp.com/ws/chat',
94
88
  connectTimeoutMs: 20000,
95
89
  keepAliveIntervalMs: 30000,
90
+ aiLabel: true,
96
91
  logger: logger_1.default.child({ class: 'baileys' }),
97
92
  emitOwnEvents: true,
98
93
  defaultQueryTimeoutMs: 60000,
@@ -108,12 +103,6 @@ exports.DEFAULT_CONNECTION_CONFIG = {
108
103
  return syncType !== index_js_1.proto.HistorySync.HistorySyncType.FULL
109
104
  },
110
105
  shouldIgnoreJid: () => false,
111
- // NOT IMPLEMENTED: receiving interop messages (BirdyChat/Haiket) is not yet supported.
112
- // The interop bridge only establishes a Signal session with device 0 (the primary phone).
113
- // Companion devices (any device != 0) never receive interop messages directly — no fan-out.
114
- // masqueradeAsPrimary: true only works when Baileys is registered as the primary (no phone).
115
- // With an existing phone account the server rejects it (401) because the noise key is bound
116
- // to a companion slot and cannot be re-mapped to device 0 after registration.
117
106
  masqueradeAsPrimary: false,
118
107
  linkPreviewImageThumbnailWidth: 192,
119
108
  transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
  Object.defineProperty(exports, '__esModule', { value: true })
3
3
  exports.GroupCipher = void 0
4
- const rb = require('whatsapp-rust-bridge-baron')
4
+ const Crypto_1 = require('../../Utils/crypto')
5
5
  const sender_key_message_1 = require('./sender-key-message')
6
6
  class GroupCipher {
7
7
  constructor(senderKeyStore, senderKeyName) {
@@ -73,15 +73,15 @@ class GroupCipher {
73
73
  }
74
74
  async getPlainText(iv, key, ciphertext) {
75
75
  try {
76
- return Buffer.from(rb.aesDecryptWithIV(ciphertext, key, iv))
77
- } catch {
76
+ return Buffer.from(Crypto_1.aesDecryptWithIV(ciphertext, key, iv))
77
+ } catch (e) {
78
78
  throw new Error('InvalidMessageException')
79
79
  }
80
80
  }
81
81
  async getCipherText(iv, key, plaintext) {
82
82
  try {
83
- return Buffer.from(rb.aesEncrypWithIV(plaintext, key, iv))
84
- } catch {
83
+ return Buffer.from(Crypto_1.aesEncrypWithIV(plaintext, key, iv))
84
+ } catch (e) {
85
85
  throw new Error('InvalidMessageException')
86
86
  }
87
87
  }
@@ -55,7 +55,7 @@ exports.generateSenderKey = generateSenderKey
55
55
  exports.generateSenderKeyId = generateSenderKeyId
56
56
  exports.generateSenderSigningKey = generateSenderSigningKey
57
57
  const nodeCrypto = __importStar(require('crypto'))
58
- const rb = require('whatsapp-rust-bridge-baron')
58
+ const Crypto_1 = require('../../Utils/crypto')
59
59
  function generateSenderKey() {
60
60
  return nodeCrypto.randomBytes(32)
61
61
  }
@@ -64,10 +64,10 @@ function generateSenderKeyId() {
64
64
  }
65
65
  function generateSenderSigningKey(key) {
66
66
  if (!key) {
67
- key = rb.generateKeyPair()
67
+ key = Crypto_1.Curve.generateKeyPair()
68
68
  }
69
69
  return {
70
- public: Buffer.from(key.pubKey),
71
- private: Buffer.from(key.privKey)
70
+ public: Crypto_1.generateSignalPubKey(key.public),
71
+ private: Buffer.from(key.private)
72
72
  }
73
73
  }
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
  Object.defineProperty(exports, '__esModule', { value: true })
3
3
  exports.SenderChainKey = void 0
4
- const rb = require('whatsapp-rust-bridge-baron')
4
+ const Crypto_1 = require('../../Utils/crypto')
5
5
  const sender_message_key_1 = require('./sender-message-key')
6
6
  class SenderChainKey {
7
7
  constructor(iteration, chainKey) {
@@ -26,7 +26,7 @@ class SenderChainKey {
26
26
  return this.chainKey
27
27
  }
28
28
  getDerivative(seed, key) {
29
- return Buffer.from(rb.hmacSign(seed, key))
29
+ return Buffer.from(Crypto_1.hmacSign(seed, key))
30
30
  }
31
31
  }
32
32
  exports.SenderChainKey = SenderChainKey
@@ -22,7 +22,7 @@ class SenderKeyDistributionMessage extends ciphertext_message_1.CiphertextMessag
22
22
  ? Buffer.from(distributionMessage.signingKey, 'base64')
23
23
  : distributionMessage.signingKey
24
24
  } catch (e) {
25
- throw e instanceof Error ? e : new Error(String(e))
25
+ throw new Error(String(e))
26
26
  }
27
27
  } else {
28
28
  const version = this.intsToByteHighAndLow(this.CURRENT_VERSION, this.CURRENT_VERSION)
@@ -1,7 +1,7 @@
1
1
  'use strict'
2
2
  Object.defineProperty(exports, '__esModule', { value: true })
3
3
  exports.SenderKeyMessage = void 0
4
- const rb = require('whatsapp-rust-bridge-baron')
4
+ const Crypto_1 = require('../../Utils/crypto')
5
5
  const index_js_1 = require('../../../WAProto/index.js')
6
6
  const ciphertext_message_1 = require('./ciphertext-message')
7
7
  class SenderKeyMessage extends ciphertext_message_1.CiphertextMessage {
@@ -53,11 +53,11 @@ class SenderKeyMessage extends ciphertext_message_1.CiphertextMessage {
53
53
  verifySignature(signatureKey) {
54
54
  const part1 = this.serialized.slice(0, this.serialized.length - this.SIGNATURE_LENGTH)
55
55
  const part2 = this.serialized.slice(-1 * this.SIGNATURE_LENGTH)
56
- const res = rb.verifySignature(signatureKey, part1, part2)
56
+ const res = Crypto_1.Curve.verify(signatureKey, part1, part2)
57
57
  if (!res) throw new Error('Invalid signature!')
58
58
  }
59
59
  getSignature(signatureKey, serialized) {
60
- return Buffer.from(rb.calculateSignature(signatureKey, serialized))
60
+ return Buffer.from(Crypto_1.Curve.sign(signatureKey, serialized))
61
61
  }
62
62
  serialize() {
63
63
  return this.serialized
@@ -36,7 +36,7 @@ class SenderKeyRecord {
36
36
  return this.senderKeyStates.map(state => state.getStructure())
37
37
  }
38
38
  static deserialize(data) {
39
- const str = Buffer.from(data).toString('utf8')
39
+ const str = Buffer.from(data).toString('utf-8')
40
40
  const parsed = JSON.parse(str, generics_1.BufferJSON.reviver)
41
41
  return new SenderKeyRecord(parsed)
42
42
  }
@@ -1,11 +1,11 @@
1
1
  'use strict'
2
2
  Object.defineProperty(exports, '__esModule', { value: true })
3
3
  exports.SenderMessageKey = void 0
4
- const rb = require('whatsapp-rust-bridge-baron')
4
+ const Crypto_1 = require('../../Utils/crypto')
5
5
  class SenderMessageKey {
6
6
  constructor(iteration, seed) {
7
7
  // HKDF(seed, 96, salt=0x00*32, info='WhisperGroup') → split into 3×32 byte chunks
8
- const derived = Buffer.from(rb.hkdf(seed, 96, { salt: Buffer.alloc(32), info: 'WhisperGroup' }))
8
+ const derived = Buffer.from(Crypto_1.hkdf(seed, 96, { salt: Buffer.alloc(32), info: 'WhisperGroup' }))
9
9
  const keys = new Uint8Array(32)
10
10
  keys.set(new Uint8Array(derived.slice(16, 32))) // bytes 16-31 of chunk 0
11
11
  keys.set(new Uint8Array(derived.slice(32, 48)), 16) // bytes 0-15 of chunk 1
@@ -52,7 +52,7 @@ var __importStar =
52
52
  })()
53
53
  Object.defineProperty(exports, '__esModule', { value: true })
54
54
  exports.makeLibSignalRepository = makeLibSignalRepository
55
- const rb = require('whatsapp-rust-bridge-baron')
55
+ const rb = require('../Utils/native-bridge').loadRustBridge()
56
56
  const lru_cache_1 = require('lru-cache')
57
57
  const Utils_1 = require('../Utils')
58
58
  const WABinary_1 = require('../WABinary')
@@ -82,6 +82,12 @@ function extractIdentityFromPkmsg(ciphertext) {
82
82
  }
83
83
  }
84
84
  function makeLibSignalRepository(auth, logger, pnToLIDFunc) {
85
+ if (!rb) {
86
+ throw new Error(
87
+ 'The Signal session (Double Ratchet encryption) requires the "whatsapp-rust-bridge" native ' +
88
+ 'module, which failed to load. Make sure it is installed: npm install whatsapp-rust-bridge@0.5.4'
89
+ )
90
+ }
85
91
  const lidMapping = new lid_mapping_1.LIDMappingStore(auth.keys, logger, pnToLIDFunc)
86
92
  const storage = signalStorage(auth, lidMapping)
87
93
  const parsedKeys = auth.keys
@@ -192,6 +198,21 @@ function makeLibSignalRepository(auth, logger, pnToLIDFunc) {
192
198
  await cipher.initOutgoing(session)
193
199
  }, jid)
194
200
  },
201
+ async getSessionInfo(jid) {
202
+ try {
203
+ const addr = jidToSignalProtocolAddress(jid)
204
+ const sessBytes = await storage.loadSession(addr.toString())
205
+ if (!sessBytes) return null
206
+ const session = rb.SessionRecord.deserialize(sessBytes)
207
+ const open = session.getOpenSession?.()
208
+ const baseKey = open?.indexInfo?.baseKey
209
+ const registrationId = open?.registrationId
210
+ if (!baseKey || typeof registrationId !== 'number') return null
211
+ return { baseKey: new Uint8Array(baseKey), registrationId }
212
+ } catch (error) {
213
+ return null
214
+ }
215
+ },
195
216
  jidToSignalProtocolAddress(jid) {
196
217
  return jidToSignalProtocolAddress(jid).toString()
197
218
  },
@@ -257,7 +278,7 @@ function makeLibSignalRepository(auth, logger, pnToLIDFunc) {
257
278
  // Session exists in storage
258
279
  const deviceStr = sessionKey.split('.')[1]
259
280
  if (!deviceStr) continue
260
- const deviceNum = parseInt(deviceStr, 10)
281
+ const deviceNum = parseInt(deviceStr)
261
282
  let jid = deviceNum === 0 ? `${user}@s.whatsapp.net` : `${user}:${deviceNum}@s.whatsapp.net`
262
283
  if (deviceNum === 99) {
263
284
  jid = `${user}:99@hosted`
@@ -358,7 +379,7 @@ function signalStorage({ creds, keys }, lidMapping) {
358
379
  if (id.includes('.')) {
359
380
  const [deviceId, device] = id.split('.')
360
381
  const [user, domainType_] = deviceId.split('_')
361
- const domainType = parseInt(domainType_ || '0', 10)
382
+ const domainType = parseInt(domainType_ || '0')
362
383
  if (
363
384
  domainType === WABinary_1.WAJIDDomains.LID ||
364
385
  domainType === WABinary_1.WAJIDDomains.HOSTED_LID ||
@@ -388,7 +409,7 @@ function signalStorage({ creds, keys }, lidMapping) {
388
409
  }
389
410
  // Return raw bytes — Rust storage adapter expects Uint8Array, not SessionRecord object
390
411
  return Buffer.isBuffer(sess) ? sess : Buffer.from(sess)
391
- } catch {
412
+ } catch (e) {
392
413
  return null
393
414
  }
394
415
  },
@@ -441,8 +462,7 @@ function signalStorage({ creds, keys }, lidMapping) {
441
462
  const key = creds.signedPreKey
442
463
  return {
443
464
  privKey: Buffer.from(key.keyPair.private),
444
- pubKey: Buffer.from(key.keyPair.public),
445
- signature: key.signature ? Buffer.from(key.signature) : undefined
465
+ pubKey: Buffer.from(key.keyPair.public)
446
466
  }
447
467
  },
448
468
  loadSenderKey: async senderKeyName => {