kage-baileys 25.4.10 → 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.
- package/LICENSE +10 -2
- package/README.md +3 -3
- package/VALIDATION-REPORT-25.4.10.md +34 -0
- package/lib/Socket/messages-recv.js +76 -65
- package/lib/Socket/socket.js +31 -7
- package/package.json +7 -9
- package/scripts/verify-pairing-flow.mjs +39 -0
- package/licenses/dnuzi-MIT.txt +0 -21
- package/licenses/elaina-native-flow-MIT.txt +0 -22
- package/licenses/itsliaaa-MIT.txt +0 -22
- package/licenses/kage-antigua-MIT.txt +0 -21
- package/licenses/rexxhayanasi-MIT.txt +0 -22
- package/licenses/upstream-MIT.txt +0 -21
- package/licenses/whiskeysockets-MIT.txt +0 -21
package/LICENSE
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
MIT
|
|
1
|
+
KAGE BAILEYS — MIT LICENSE
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
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**.
|
|
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,7 +2319,7 @@ 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
|
-
## Kage 25.4.
|
|
2322
|
+
## Kage 25.4.10: pairing and Native Flow
|
|
2323
2323
|
|
|
2324
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
2325
|
|
|
@@ -2329,5 +2329,5 @@ The Native Flow helper constructs a payment-request message only. It does not pr
|
|
|
2329
2329
|
|
|
2330
2330
|
## Package validation
|
|
2331
2331
|
|
|
2332
|
-
The `test/` source folder and source maps are intentionally excluded from this clean distribution build. `npm test` runs
|
|
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`.
|
|
2333
2333
|
|
|
@@ -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.
|
|
@@ -797,89 +797,100 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
797
797
|
}
|
|
798
798
|
});
|
|
799
799
|
};
|
|
800
|
-
//
|
|
801
|
-
//
|
|
802
|
-
//
|
|
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
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
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
|
-
|
|
880
|
-
|
|
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');
|
package/lib/Socket/socket.js
CHANGED
|
@@ -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;
|
|
@@ -791,7 +792,26 @@ export const makeSocket = (config) => {
|
|
|
791
792
|
}
|
|
792
793
|
});
|
|
793
794
|
ws.on('error', mapWebSocketError(end));
|
|
794
|
-
ws.on('close', () =>
|
|
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
|
+
});
|
|
795
815
|
// the server terminated the connection
|
|
796
816
|
ws.on('CB:xmlstreamend', () => void end(new Boom('Connection Terminated by Server', { statusCode: DisconnectReason.connectionClosed })));
|
|
797
817
|
// QR gen
|
|
@@ -836,14 +856,17 @@ export const makeSocket = (config) => {
|
|
|
836
856
|
updateServerTimeOffset(stanza);
|
|
837
857
|
clearPendingPairing();
|
|
838
858
|
const { reply, creds: updatedCreds } = configureSuccessfulPairing(stanza, creds);
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
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);
|
|
844
867
|
ev.emit('connection.update', { isNewLogin: true, qr: undefined });
|
|
845
868
|
await sendNode(reply);
|
|
846
|
-
|
|
869
|
+
await sendUnifiedSession();
|
|
847
870
|
}
|
|
848
871
|
catch (error) {
|
|
849
872
|
logger.info({ trace: error.stack }, 'error in pairing');
|
|
@@ -852,6 +875,7 @@ export const makeSocket = (config) => {
|
|
|
852
875
|
});
|
|
853
876
|
// login complete
|
|
854
877
|
ws.on('CB:success', async (node) => {
|
|
878
|
+
pairingRestartExpected = false;
|
|
855
879
|
try {
|
|
856
880
|
updateServerTimeOffset(node);
|
|
857
881
|
await uploadPreKeysToServerIfRequired();
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kage-baileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "25.4.
|
|
5
|
-
"description": "Kage Baileys with
|
|
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": "
|
|
15
|
+
"author": "Kage Baileys",
|
|
16
16
|
"main": "lib/index.js",
|
|
17
17
|
"types": "lib/index.d.ts",
|
|
18
18
|
"files": [
|
|
@@ -21,24 +21,22 @@
|
|
|
21
21
|
"engine-requirements.js",
|
|
22
22
|
"extras/**/*",
|
|
23
23
|
"helpers/**/*",
|
|
24
|
-
"licenses/**/*",
|
|
25
24
|
"scripts/**/*",
|
|
26
25
|
"README.md",
|
|
27
26
|
"LICENSE",
|
|
28
|
-
"
|
|
29
|
-
"VALIDATION-REPORT-25.4.9.md"
|
|
27
|
+
"VALIDATION-REPORT-25.4.10.md"
|
|
30
28
|
],
|
|
31
29
|
"scripts": {
|
|
32
30
|
"build:all": "npm run check",
|
|
33
31
|
"build": "npm run check",
|
|
34
|
-
"check": "node ./scripts/verify-package.mjs",
|
|
32
|
+
"check": "node ./scripts/verify-package.mjs && npm test",
|
|
35
33
|
"changelog:last": "conventional-changelog -p angular -r 2",
|
|
36
34
|
"changelog:preview": "conventional-changelog -p angular -u",
|
|
37
35
|
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
38
36
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
39
|
-
"lint": "
|
|
37
|
+
"lint": "node ./scripts/verify-package.mjs",
|
|
40
38
|
"release": "release-it",
|
|
41
|
-
"test": "
|
|
39
|
+
"test": "node ./scripts/verify-pairing-flow.mjs"
|
|
42
40
|
},
|
|
43
41
|
"dependencies": {
|
|
44
42
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
@@ -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.');
|
package/licenses/dnuzi-MIT.txt
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 DanuZz ?
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
|
-
Copyright (c) 2026 rexxhayanasi
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Rajeh Taher/WhiskeySockets
|
|
4
|
-
Copyright (c) 2026 Lia Wynn
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-2026 Kage Baileys
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
|
-
Copyright (c) 2026 rexxhayanasi
|
|
5
|
-
|
|
6
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
-
in the Software without restriction, including without limitation the rights
|
|
9
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
furnished to do so, subject to the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
SOFTWARE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-2026 Kage Baileys
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|