kage-baileys 25.4.8 → 25.4.13

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 (230) hide show
  1. package/LICENSE +10 -2
  2. package/README.md +12 -3
  3. package/VALIDATION-REPORT-25.4.10.md +34 -0
  4. package/lib/Socket/messages-recv.d.ts +1 -0
  5. package/lib/Socket/messages-recv.js +76 -65
  6. package/lib/Socket/messages-send.d.ts +1 -0
  7. package/lib/Socket/messages-send.js +8 -1
  8. package/lib/Socket/socket.d.ts +1 -0
  9. package/lib/Socket/socket.js +39 -12
  10. package/lib/Utils/native-flow.js +21 -1
  11. package/lib/Utils/pairing-code.js +13 -0
  12. package/package.json +8 -18
  13. package/scripts/verify-package.mjs +1 -1
  14. package/scripts/verify-pairing-flow.mjs +39 -0
  15. package/lib/Defaults/index.d.ts.map +0 -1
  16. package/lib/Defaults/index.js.map +0 -1
  17. package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
  18. package/lib/Signal/Group/ciphertext-message.js.map +0 -1
  19. package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
  20. package/lib/Signal/Group/group-session-builder.js.map +0 -1
  21. package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
  22. package/lib/Signal/Group/group_cipher.js.map +0 -1
  23. package/lib/Signal/Group/index.d.ts.map +0 -1
  24. package/lib/Signal/Group/index.js.map +0 -1
  25. package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
  26. package/lib/Signal/Group/keyhelper.js.map +0 -1
  27. package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
  28. package/lib/Signal/Group/sender-chain-key.js.map +0 -1
  29. package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
  30. package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
  31. package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
  32. package/lib/Signal/Group/sender-key-message.js.map +0 -1
  33. package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
  34. package/lib/Signal/Group/sender-key-name.js.map +0 -1
  35. package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
  36. package/lib/Signal/Group/sender-key-record.js.map +0 -1
  37. package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
  38. package/lib/Signal/Group/sender-key-state.js.map +0 -1
  39. package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
  40. package/lib/Signal/Group/sender-message-key.js.map +0 -1
  41. package/lib/Signal/libsignal.d.ts.map +0 -1
  42. package/lib/Signal/libsignal.js.map +0 -1
  43. package/lib/Signal/lid-mapping.d.ts.map +0 -1
  44. package/lib/Signal/lid-mapping.js.map +0 -1
  45. package/lib/Socket/Client/index.d.ts.map +0 -1
  46. package/lib/Socket/Client/index.js.map +0 -1
  47. package/lib/Socket/Client/types.d.ts.map +0 -1
  48. package/lib/Socket/Client/types.js.map +0 -1
  49. package/lib/Socket/Client/websocket.d.ts.map +0 -1
  50. package/lib/Socket/Client/websocket.js.map +0 -1
  51. package/lib/Socket/business.d.ts.map +0 -1
  52. package/lib/Socket/business.js.map +0 -1
  53. package/lib/Socket/chats.d.ts.map +0 -1
  54. package/lib/Socket/chats.js.map +0 -1
  55. package/lib/Socket/communities.d.ts.map +0 -1
  56. package/lib/Socket/communities.js.map +0 -1
  57. package/lib/Socket/groups.d.ts.map +0 -1
  58. package/lib/Socket/groups.js.map +0 -1
  59. package/lib/Socket/index.d.ts.map +0 -1
  60. package/lib/Socket/index.js.map +0 -1
  61. package/lib/Socket/messages-recv.d.ts.map +0 -1
  62. package/lib/Socket/messages-recv.js.map +0 -1
  63. package/lib/Socket/messages-send.d.ts.map +0 -1
  64. package/lib/Socket/messages-send.js.map +0 -1
  65. package/lib/Socket/mex.d.ts.map +0 -1
  66. package/lib/Socket/mex.js.map +0 -1
  67. package/lib/Socket/newsletter.d.ts.map +0 -1
  68. package/lib/Socket/newsletter.js.map +0 -1
  69. package/lib/Socket/socket.d.ts.map +0 -1
  70. package/lib/Socket/socket.js.map +0 -1
  71. package/lib/Types/Auth.d.ts.map +0 -1
  72. package/lib/Types/Auth.js.map +0 -1
  73. package/lib/Types/Bussines.d.ts.map +0 -1
  74. package/lib/Types/Bussines.js.map +0 -1
  75. package/lib/Types/Call.d.ts.map +0 -1
  76. package/lib/Types/Call.js.map +0 -1
  77. package/lib/Types/Chat.d.ts.map +0 -1
  78. package/lib/Types/Chat.js.map +0 -1
  79. package/lib/Types/Contact.d.ts.map +0 -1
  80. package/lib/Types/Contact.js.map +0 -1
  81. package/lib/Types/Events.d.ts.map +0 -1
  82. package/lib/Types/Events.js.map +0 -1
  83. package/lib/Types/GroupMetadata.d.ts.map +0 -1
  84. package/lib/Types/GroupMetadata.js.map +0 -1
  85. package/lib/Types/Label.d.ts.map +0 -1
  86. package/lib/Types/Label.js.map +0 -1
  87. package/lib/Types/LabelAssociation.d.ts.map +0 -1
  88. package/lib/Types/LabelAssociation.js.map +0 -1
  89. package/lib/Types/Message.d.ts.map +0 -1
  90. package/lib/Types/Message.js.map +0 -1
  91. package/lib/Types/Mex.d.ts.map +0 -1
  92. package/lib/Types/Mex.js.map +0 -1
  93. package/lib/Types/Product.d.ts.map +0 -1
  94. package/lib/Types/Product.js.map +0 -1
  95. package/lib/Types/Signal.d.ts.map +0 -1
  96. package/lib/Types/Signal.js.map +0 -1
  97. package/lib/Types/Socket.d.ts.map +0 -1
  98. package/lib/Types/Socket.js.map +0 -1
  99. package/lib/Types/State.d.ts.map +0 -1
  100. package/lib/Types/State.js.map +0 -1
  101. package/lib/Types/USync.d.ts.map +0 -1
  102. package/lib/Types/USync.js.map +0 -1
  103. package/lib/Types/index.d.ts.map +0 -1
  104. package/lib/Types/index.js.map +0 -1
  105. package/lib/Utils/auth-utils.d.ts.map +0 -1
  106. package/lib/Utils/auth-utils.js.map +0 -1
  107. package/lib/Utils/browser-utils.d.ts.map +0 -1
  108. package/lib/Utils/browser-utils.js.map +0 -1
  109. package/lib/Utils/business.d.ts.map +0 -1
  110. package/lib/Utils/business.js.map +0 -1
  111. package/lib/Utils/chat-utils.d.ts.map +0 -1
  112. package/lib/Utils/chat-utils.js.map +0 -1
  113. package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
  114. package/lib/Utils/companion-reg-client-utils.js.map +0 -1
  115. package/lib/Utils/crypto.d.ts.map +0 -1
  116. package/lib/Utils/crypto.js.map +0 -1
  117. package/lib/Utils/decode-wa-message.d.ts.map +0 -1
  118. package/lib/Utils/decode-wa-message.js.map +0 -1
  119. package/lib/Utils/decrypt-message-edit.d.ts.map +0 -1
  120. package/lib/Utils/event-buffer.d.ts.map +0 -1
  121. package/lib/Utils/event-buffer.js.map +0 -1
  122. package/lib/Utils/generics.d.ts.map +0 -1
  123. package/lib/Utils/generics.js.map +0 -1
  124. package/lib/Utils/history.d.ts.map +0 -1
  125. package/lib/Utils/history.js.map +0 -1
  126. package/lib/Utils/identity-change-handler.d.ts.map +0 -1
  127. package/lib/Utils/identity-change-handler.js.map +0 -1
  128. package/lib/Utils/index.d.ts.map +0 -1
  129. package/lib/Utils/index.js.map +0 -1
  130. package/lib/Utils/link-preview.d.ts.map +0 -1
  131. package/lib/Utils/link-preview.js.map +0 -1
  132. package/lib/Utils/logger.d.ts.map +0 -1
  133. package/lib/Utils/logger.js.map +0 -1
  134. package/lib/Utils/lt-hash.d.ts.map +0 -1
  135. package/lib/Utils/lt-hash.js.map +0 -1
  136. package/lib/Utils/make-mutex.d.ts.map +0 -1
  137. package/lib/Utils/make-mutex.js.map +0 -1
  138. package/lib/Utils/message-retry-manager.d.ts.map +0 -1
  139. package/lib/Utils/message-retry-manager.js.map +0 -1
  140. package/lib/Utils/messages-media.d.ts.map +0 -1
  141. package/lib/Utils/messages-media.js.map +0 -1
  142. package/lib/Utils/messages.d.ts.map +0 -1
  143. package/lib/Utils/messages.js.map +0 -1
  144. package/lib/Utils/noise-handler.d.ts.map +0 -1
  145. package/lib/Utils/noise-handler.js.map +0 -1
  146. package/lib/Utils/offline-node-processor.d.ts.map +0 -1
  147. package/lib/Utils/offline-node-processor.js.map +0 -1
  148. package/lib/Utils/pre-key-manager.d.ts.map +0 -1
  149. package/lib/Utils/pre-key-manager.js.map +0 -1
  150. package/lib/Utils/process-message.d.ts.map +0 -1
  151. package/lib/Utils/process-message.js.map +0 -1
  152. package/lib/Utils/reporting-utils.d.ts.map +0 -1
  153. package/lib/Utils/reporting-utils.js.map +0 -1
  154. package/lib/Utils/signal.d.ts.map +0 -1
  155. package/lib/Utils/signal.js.map +0 -1
  156. package/lib/Utils/stanza-ack.d.ts.map +0 -1
  157. package/lib/Utils/stanza-ack.js.map +0 -1
  158. package/lib/Utils/sync-action-utils.d.ts.map +0 -1
  159. package/lib/Utils/sync-action-utils.js.map +0 -1
  160. package/lib/Utils/tc-token-utils.d.ts.map +0 -1
  161. package/lib/Utils/tc-token-utils.js.map +0 -1
  162. package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
  163. package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
  164. package/lib/Utils/validate-connection.d.ts.map +0 -1
  165. package/lib/Utils/validate-connection.js.map +0 -1
  166. package/lib/WABinary/constants.d.ts.map +0 -1
  167. package/lib/WABinary/constants.js.map +0 -1
  168. package/lib/WABinary/decode.d.ts.map +0 -1
  169. package/lib/WABinary/decode.js.map +0 -1
  170. package/lib/WABinary/encode.d.ts.map +0 -1
  171. package/lib/WABinary/encode.js.map +0 -1
  172. package/lib/WABinary/generic-utils.d.ts.map +0 -1
  173. package/lib/WABinary/generic-utils.js.map +0 -1
  174. package/lib/WABinary/index.d.ts.map +0 -1
  175. package/lib/WABinary/index.js.map +0 -1
  176. package/lib/WABinary/jid-utils.d.ts.map +0 -1
  177. package/lib/WABinary/jid-utils.js.map +0 -1
  178. package/lib/WABinary/types.d.ts.map +0 -1
  179. package/lib/WABinary/types.js.map +0 -1
  180. package/lib/WAM/BinaryInfo.d.ts.map +0 -1
  181. package/lib/WAM/BinaryInfo.js.map +0 -1
  182. package/lib/WAM/constants.d.ts.map +0 -1
  183. package/lib/WAM/constants.js.map +0 -1
  184. package/lib/WAM/encode.d.ts.map +0 -1
  185. package/lib/WAM/encode.js.map +0 -1
  186. package/lib/WAM/index.d.ts.map +0 -1
  187. package/lib/WAM/index.js.map +0 -1
  188. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
  189. package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
  190. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
  191. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
  192. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
  193. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
  194. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
  195. package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
  196. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +0 -1
  197. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +0 -1
  198. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
  199. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
  200. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
  201. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
  202. package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
  203. package/lib/WAUSync/Protocols/index.js.map +0 -1
  204. package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
  205. package/lib/WAUSync/USyncQuery.js.map +0 -1
  206. package/lib/WAUSync/USyncUser.d.ts.map +0 -1
  207. package/lib/WAUSync/USyncUser.js.map +0 -1
  208. package/lib/WAUSync/index.d.ts.map +0 -1
  209. package/lib/WAUSync/index.js.map +0 -1
  210. package/lib/index.d.ts.map +0 -1
  211. package/lib/index.js.map +0 -1
  212. package/licenses/dnuzi-MIT.txt +0 -21
  213. package/licenses/elaina-native-flow-MIT.txt +0 -22
  214. package/licenses/itsliaaa-MIT.txt +0 -22
  215. package/licenses/kage-antigua-MIT.txt +0 -21
  216. package/licenses/rexxhayanasi-MIT.txt +0 -22
  217. package/licenses/upstream-MIT.txt +0 -21
  218. package/licenses/whiskeysockets-MIT.txt +0 -21
  219. package/test/cross-fork-helpers.test.js +0 -54
  220. package/test/get-biz-binary-node.test.js +0 -37
  221. package/test/media-message-guards.test.js +0 -79
  222. package/test/native-flow-payment.test.js +0 -299
  223. package/test/newsletter-utils.test.js +0 -58
  224. package/test/offline-node-processor.test.js +0 -59
  225. package/test/pairing-code.test.mjs +0 -104
  226. package/test/pairing-registration-reference.test.js +0 -20
  227. package/test/proto-runtime.test.js +0 -35
  228. package/test/proto-schema.test.js +0 -28
  229. package/test/rate-limit-handling.test.mjs +0 -44
  230. package/test/sqlite-adapter.test.js +0 -87
package/LICENSE CHANGED
@@ -1,6 +1,14 @@
1
- MIT License
1
+ KAGE BAILEYS — MIT LICENSE
2
2
 
3
- Copyright (c) 2025 Rajeh Taher/WhiskeySockets
3
+ Copyright (c) 2025-2026 Kage Baileys
4
+
5
+ Third-party MIT components and compatibility portions included in this distribution
6
+ retain the following original copyright attributions:
7
+ - Copyright (c) 2025 Rajeh Taher / WhiskeySockets
8
+ - Copyright (c) 2026 Lia Wynn (itsliaaa/baileys)
9
+ - Copyright (c) 2026 DanuZz Lk (dnuzi/baileys)
10
+ - Copyright (c) 2026 rexxhayanasi (Elaina Baileys)
11
+ - Copyright (c) 2025-2026 Kage Baileys (Kage Antigua)
4
12
 
5
13
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
14
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -2208,7 +2208,7 @@ Los mantenedores de kage-baileys no respaldan el uso de esta librería para viol
2208
2208
 
2209
2209
  Distribuido bajo la **Licencia GPL-3.0**. Consulta [LICENSE](LICENSE) para más información.
2210
2210
 
2211
- La identidad del paquete es **Kage Baileys**. Los avisos de licencia se conservan en `LICENSE` y `licenses/`. La redistribución debe respetar las condiciones de la licencia MIT.
2211
+ La identidad del paquete es **Kage Baileys**. Se distribuye un único archivo raíz `LICENSE`, que consolida la licencia MIT de Kage y las atribuciones de copyright de los fragmentos compatibles de terceros. La redistribución debe respetar sus condiciones.
2212
2212
 
2213
2213
  ### Seguridad de dependencias
2214
2214
 
@@ -2319,6 +2319,15 @@ Use `getMediaDownloadStatus(message)` to inspect ordinary media availability. It
2319
2319
  The root package and `./Utils/*` subpaths now expose additional auth-state adapters (MongoDB, MySQL, PostgreSQL, Redis, SQLite, single-file and NekoDB), TTL cache, sender-key memory helpers, group metadata validation, username validation, modern message constructors, status sticker builders, social link preview helpers, HTML-app validation/multiplayer helpers, scheduled-message helpers and newsletter status helpers. Database drivers are optional peer dependencies and must be installed only when the relevant adapter is used.
2320
2320
 
2321
2321
 
2322
- ## Integrated validation suite
2322
+ ## Kage 25.4.10: pairing and Native Flow
2323
+
2324
+ When `requestPairingCode(phoneNumber)` is called without a custom code, Kage generates `KAGE` followed by four cryptographically random digits. The actual eight-character token has no space (for example `KAGE1234`); display it as `KAGE 1234` only for readability. Kage waits for WhatsApp's `companion_hello` IQ result and returns the token only after a server-issued `link_code_pairing_ref` is received. A `rate-overlimit` response is a server-side 429 and cannot be bypassed by changing the code format; Kage does not retry automatically.
2325
+
2326
+ For `review_and_pay`, `relayMessage()` adds the `biz` node with `native_flow_name="order_details"`, merges compatible custom `biz` nodes, and supplies `messageParamsJson` / `messageVersion` when missing. Before sending, it validates the payment JSON and JPEG thumbnail. `total_amount` must equal item subtotal plus tax and shipping minus discount. Kage never silently changes a payment amount. Replace or remove placeholder payment identifiers such as `[ACCOUNT_NUMBER]`.
2327
+
2328
+ The Native Flow helper constructs a payment-request message only. It does not process or verify transactions. WhatsApp's current Help Center lists registered-business payments in India, Brazil, Mexico and Indonesia; outside those countries, its in-app business-payment feature is not available. Use a legitimate hosted payment link for other regions. See [WhatsApp Help Center: participating countries](https://faq.whatsapp.com/1293279751500598/?locale=es_LA).
2329
+
2330
+ ## Package validation
2331
+
2332
+ The `test/` source folder and source maps are intentionally excluded from this clean distribution build. `npm test` runs focused pairing/reconnect and Native Flow assertions. `npm run check` validates syntax, imports, exports, WAProto, and the focused assertions. See `VALIDATION-REPORT-25.4.10.md`.
2323
2333
 
2324
- Run `npm install` before the full suite. `npm test` executes every Kage test, including the Native Flow and protobuf runtime tests that require declared runtime dependencies. `npm run test:offline` executes the isolated offline suite that does not need those external packages. Pairing request construction is tested in `test/pairing-code.test.mjs`, including the single-byte NUL nonce and extraction of the server-issued pairing reference.
@@ -0,0 +1,34 @@
1
+ # Kage Baileys 25.4.10 — Validation report
2
+
3
+ ## Pairing / 428 repair
4
+
5
+ - The primary-hello handler now awaits `companion_finish` before notification ACK, matching the working Kage Antigua flow.
6
+ - `creds.registered` is persisted only after the `companion_finish` IQ has been accepted by WhatsApp.
7
+ - Temporary pairing code, reference, timestamp, and ephemeral key material are cleared after completion.
8
+ - `pair-success` merges the verified account/device identity into the live credentials and enforces `registered: true`.
9
+ - A WebSocket closure immediately after completed pairing is identified as `restartRequired` (515), so the client starts a normal login with saved credentials instead of repeating registration. The raw WebSocket close code and reason are preserved for diagnosis.
10
+ - A close before WhatsApp accepts pairing remains an ordinary connection-close (428); Kage does not bypass server restrictions or rate limits.
11
+
12
+ ## Native Flow / review_and_pay
13
+
14
+ - `relayMessage()` attaches the Native Flow `biz` node.
15
+ - `review_and_pay` maps to `native_flow_name: order_details`.
16
+ - The package validates the JSON, JPEG thumbnail bytes, payment-account identifiers, and consistency between `total_amount` and order items.
17
+ - The supplied example's 137 / 138 mismatch and placeholder account IDs are rejected with actionable errors; no payment values are silently changed.
18
+
19
+ ## Licences
20
+
21
+ - Only one root `LICENSE` file is distributed. It is branded Kage Baileys and consolidates the required upstream MIT copyright notices into the same file. The separate `licenses/` directory and `THIRD_PARTY_NOTICES.md` were removed.
22
+
23
+ ## Checks
24
+
25
+ - `npm run check`: package syntax/import/export and WAProto validation plus targeted flow checks.
26
+ - Targeted static assertions: 11/11.
27
+ - WAProto: 788 messages, 223 enums, 3,660 fields.
28
+ - `npm pack --dry-run`: package file list checked.
29
+
30
+ ## Limits
31
+
32
+ - No live WhatsApp account was linked in this environment. A server-side 428 before `primary_hello` completion can still be caused by an unsupported browser identity, stale protocol version, or temporary WhatsApp-side restriction.
33
+ - Recent upstream reports show Desktop browser tuples can be rejected with 428 while a Chrome browser tuple succeeds; Mahiru's configured `Browsers.macOS('Chrome')` is not the rejected `Desktop` tuple. Some new-device 428 cases continued even with a fresh protocol version and may be server-side restrictions.
34
+ - The `review_and_pay` structure is validated; WhatsApp client rendering and payment availability depend on supported region, account type and provider.
@@ -186,6 +186,7 @@ export declare const makeMessagesRecvSocket: (config: SocketConfig) => {
186
186
  uploadPreKeysToServerIfRequired: () => Promise<void>;
187
187
  digestKeyBundle: () => Promise<void>;
188
188
  rotateSignedPreKey: () => Promise<void>;
189
+ /** Returns a server-confirmed pairing code; when customPairingCode is omitted, Kage uses KAGE plus four random digits (no space). */
189
190
  requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
190
191
  /** Cancel the active pairing-code request and restore the previous temporary auth fields. */
191
192
  cancelPairingCode: () => boolean;
@@ -797,89 +797,100 @@ export const makeMessagesRecvSocket = (config) => {
797
797
  }
798
798
  });
799
799
  };
800
- // Pairing-code notifications are ACKed by handleNotification after this
801
- // function returns. Start companion_finish in the background so the ACK is
802
- // sent immediately, matching the current WhatsApp Web sequence.
800
+ // Match Kage Antigua's confirmed link-code sequence: complete companion_finish
801
+ // before ACKing primary_hello, then persist registered=true. Without this flag,
802
+ // a reconnect can incorrectly send a fresh registration payload and loop on 428.
803
803
  let pairingPrimaryHelloAttempts = 0;
804
804
  let pairingFinishInFlight = false;
805
- const processPairingPrimaryHello = (linkCodeCompanionReg) => {
805
+ const processPairingPrimaryHello = async (linkCodeCompanionReg) => {
806
806
  const creds = authState.creds;
807
+ if (creds.registered) {
808
+ logger.debug('ignored duplicate primary_hello: account is already registered');
809
+ return false;
810
+ }
807
811
  const receivedRefValue = getBinaryNodeChildBuffer(linkCodeCompanionReg, 'link_code_pairing_ref');
808
812
  if (!isValidPairingRef(creds, receivedRefValue)) {
809
813
  logger.warn('ignored primary_hello: pairing code missing, expired, or server reference does not match');
810
- return;
814
+ return false;
811
815
  }
812
816
  const expectedRef = Buffer.from(creds.pairingCodeRef);
813
817
  if (pairingFinishInFlight) {
814
818
  logger.debug('ignored duplicate primary_hello while companion_finish is in flight');
815
- return;
819
+ return false;
816
820
  }
817
821
  if (pairingPrimaryHelloAttempts >= 3) {
818
822
  logger.warn('ignored primary_hello after the three-attempt pairing limit');
819
- return;
823
+ return false;
820
824
  }
821
825
  pairingPrimaryHelloAttempts += 1;
822
826
  pairingFinishInFlight = true;
823
827
 
824
- void (async () => {
825
- try {
826
- const primaryIdentityPublicKey = toRequiredBuffer(getBinaryNodeChildBuffer(linkCodeCompanionReg, 'primary_identity_pub'));
827
- const primaryEphemeralPublicKeyWrapped = toRequiredBuffer(getBinaryNodeChildBuffer(linkCodeCompanionReg, 'link_code_pairing_wrapped_primary_ephemeral_pub'));
828
- if (primaryEphemeralPublicKeyWrapped.length !== 80) {
829
- throw new Boom('Invalid wrapped primary ephemeral public key length.', { statusCode: 400 });
830
- }
831
- const codePairingPublicKey = await decipherLinkPublicKey(primaryEphemeralPublicKeyWrapped);
832
- const companionSharedKey = Curve.sharedKey(creds.pairingEphemeralKeyPair.private, codePairingPublicKey);
833
- const random = randomBytes(32);
834
- const linkCodeSalt = randomBytes(32);
835
- const linkCodePairingExpanded = hkdf(companionSharedKey, 32, {
836
- salt: linkCodeSalt,
837
- info: 'link_code_pairing_key_bundle_encryption_key'
838
- });
839
- const encryptPayload = Buffer.concat([
840
- Buffer.from(creds.signedIdentityKey.public),
841
- primaryIdentityPublicKey,
842
- random
843
- ]);
844
- const encryptIv = randomBytes(12);
845
- const encrypted = aesEncryptGCM(encryptPayload, linkCodePairingExpanded, encryptIv, Buffer.alloc(0));
846
- const encryptedPayload = Buffer.concat([linkCodeSalt, encryptIv, encrypted]);
847
- const identitySharedKey = Curve.sharedKey(creds.signedIdentityKey.private, primaryIdentityPublicKey);
848
- const identityPayload = Buffer.concat([companionSharedKey, identitySharedKey, random]);
849
- creds.advSecretKey = Buffer.from(hkdf(identityPayload, 32, { info: 'adv_secret' })).toString('base64');
850
- // Use the ref returned by companion_hello, never a ref echoed by
851
- // the phone notification. A successful IQ alone does not mark
852
- // the account registered; pair-success performs that transition.
853
- await query({
854
- tag: 'iq',
855
- attrs: {
856
- to: S_WHATSAPP_NET,
857
- type: 'set',
858
- id: sock.generateMessageTag(),
859
- xmlns: 'md'
860
- },
861
- content: [
862
- {
863
- tag: 'link_code_companion_reg',
864
- attrs: { jid: creds.me.id, stage: 'companion_finish' },
865
- content: [
866
- { tag: 'link_code_pairing_wrapped_key_bundle', attrs: {}, content: encryptedPayload },
867
- { tag: 'companion_identity_public', attrs: {}, content: creds.signedIdentityKey.public },
868
- { tag: 'link_code_pairing_ref', attrs: {}, content: expectedRef }
869
- ]
870
- }
871
- ]
872
- });
873
- ev.emit('creds.update', creds);
874
- logger.info({ attempt: pairingPrimaryHelloAttempts }, 'companion_finish accepted; awaiting pair-success');
875
- }
876
- catch (error) {
877
- logger.error({ error }, 'failed to complete pairing-code companion_finish');
828
+ try {
829
+ const primaryIdentityPublicKey = toRequiredBuffer(getBinaryNodeChildBuffer(linkCodeCompanionReg, 'primary_identity_pub'));
830
+ const primaryEphemeralPublicKeyWrapped = toRequiredBuffer(getBinaryNodeChildBuffer(linkCodeCompanionReg, 'link_code_pairing_wrapped_primary_ephemeral_pub'));
831
+ if (primaryEphemeralPublicKeyWrapped.length !== 80) {
832
+ throw new Boom('Invalid wrapped primary ephemeral public key length.', { statusCode: 400 });
878
833
  }
879
- finally {
880
- pairingFinishInFlight = false;
834
+ const codePairingPublicKey = await decipherLinkPublicKey(primaryEphemeralPublicKeyWrapped);
835
+ const companionSharedKey = Curve.sharedKey(creds.pairingEphemeralKeyPair.private, codePairingPublicKey);
836
+ const random = randomBytes(32);
837
+ const linkCodeSalt = randomBytes(32);
838
+ const linkCodePairingExpanded = hkdf(companionSharedKey, 32, {
839
+ salt: linkCodeSalt,
840
+ info: 'link_code_pairing_key_bundle_encryption_key'
841
+ });
842
+ const encryptPayload = Buffer.concat([
843
+ Buffer.from(creds.signedIdentityKey.public),
844
+ primaryIdentityPublicKey,
845
+ random
846
+ ]);
847
+ const encryptIv = randomBytes(12);
848
+ const encrypted = aesEncryptGCM(encryptPayload, linkCodePairingExpanded, encryptIv, Buffer.alloc(0));
849
+ const encryptedPayload = Buffer.concat([linkCodeSalt, encryptIv, encrypted]);
850
+ const identitySharedKey = Curve.sharedKey(creds.signedIdentityKey.private, primaryIdentityPublicKey);
851
+ const identityPayload = Buffer.concat([companionSharedKey, identitySharedKey, random]);
852
+ creds.advSecretKey = Buffer.from(hkdf(identityPayload, 32, { info: 'adv_secret' })).toString('base64');
853
+
854
+ // The server-issued companion_hello reference is authoritative.
855
+ await query({
856
+ tag: 'iq',
857
+ attrs: {
858
+ to: S_WHATSAPP_NET,
859
+ type: 'set',
860
+ id: sock.generateMessageTag(),
861
+ xmlns: 'md'
862
+ },
863
+ content: [
864
+ {
865
+ tag: 'link_code_companion_reg',
866
+ attrs: { jid: creds.me.id, stage: 'companion_finish' },
867
+ content: [
868
+ { tag: 'link_code_pairing_wrapped_key_bundle', attrs: {}, content: encryptedPayload },
869
+ { tag: 'companion_identity_public', attrs: {}, content: creds.signedIdentityKey.public },
870
+ { tag: 'link_code_pairing_ref', attrs: {}, content: expectedRef }
871
+ ]
872
+ }
873
+ ]
874
+ });
875
+
876
+ // Kage Antigua sets this only after the server accepts companion_finish.
877
+ // Persisting it makes the next socket use generateLoginNode(), not
878
+ // generateRegistrationNode(), after WhatsApp restarts the transport.
879
+ creds.registered = true;
880
+ for (const key of ['pairingCode', 'pairingCodeRef', 'pairingCodeGeneratedAt', 'pairingEphemeralKeyPair']) {
881
+ delete creds[key];
881
882
  }
882
- })();
883
+ ev.emit('creds.update', creds);
884
+ logger.info({ attempt: pairingPrimaryHelloAttempts }, 'companion_finish accepted; credentials marked registered for reconnect');
885
+ return true;
886
+ }
887
+ catch (error) {
888
+ logger.error({ error }, 'failed to complete pairing-code companion_finish');
889
+ throw error;
890
+ }
891
+ finally {
892
+ pairingFinishInFlight = false;
893
+ }
883
894
  };
884
895
 
885
896
  const processNotification = async (node) => {
@@ -972,7 +983,7 @@ export const makeMessagesRecvSocket = (config) => {
972
983
  // companion_hello responses are IQ results, not notifications.
973
984
  // Only primary_hello starts the companion_finish crypto exchange.
974
985
  if (linkCodeCompanionReg?.attrs?.stage === 'primary_hello') {
975
- processPairingPrimaryHello(linkCodeCompanionReg);
986
+ await processPairingPrimaryHello(linkCodeCompanionReg);
976
987
  }
977
988
  else {
978
989
  logger.debug({ stage: linkCodeCompanionReg?.attrs?.stage }, 'ignored non-primary pairing notification');
@@ -183,6 +183,7 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
183
183
  uploadPreKeysToServerIfRequired: () => Promise<void>;
184
184
  digestKeyBundle: () => Promise<void>;
185
185
  rotateSignedPreKey: () => Promise<void>;
186
+ /** Returns a server-confirmed pairing code; when customPairingCode is omitted, Kage uses KAGE plus four random digits (no space). */
186
187
  requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
187
188
  /** Cancel the active pairing-code request and restore the previous temporary auth fields. */
188
189
  cancelPairingCode: () => boolean;
@@ -5,6 +5,7 @@ import { DEFAULT_CACHE_TTLS, WA_DEFAULT_EPHEMERAL } from '../Defaults/index.js';
5
5
  import { aggregateMessageKeysNotFromMe, assertMediaContent, assertMeId, bindWaitForEvent, decryptMediaRetryData, DEF_MEDIA_HOST, encodeNewsletterMessage, encodeSignedDeviceIdentity, encodeWAMessage, encryptMediaRetryRequest, extractDeviceJids, generateMessageIDV2, generateParticipantHashV2, generateWAMessage, getStatusCodeForMediaRetry, getUrlFromDirectPath, getWAUploadToServer, MessageRetryManager, normalizeMessageContent, parseAndInjectE2ESessions, unixTimestampSeconds } from '../Utils/index.js';
6
6
  import { getUrlInfo } from '../Utils/link-preview.js';
7
7
  import { prepareNativeFlowMessageForRelay } from '../Utils/native-flow.js';
8
+ import interactiveCompat from '../Utils/interactive-compat.cjs';
8
9
  import { makeKeyedMutex, makeMutex } from '../Utils/make-mutex.js';
9
10
  import { getMessageReportingToken, shouldIncludeReportingToken } from '../Utils/reporting-utils.js';
10
11
  import { buildMergedTcTokenIndexWrite, isTcTokenExpired, resolveIssuanceJid, resolveTcTokenJid, shouldSendNewTcToken, storeTcTokensFromIqResult } from '../Utils/tc-token-utils.js';
@@ -877,8 +878,14 @@ export const makeMessagesSocket = (config) => {
877
878
  ...(mergedContent.length ? { content: mergedContent } : {})
878
879
  };
879
880
  }
881
+ // Merge the Kage Antigua compatibility node as a second pass. Its
882
+ // recursive merge preserves explicitly supplied biz children while
883
+ // retaining Kage's canonical order_details mapping for review_and_pay.
884
+ if (relayInteractive && typeof interactiveCompat?.applyKageInteractiveNodes === 'function') {
885
+ interactiveCompat.applyKageInteractiveNodes(stanza, message, additionalNodes);
886
+ }
880
887
  logger.debug({ msgId, flow: relayInteractive?.nativeFlowMessage?.buttons?.[0]?.name },
881
- 'added Native Flow biz companion node');
888
+ 'added and merged Native Flow biz companion node');
882
889
  }
883
890
  logger.debug({ msgId }, `sending message to ${participants.length} devices`);
884
891
  await sendNode(stanza);
@@ -41,6 +41,7 @@ export declare const makeSocket: (config: SocketConfig) => {
41
41
  uploadPreKeysToServerIfRequired: () => Promise<void>;
42
42
  digestKeyBundle: () => Promise<void>;
43
43
  rotateSignedPreKey: () => Promise<void>;
44
+ /** Returns a server-confirmed pairing code; when customPairingCode is omitted, Kage uses KAGE plus four random digits (no space). */
44
45
  requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
45
46
  /** Cancel the active pairing-code request and restore the previous temporary auth fields. */
46
47
  cancelPairingCode: () => boolean;
@@ -6,13 +6,13 @@ import { proto } from '../../WAProto/index.js';
6
6
  import { DEF_CALLBACK_PREFIX, DEF_TAG_PREFIX, INITIAL_PREKEY_COUNT, MIN_PREKEY_COUNT, NOISE_WA_HEADER, PROCESSABLE_HISTORY_TYPES, TimeMs, UPLOAD_TIMEOUT } from '../Defaults/index.js';
7
7
  import { QueryIds, ReachoutTimelockEnforcementType } from '../Types/index.js';
8
8
  import { DisconnectReason, XWAPaths } from '../Types/index.js';
9
- import { addTransactionCapability, aesEncryptCTR, bindWaitForConnectionUpdate, buildPairingQRData, bytesToCrockford, configureSuccessfulPairing, Curve, derivePairingCodeKey, generateLoginNode, generateMdTagPrefix, generateRegistrationNode, getCodeFromWSError, getCompanionPlatformId, getErrorCodeFromStreamError, getNextPreKeysNode, makeEventBuffer, makeNoiseHandler, promiseTimeout, signedKeyPair, xmppSignedPreKey } from '../Utils/index.js';
9
+ import { addTransactionCapability, aesEncryptCTR, bindWaitForConnectionUpdate, buildPairingQRData, configureSuccessfulPairing, Curve, derivePairingCodeKey, generateLoginNode, generateMdTagPrefix, generateRegistrationNode, getCodeFromWSError, getCompanionPlatformId, getErrorCodeFromStreamError, getNextPreKeysNode, makeEventBuffer, makeNoiseHandler, promiseTimeout, signedKeyPair, xmppSignedPreKey } from '../Utils/index.js';
10
10
  import { assertNodeErrorFree, binaryNodeToString, encodeBinaryNode, getAllBinaryNodeChildren, getBinaryNodeChild, getBinaryNodeChildren, isLidUser, jidDecode, jidEncode, S_WHATSAPP_NET } from '../WABinary/index.js';
11
11
  import { BinaryInfo } from '../WAM/BinaryInfo.js';
12
12
  import { USyncQuery, USyncUser } from '../WAUSync/index.js';
13
13
  import { WebSocketClient } from './Client/index.js';
14
14
  import { executeWMexQuery } from './mex.js';
15
- import { DEFAULT_PAIRING_CODE_TTL_MS, PAIRING_CODE_RESPONSE_GRACE_MS, buildPairingCompanionHelloNode, extractPairingReference, normalizePairingPhone } from '../Utils/pairing-code.js';
15
+ import { DEFAULT_PAIRING_CODE_TTL_MS, PAIRING_CODE_RESPONSE_GRACE_MS, buildPairingCompanionHelloNode, extractPairingReference, generateKagePairingCode, normalizePairingPhone } from '../Utils/pairing-code.js';
16
16
  /**
17
17
  * Connects to WA servers and performs:
18
18
  * - simple queries (no retry mechanism, wait for connection establishment)
@@ -286,6 +286,7 @@ export const makeSocket = (config) => {
286
286
  const pairingCodeTimeoutMs = Math.max(30_000, Number(config.pairingCodeTimeoutMs) || DEFAULT_PAIRING_CODE_TTL_MS);
287
287
  const pairingCodeMaxAgeMs = Math.min(pairingCodeTimeoutMs, DEFAULT_PAIRING_CODE_TTL_MS);
288
288
  let pendingPairing;
289
+ let pairingRestartExpected = false;
289
290
  const clearPendingPairing = ({ restore = false } = {}) => {
290
291
  const pending = pendingPairing;
291
292
  if (!pending) return false;
@@ -649,11 +650,14 @@ export const makeSocket = (config) => {
649
650
  } catch (error) {
650
651
  throw new Boom(error.message, { statusCode: error.statusCode || 400, data: { phoneNumber } });
651
652
  }
652
- if (customPairingCode != null && !/^[A-Z0-9]{8}$/i.test(String(customPairingCode))) {
653
- throw new Boom('Custom pairing code must be exactly 8 alphanumeric characters.', { statusCode: 400 });
653
+ const normalizedCustomPairingCode = customPairingCode == null
654
+ ? undefined
655
+ : String(customPairingCode).replace(/\s+/g, '').toUpperCase();
656
+ if (normalizedCustomPairingCode != null && !/^[A-Z0-9]{8}$/.test(normalizedCustomPairingCode)) {
657
+ throw new Boom('Custom pairing code must be exactly 8 alphanumeric characters (spaces are ignored for display formatting).', { statusCode: 400 });
654
658
  }
655
659
 
656
- const pairingCode = customPairingCode ? String(customPairingCode).toUpperCase() : bytesToCrockford(randomBytes(5));
660
+ const pairingCode = normalizedCustomPairingCode ?? generateKagePairingCode();
657
661
  const previous = {
658
662
  me: authState.creds.me,
659
663
  pairingCode: authState.creds.pairingCode,
@@ -788,7 +792,26 @@ export const makeSocket = (config) => {
788
792
  }
789
793
  });
790
794
  ws.on('error', mapWebSocketError(end));
791
- ws.on('close', () => void end(new Boom('Connection Terminated', { statusCode: DisconnectReason.connectionClosed })));
795
+ ws.on('close', (webSocketCode, webSocketReason) => {
796
+ const reasonText = Buffer.isBuffer(webSocketReason)
797
+ ? webSocketReason.toString('utf8').slice(0, 200)
798
+ : String(webSocketReason || '').slice(0, 200);
799
+ const isPairingRestart = pairingRestartExpected
800
+ || Boolean(pendingPairing && authState.creds.registered && authState.creds.me?.id);
801
+ if (isPairingRestart) {
802
+ pairingRestartExpected = false;
803
+ clearPendingPairing();
804
+ void end(new Boom('Pairing completed; WhatsApp closed the setup socket to restart the linked session.', {
805
+ statusCode: DisconnectReason.restartRequired,
806
+ data: { pairingCompleted: true, webSocketCloseCode: Number(webSocketCode), webSocketReason: reasonText }
807
+ }));
808
+ return;
809
+ }
810
+ void end(new Boom('Connection Terminated', {
811
+ statusCode: DisconnectReason.connectionClosed,
812
+ data: { webSocketCloseCode: Number(webSocketCode), webSocketReason: reasonText }
813
+ }));
814
+ });
792
815
  // the server terminated the connection
793
816
  ws.on('CB:xmlstreamend', () => void end(new Boom('Connection Terminated by Server', { statusCode: DisconnectReason.connectionClosed })));
794
817
  // QR gen
@@ -833,14 +856,17 @@ export const makeSocket = (config) => {
833
856
  updateServerTimeOffset(stanza);
834
857
  clearPendingPairing();
835
858
  const { reply, creds: updatedCreds } = configureSuccessfulPairing(stanza, creds);
836
- delete updatedCreds.pairingCode;
837
- delete updatedCreds.pairingCodeRef;
838
- delete updatedCreds.pairingCodeGeneratedAt;
839
- logger.info({ me: updatedCreds.me, platform: updatedCreds.platform }, 'pairing configured successfully, expect to restart the connection...');
840
- ev.emit('creds.update', updatedCreds);
859
+ Object.assign(authState.creds, updatedCreds, { registered: true });
860
+ for (const key of ['pairingCode', 'pairingCodeRef', 'pairingCodeGeneratedAt', 'pairingEphemeralKeyPair']) {
861
+ delete authState.creds[key];
862
+ }
863
+ clearPendingPairing();
864
+ pairingRestartExpected = true;
865
+ logger.info({ me: authState.creds.me, platform: authState.creds.platform }, 'pairing configured successfully; credentials saved and WhatsApp restart expected');
866
+ ev.emit('creds.update', authState.creds);
841
867
  ev.emit('connection.update', { isNewLogin: true, qr: undefined });
842
868
  await sendNode(reply);
843
- void sendUnifiedSession();
869
+ await sendUnifiedSession();
844
870
  }
845
871
  catch (error) {
846
872
  logger.info({ trace: error.stack }, 'error in pairing');
@@ -849,6 +875,7 @@ export const makeSocket = (config) => {
849
875
  });
850
876
  // login complete
851
877
  ws.on('CB:success', async (node) => {
878
+ pairingRestartExpected = false;
852
879
  try {
853
880
  updateServerTimeOffset(node);
854
881
  await uploadPreKeysToServerIfRequired();
@@ -141,7 +141,24 @@ export function prepareNativeFlowMessageForRelay(input) {
141
141
  message = message[key].message;
142
142
  }
143
143
 
144
- const flow = message?.interactiveMessage?.nativeFlowMessage;
144
+ const interactive = message?.interactiveMessage;
145
+ const header = interactive?.header;
146
+ if (header?.jpegThumbnail != null) {
147
+ const thumbnail = header.jpegThumbnail;
148
+ if (!Buffer.isBuffer(thumbnail) && !(thumbnail instanceof Uint8Array)) {
149
+ throw new TypeError('interactiveMessage.header.jpegThumbnail must be a JPEG Buffer or Uint8Array');
150
+ }
151
+ if (thumbnail.length < 4 || thumbnail[0] !== 0xff || thumbnail[1] !== 0xd8) {
152
+ throw new TypeError('interactiveMessage.header.jpegThumbnail is not a valid JPEG byte sequence');
153
+ }
154
+ }
155
+ if (header?.hasMediaAttachment === true && !header.jpegThumbnail &&
156
+ !header.imageMessage && !header.videoMessage && !header.documentMessage &&
157
+ !header.locationMessage && !header.productMessage) {
158
+ throw new TypeError('interactiveMessage.header.hasMediaAttachment is true but no supported media attachment was supplied');
159
+ }
160
+
161
+ const flow = interactive?.nativeFlowMessage;
145
162
  if (!flow) return input;
146
163
  if (!Array.isArray(flow.buttons) || flow.buttons.length === 0) {
147
164
  throw new TypeError('interactiveMessage.nativeFlowMessage.buttons must contain at least one button');
@@ -250,6 +267,9 @@ export function prepareNativeFlowMessageForRelay(input) {
250
267
  if (typeof identifier !== 'string' || !identifier.trim()) {
251
268
  throw new TypeError(`payment_settings[${accountIndex}] requires payment_account.identifier_value`);
252
269
  }
270
+ if (/^\[[^\]]+\]$/.test(identifier.trim())) {
271
+ throw new TypeError(`payment_settings[${accountIndex}] still contains a placeholder identifier (${identifier}); replace it with a valid value or remove that payment account`);
272
+ }
253
273
  if (/^\[[^\]]+\]$/.test(identifier.trim())) {
254
274
  throw new TypeError(`payment_settings[${accountIndex}] still contains a placeholder identifier; remove it or replace it with a valid provider value`);
255
275
  }
@@ -1,4 +1,17 @@
1
+ import { randomInt } from 'node:crypto';
2
+
1
3
  /** Utilities for WhatsApp Web phone-number pairing codes. */
4
+
5
+ /**
6
+ * Generate Kage's preferred 8-character pairing code.
7
+ * The suffix is cryptographically random and the returned value has no space,
8
+ * because the exact 8-character token is what WhatsApp expects.
9
+ * Example display: KAGE 1234; actual token: KAGE1234.
10
+ */
11
+ export function generateKagePairingCode() {
12
+ return `KAGE${String(randomInt(0, 10_000)).padStart(4, '0')}`;
13
+ }
14
+
2
15
  export const DEFAULT_PAIRING_CODE_TTL_MS = 180_000;
3
16
  export const PAIRING_CODE_RESPONSE_GRACE_MS = 30_000;
4
17
 
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "kage-baileys",
3
3
  "type": "module",
4
- "version": "25.4.8",
5
- "description": "Kage Baileys with explicit WhatsApp pairing rate-limit handling, validated pairing-code flow, Native Flow review_and_pay relay fixes, expanded WAProto schema and guarded media diagnostics",
4
+ "version": "25.4.13",
5
+ "description": "Kage Baileys with confirmed pairing registration state, resilient reconnect classification, hardened Native Flow review_and_pay, expanded WAProto schema and compatibility helpers",
6
6
  "keywords": [
7
7
  "whatsapp",
8
8
  "automation"
@@ -12,7 +12,7 @@
12
12
  "url": "git@github.com:xrljosedv/kage-baileys.git"
13
13
  },
14
14
  "license": "MIT",
15
- "author": "Rajeh Taher",
15
+ "author": "Kage Baileys",
16
16
  "main": "lib/index.js",
17
17
  "types": "lib/index.d.ts",
18
18
  "files": [
@@ -21,32 +21,22 @@
21
21
  "engine-requirements.js",
22
22
  "extras/**/*",
23
23
  "helpers/**/*",
24
- "licenses/**/*",
25
24
  "scripts/**/*",
26
- "test/**/*",
27
25
  "README.md",
28
- "REDX-RC15-INTEGRATION.md",
29
- "TEST-REPORT.md",
30
- "VIEWONCE-FIX-REPORT.md",
31
- "PROTO-SCHEMA-FIX-REPORT.md",
32
- "THIRD_PARTY_NOTICES.md",
33
- "PAIRING-CODE-FIX-REPORT.md",
34
- "INTEGRATION-REPORT.md",
35
- "TEST-REPORT-25.4.6.txt"
26
+ "LICENSE",
27
+ "VALIDATION-REPORT-25.4.10.md"
36
28
  ],
37
29
  "scripts": {
38
30
  "build:all": "npm run check",
39
31
  "build": "npm run check",
40
- "check": "node ./scripts/verify-package.mjs",
32
+ "check": "node ./scripts/verify-package.mjs && npm test",
41
33
  "changelog:last": "conventional-changelog -p angular -r 2",
42
34
  "changelog:preview": "conventional-changelog -p angular -u",
43
35
  "changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
44
36
  "gen:protobuf": "sh WAProto/GenerateStatics.sh",
45
- "lint": "npm run check",
37
+ "lint": "node ./scripts/verify-package.mjs",
46
38
  "release": "release-it",
47
- "test": "node --test",
48
- "test:viewonce": "node --test test/media-message-guards.test.js",
49
- "test:offline": "node --test test/cross-fork-helpers.test.js test/media-message-guards.test.js test/newsletter-utils.test.js test/offline-node-processor.test.js test/pairing-code.test.mjs test/rate-limit-handling.test.mjs test/proto-schema.test.js"
39
+ "test": "node ./scripts/verify-pairing-flow.mjs"
50
40
  },
51
41
  "dependencies": {
52
42
  "@adiwajshing/keyed-db": "^0.2.4",
@@ -5,7 +5,7 @@ import { validateProtoSchema } from './verify-proto.mjs';
5
5
  import { fileURLToPath } from 'node:url';
6
6
 
7
7
  const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
8
- const sourceRoots = ['lib', 'WAProto', 'extras', 'helpers', 'scripts', 'test'];
8
+ const sourceRoots = ['lib', 'WAProto', 'extras', 'helpers', 'scripts'];
9
9
  const sourceExtensions = new Set(['.js', '.mjs', '.cjs']);
10
10
  const failures = [];
11
11
  const checked = [];
@@ -0,0 +1,39 @@
1
+ import assert from 'node:assert/strict';
2
+ import { readFileSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
4
+ import path from 'node:path';
5
+
6
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
7
+ const read = file => readFileSync(path.join(root, file), 'utf8');
8
+ const socket = read('lib/Socket/socket.js');
9
+ const recv = read('lib/Socket/messages-recv.js');
10
+ const pairing = read('lib/Utils/pairing-code.js');
11
+ const send = read('lib/Socket/messages-send.js');
12
+ const pay = read('helpers/interactive-pay.js');
13
+
14
+ assert.match(pairing, /return `KAGE\$\{String\(randomInt\(0, 10_000\)\)\.padStart\(4, '0'\)\}`/,
15
+ 'Default pairing token must be KAGE + four cryptographically random digits');
16
+ assert.match(pairing, /Buffer\.from\(\[0\]\)/,
17
+ 'Pairing nonce must be a single NUL byte');
18
+ assert.match(recv, /await query\(\{[\s\S]*?stage: 'companion_finish'[\s\S]*?\}\);[\s\S]*?creds\.registered = true;/,
19
+ 'The registered flag must be written only after companion_finish is accepted');
20
+ assert.match(recv, /await processPairingPrimaryHello\(linkCodeCompanionReg\)/,
21
+ 'primary_hello processing must finish before notification ACK');
22
+ assert.match(recv, /delete creds\[key\]/,
23
+ 'Temporary pairing secrets must be cleared after successful completion');
24
+ assert.match(socket, /Object\.assign\(authState\.creds, updatedCreds, \{ registered: true \}\)/,
25
+ 'pair-success must merge credentials and persist registered=true');
26
+ assert.match(socket, /DisconnectReason\.restartRequired/,
27
+ 'A socket close immediately after completed pairing must be classified as restart-required');
28
+ assert.match(socket, /webSocketCloseCode/,
29
+ 'Raw websocket close diagnostics must be retained');
30
+ assert.match(send, /getBizBinaryNode\(relayContent\)/,
31
+ 'Native Flow relay must attach the biz companion node');
32
+ assert.match(send, /native_flow_name|order_details/,
33
+ 'Native Flow relay must support order_details mapping');
34
+ assert.match(pay, /total_amount must equal the sum of order\.items/,
35
+ 'review_and_pay must reject mismatched total/item values');
36
+ assert.match(pay, /placeholder/,
37
+ 'review_and_pay must reject placeholder payment identifiers');
38
+
39
+ console.log('Pairing / reconnect / review_and_pay checks passed: 11/11.');
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Defaults/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAE9C,OAAO,KAAK,EAAuB,YAAY,EAAa,MAAM,UAAU,CAAA;AAM5E,eAAO,MAAM,kBAAkB,UAAkB,CAAA;AAEjD,eAAO,MAAM,cAAc,6BAA6B,CAAA;AACxD,eAAO,MAAM,iBAAiB,qCAAqC,CAAA;AACnE,eAAO,MAAM,iBAAiB,qCAAqC,CAAA;AACnE,eAAO,MAAM,mBAAmB,QAAQ,CAAA;AACxC,eAAO,MAAM,cAAc,SAAS,CAAA;AACpC,eAAO,MAAM,mBAAmB,YAAY,CAAA;AAE5C,eAAO,MAAM,yBAAyB,qBAAsB,CAAA;AAC5D,eAAO,MAAM,wBAAwB,qBAAsB,CAAA;AAC3D,eAAO,MAAM,gCAAgC,qBAAsB,CAAA;AACnE,eAAO,MAAM,+BAA+B,qBAAsB,CAAA;AAElE,eAAO,MAAM,oBAAoB,QAAmB,CAAA;AAEpD,iEAAiE;AACjE,eAAO,MAAM,qBAAqB,QAAe,CAAA;AAEjD,2EAA2E;AAC3E,eAAO,MAAM,2BAA2B,QAAoB,CAAA;AAE5D,eAAO,MAAM,UAAU,yCAAyC,CAAA;AAChE,eAAO,MAAM,YAAY,IAAI,CAAA;AAC7B,eAAO,MAAM,eAAe,qBAAmB,CAAA;AAC/C,eAAO,MAAM,eAAe,qBAAyC,CAAA;AACrE,yGAAyG;AACzG,eAAO,MAAM,SAAS,QAAwF,CAAA;AAE9G,eA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,MAAM,CAAI;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAI;IAChC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAI;IACnC,QAAQ,CAAC,2BAA2B,EAAE,MAAM,CAAI;IAChD,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAK;CAChD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ciphertext-message.js","sourceRoot":"","sources":["../../../src/Signal/Group/ciphertext-message.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,iBAAiB;IAA9B;QACU,wBAAmB,GAAW,CAAC,CAAA;QAC/B,oBAAe,GAAW,CAAC,CAAA;QAC3B,iBAAY,GAAW,CAAC,CAAA;QACxB,gBAAW,GAAW,CAAC,CAAA;QACvB,mBAAc,GAAW,CAAC,CAAA;QAC1B,gCAA2B,GAAW,CAAC,CAAA;QACvC,+BAA0B,GAAW,EAAE,CAAA;IACjD,CAAC;CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"group-session-builder.d.ts","sourceRoot":"","sources":["../../../src/Signal/Group/group-session-builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAErD,UAAU,cAAc;IACvB,aAAa,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAAA;IACrE,cAAc,CAAC,aAAa,EAAE,aAAa,EAAE,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpF;AAED,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;gBAEnC,cAAc,EAAE,cAAc;IAI7B,OAAO,CACnB,aAAa,EAAE,aAAa,EAC5B,4BAA4B,EAAE,4BAA4B,GACxD,OAAO,CAAC,IAAI,CAAC;IAWH,MAAM,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