@ostyado/baileys 1.0.7 → 1.0.8
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/README.md +0 -0
- package/WAProto/GenerateStatics.sh +0 -0
- package/WAProto/WAProto.proto +0 -0
- package/WAProto/index.d.ts +0 -0
- package/WAProto/index.js +0 -0
- package/WASignalGroup/GroupProtocol.js +0 -0
- package/WASignalGroup/ciphertext_message.js +0 -0
- package/WASignalGroup/group_cipher.js +0 -0
- package/WASignalGroup/group_session_builder.js +0 -0
- package/WASignalGroup/index.js +0 -0
- package/WASignalGroup/keyhelper.js +0 -0
- package/WASignalGroup/protobufs.js +0 -0
- package/WASignalGroup/queue_job.js +0 -0
- package/WASignalGroup/sender_chain_key.js +0 -0
- package/WASignalGroup/sender_key_distribution_message.js +0 -0
- package/WASignalGroup/sender_key_message.js +0 -0
- package/WASignalGroup/sender_key_name.js +0 -0
- package/WASignalGroup/sender_key_record.js +0 -0
- package/WASignalGroup/sender_key_state.js +0 -0
- package/WASignalGroup/sender_message_key.js +0 -0
- package/lib/Defaults/baileys-version.json +0 -0
- package/lib/Defaults/index.d.ts +0 -0
- package/lib/Defaults/index.js +0 -0
- package/lib/Defaults/phonenumber-mcc.json +0 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -0
- package/lib/Signal/Group/ciphertext-message.js +0 -0
- package/lib/Signal/Group/group-session-builder.d.ts +0 -0
- package/lib/Signal/Group/group-session-builder.js +0 -0
- package/lib/Signal/Group/group_cipher.d.ts +0 -0
- package/lib/Signal/Group/group_cipher.js +0 -0
- package/lib/Signal/Group/index.d.ts +0 -0
- package/lib/Signal/Group/index.js +0 -0
- package/lib/Signal/Group/keyhelper.d.ts +0 -0
- package/lib/Signal/Group/keyhelper.js +0 -0
- package/lib/Signal/Group/queue-job.d.ts +0 -0
- package/lib/Signal/Group/queue-job.js +0 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -0
- package/lib/Signal/Group/sender-chain-key.js +0 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +0 -0
- package/lib/Signal/Group/sender-key-message.d.ts +0 -0
- package/lib/Signal/Group/sender-key-message.js +0 -0
- package/lib/Signal/Group/sender-key-name.d.ts +0 -0
- package/lib/Signal/Group/sender-key-name.js +0 -0
- package/lib/Signal/Group/sender-key-record.d.ts +0 -0
- package/lib/Signal/Group/sender-key-record.js +0 -0
- package/lib/Signal/Group/sender-key-state.d.ts +0 -0
- package/lib/Signal/Group/sender-key-state.js +0 -0
- package/lib/Signal/Group/sender-message-key.d.ts +0 -0
- package/lib/Signal/Group/sender-message-key.js +0 -0
- package/lib/Signal/Group/x +0 -0
- package/lib/Signal/libsignal.d.ts +0 -0
- package/lib/Signal/libsignal.js +0 -0
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -0
- package/lib/Socket/Client/abstract-socket-client.js +0 -0
- package/lib/Socket/Client/index.d.ts +0 -0
- package/lib/Socket/Client/index.js +0 -0
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -0
- package/lib/Socket/Client/mobile-socket-client.js +0 -0
- package/lib/Socket/Client/web-socket-client.d.ts +0 -0
- package/lib/Socket/Client/web-socket-client.js +0 -0
- package/lib/Socket/business.d.ts +0 -0
- package/lib/Socket/business.js +0 -0
- package/lib/Socket/chats.d.ts +0 -0
- package/lib/Socket/chats.js +0 -0
- package/lib/Socket/groups.d.ts +0 -0
- package/lib/Socket/groups.js +0 -0
- package/lib/Socket/index.d.ts +0 -0
- package/lib/Socket/index.js +0 -0
- package/lib/Socket/messages-recv.d.ts +0 -0
- package/lib/Socket/messages-recv.js +0 -0
- package/lib/Socket/messages-send.d.ts +0 -0
- package/lib/Socket/messages-send.js +0 -0
- package/lib/Socket/newsletter.d.ts +0 -0
- package/lib/Socket/newsletter.js +0 -0
- package/lib/Socket/registration.d.ts +0 -0
- package/lib/Socket/registration.js +0 -0
- package/lib/Socket/socket.d.ts +0 -0
- package/lib/Socket/socket.js +30 -65
- package/lib/Socket/usync.d.ts +0 -0
- package/lib/Socket/usync.js +0 -0
- package/lib/Store/index.d.ts +0 -0
- package/lib/Store/index.js +0 -0
- package/lib/Store/make-cache-manager-store.d.ts +0 -0
- package/lib/Store/make-cache-manager-store.js +0 -0
- package/lib/Store/make-in-memory-store.d.ts +0 -0
- package/lib/Store/make-in-memory-store.js +0 -0
- package/lib/Store/make-ordered-dictionary.d.ts +0 -0
- package/lib/Store/make-ordered-dictionary.js +0 -0
- package/lib/Store/object-repository.d.ts +0 -0
- package/lib/Store/object-repository.js +0 -0
- package/lib/Types/Auth.d.ts +0 -0
- package/lib/Types/Auth.js +0 -0
- package/lib/Types/Call.d.ts +0 -0
- package/lib/Types/Call.js +0 -0
- package/lib/Types/Chat.d.ts +0 -0
- package/lib/Types/Chat.js +0 -0
- package/lib/Types/Contact.d.ts +0 -0
- package/lib/Types/Contact.js +0 -0
- package/lib/Types/Events.d.ts +0 -0
- package/lib/Types/Events.js +0 -0
- package/lib/Types/GroupMetadata.d.ts +0 -0
- package/lib/Types/GroupMetadata.js +0 -0
- package/lib/Types/Label.d.ts +0 -0
- package/lib/Types/Label.js +0 -0
- package/lib/Types/LabelAssociation.d.ts +0 -0
- package/lib/Types/LabelAssociation.js +0 -0
- package/lib/Types/Message.d.ts +0 -0
- package/lib/Types/Message.js +0 -0
- package/lib/Types/Newsletter.d.ts +0 -0
- package/lib/Types/Newsletter.js +0 -0
- package/lib/Types/Product.d.ts +0 -0
- package/lib/Types/Product.js +0 -0
- package/lib/Types/Signal.d.ts +0 -0
- package/lib/Types/Signal.js +0 -0
- package/lib/Types/Socket.d.ts +0 -0
- package/lib/Types/Socket.js +0 -0
- package/lib/Types/State.d.ts +0 -0
- package/lib/Types/State.js +0 -0
- package/lib/Types/USync.d.ts +0 -0
- package/lib/Types/USync.js +0 -0
- package/lib/Types/index.d.ts +0 -0
- package/lib/Types/index.js +0 -0
- package/lib/Utils/auth-utils.d.ts +0 -0
- package/lib/Utils/auth-utils.js +0 -0
- package/lib/Utils/baileys-event-stream.d.ts +0 -0
- package/lib/Utils/baileys-event-stream.js +0 -0
- package/lib/Utils/business.d.ts +0 -0
- package/lib/Utils/business.js +0 -0
- package/lib/Utils/chat-utils.d.ts +0 -0
- package/lib/Utils/chat-utils.js +0 -0
- package/lib/Utils/crypto.d.ts +0 -0
- package/lib/Utils/crypto.js +0 -0
- package/lib/Utils/decode-wa-message.d.ts +0 -0
- package/lib/Utils/decode-wa-message.js +0 -0
- package/lib/Utils/event-buffer.d.ts +0 -0
- package/lib/Utils/event-buffer.js +0 -0
- package/lib/Utils/generics.d.ts +0 -0
- package/lib/Utils/generics.js +0 -0
- package/lib/Utils/history.d.ts +0 -0
- package/lib/Utils/history.js +0 -0
- package/lib/Utils/index.d.ts +0 -0
- package/lib/Utils/index.js +0 -0
- package/lib/Utils/link-preview.d.ts +0 -0
- package/lib/Utils/link-preview.js +0 -0
- package/lib/Utils/logger.d.ts +0 -0
- package/lib/Utils/logger.js +0 -0
- package/lib/Utils/lt-hash.d.ts +0 -0
- package/lib/Utils/lt-hash.js +0 -0
- package/lib/Utils/make-mutex.d.ts +0 -0
- package/lib/Utils/make-mutex.js +0 -0
- package/lib/Utils/messages-media.d.ts +0 -0
- package/lib/Utils/messages-media.js +0 -0
- package/lib/Utils/messages.d.ts +0 -0
- package/lib/Utils/messages.js +0 -0
- package/lib/Utils/noise-handler.d.ts +0 -0
- package/lib/Utils/noise-handler.js +0 -0
- package/lib/Utils/process-message.d.ts +0 -0
- package/lib/Utils/process-message.js +0 -0
- package/lib/Utils/signal.d.ts +0 -0
- package/lib/Utils/signal.js +0 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -0
- package/lib/Utils/use-multi-file-auth-state.js +0 -0
- package/lib/Utils/validate-connection.d.ts +0 -0
- package/lib/Utils/validate-connection.js +0 -0
- package/lib/WABinary/constants.d.ts +0 -0
- package/lib/WABinary/constants.js +0 -0
- package/lib/WABinary/decode.d.ts +0 -0
- package/lib/WABinary/decode.js +0 -0
- package/lib/WABinary/encode.d.ts +0 -0
- package/lib/WABinary/encode.js +0 -0
- package/lib/WABinary/generic-utils.d.ts +0 -0
- package/lib/WABinary/generic-utils.js +0 -0
- package/lib/WABinary/index.d.ts +0 -0
- package/lib/WABinary/index.js +0 -0
- package/lib/WABinary/jid-utils.d.ts +0 -0
- package/lib/WABinary/jid-utils.js +0 -0
- package/lib/WABinary/types.d.ts +0 -0
- package/lib/WABinary/types.js +0 -0
- package/lib/WAM/BinaryInfo.d.ts +0 -0
- package/lib/WAM/BinaryInfo.js +0 -0
- package/lib/WAM/constants.d.ts +0 -0
- package/lib/WAM/constants.js +0 -0
- package/lib/WAM/encode.d.ts +0 -0
- package/lib/WAM/encode.js +0 -0
- package/lib/WAM/index.d.ts +0 -0
- package/lib/WAM/index.js +0 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -0
- package/lib/WAUSync/Protocols/index.d.ts +0 -0
- package/lib/WAUSync/Protocols/index.js +0 -0
- package/lib/WAUSync/USyncQuery.d.ts +0 -0
- package/lib/WAUSync/USyncQuery.js +0 -0
- package/lib/WAUSync/USyncUser.d.ts +0 -0
- package/lib/WAUSync/USyncUser.js +0 -0
- package/lib/WAUSync/index.d.ts +0 -0
- package/lib/WAUSync/index.js +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +1 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
File without changes
|
|
File without changes
|
package/WAProto/WAProto.proto
CHANGED
|
File without changes
|
package/WAProto/index.d.ts
CHANGED
|
File without changes
|
package/WAProto/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/WASignalGroup/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Defaults/index.d.ts
CHANGED
|
File without changes
|
package/lib/Defaults/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Signal/Group/x
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/Signal/libsignal.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Socket/business.d.ts
CHANGED
|
File without changes
|
package/lib/Socket/business.js
CHANGED
|
File without changes
|
package/lib/Socket/chats.d.ts
CHANGED
|
File without changes
|
package/lib/Socket/chats.js
CHANGED
|
File without changes
|
package/lib/Socket/groups.d.ts
CHANGED
|
File without changes
|
package/lib/Socket/groups.js
CHANGED
|
File without changes
|
package/lib/Socket/index.d.ts
CHANGED
|
File without changes
|
package/lib/Socket/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Socket/newsletter.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Socket/socket.d.ts
CHANGED
|
File without changes
|
package/lib/Socket/socket.js
CHANGED
|
@@ -20,16 +20,15 @@ const Client_1 = require("./Client");
|
|
|
20
20
|
const makeSocket = (config) => {
|
|
21
21
|
var _a, _b;
|
|
22
22
|
const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, printQRInTerminal, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository, } = config;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
});
|
|
23
|
+
let url = typeof waWebSocketUrl === 'string' ? new url_1.URL(waWebSocketUrl) : waWebSocketUrl;
|
|
24
|
+
config.mobile = config.mobile || url.protocol === 'tcp:';
|
|
25
|
+
if (config.mobile && url.protocol !== 'tcp:') {
|
|
26
|
+
url = new url_1.URL(`tcp://${Defaults_1.MOBILE_ENDPOINT}:${Defaults_1.MOBILE_PORT}`);
|
|
28
27
|
}
|
|
29
|
-
if (url.protocol === 'wss' && ((_a = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _a === void 0 ? void 0 : _a.routingInfo)) {
|
|
28
|
+
if (!config.mobile && url.protocol === 'wss' && ((_a = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _a === void 0 ? void 0 : _a.routingInfo)) {
|
|
30
29
|
url.searchParams.append('ED', authState.creds.routingInfo.toString('base64url'));
|
|
31
30
|
}
|
|
32
|
-
const ws = new Client_1.WebSocketClient(url, config);
|
|
31
|
+
const ws = config.socket ? config.socket : config.mobile ? new Client_1.MobileSocketClient(url, config) : new Client_1.WebSocketClient(url, config);
|
|
33
32
|
ws.connect();
|
|
34
33
|
const ev = (0, Utils_1.makeEventBuffer)(logger);
|
|
35
34
|
/** ephemeral key pair used to encrypt/decrypt communication. Unique for each connection */
|
|
@@ -37,7 +36,8 @@ const makeSocket = (config) => {
|
|
|
37
36
|
/** WA noise protocol wrapper */
|
|
38
37
|
const noise = (0, Utils_1.makeNoiseHandler)({
|
|
39
38
|
keyPair: ephemeralKeyPair,
|
|
40
|
-
NOISE_HEADER: Defaults_1.NOISE_WA_HEADER,
|
|
39
|
+
NOISE_HEADER: config.mobile ? Defaults_1.MOBILE_NOISE_HEADER : Defaults_1.NOISE_WA_HEADER,
|
|
40
|
+
mobile: config.mobile,
|
|
41
41
|
logger,
|
|
42
42
|
routingInfo: (_b = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _b === void 0 ? void 0 : _b.routingInfo
|
|
43
43
|
});
|
|
@@ -80,25 +80,6 @@ const makeSocket = (config) => {
|
|
|
80
80
|
/** log & process any unexpected errors */
|
|
81
81
|
const onUnexpectedError = (err, msg) => {
|
|
82
82
|
logger.error({ err }, `unexpected error in '${msg}'`);
|
|
83
|
-
const message = (err && ((err.stack || err.message) || String(err))).toLowerCase();
|
|
84
|
-
// auto recover from cryptographic desyncs by re-uploading prekeys
|
|
85
|
-
if (message.includes('bad mac') || (message.includes('mac') && message.includes('invalid'))) {
|
|
86
|
-
try {
|
|
87
|
-
uploadPreKeysToServerIfRequired(true)
|
|
88
|
-
.catch(e => logger.warn({ e }, 'failed to re-upload prekeys after bad mac'));
|
|
89
|
-
}
|
|
90
|
-
catch (_e) {
|
|
91
|
-
// ignore
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
// gently back off when encountering rate limits (429)
|
|
95
|
-
if (message.includes('429') || message.includes('rate limit')) {
|
|
96
|
-
const wait = Math.min(30000, (config.backoffDelayMs || 5000));
|
|
97
|
-
logger.info({ wait }, 'backing off due to rate limit');
|
|
98
|
-
setTimeout(() => {
|
|
99
|
-
// intentionally empty; wait to delay further sends
|
|
100
|
-
}, wait);
|
|
101
|
-
}
|
|
102
83
|
};
|
|
103
84
|
/** await the next incoming message */
|
|
104
85
|
const awaitNextMessage = async (sendMsg) => {
|
|
@@ -135,7 +116,7 @@ const makeSocket = (config) => {
|
|
|
135
116
|
let onRecv;
|
|
136
117
|
let onErr;
|
|
137
118
|
try {
|
|
138
|
-
|
|
119
|
+
return await (0, Utils_1.promiseTimeout)(timeoutMs, (resolve, reject) => {
|
|
139
120
|
onRecv = resolve;
|
|
140
121
|
onErr = err => {
|
|
141
122
|
reject(err || new boom_1.Boom('Connection Closed', { statusCode: Types_1.DisconnectReason.connectionClosed }));
|
|
@@ -144,7 +125,6 @@ const makeSocket = (config) => {
|
|
|
144
125
|
ws.on('close', onErr); // if the socket closes, you'll never receive the message
|
|
145
126
|
ws.off('error', onErr);
|
|
146
127
|
});
|
|
147
|
-
return result;
|
|
148
128
|
}
|
|
149
129
|
finally {
|
|
150
130
|
ws.off(`TAG:${msgId}`, onRecv);
|
|
@@ -158,10 +138,9 @@ const makeSocket = (config) => {
|
|
|
158
138
|
node.attrs.id = generateMessageTag();
|
|
159
139
|
}
|
|
160
140
|
const msgId = node.attrs.id;
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
]);
|
|
141
|
+
const wait = waitForMessage(msgId, timeoutMs);
|
|
142
|
+
await sendNode(node);
|
|
143
|
+
const result = await wait;
|
|
165
144
|
if ('tag' in result) {
|
|
166
145
|
(0, WABinary_1.assertNodeErrorFree)(result);
|
|
167
146
|
}
|
|
@@ -178,9 +157,12 @@ const makeSocket = (config) => {
|
|
|
178
157
|
const result = await awaitNextMessage(init);
|
|
179
158
|
const handshake = WAProto_1.proto.HandshakeMessage.decode(result);
|
|
180
159
|
logger.trace({ handshake }, 'handshake recv from WA');
|
|
181
|
-
const keyEnc =
|
|
160
|
+
const keyEnc = noise.processHandshake(handshake, creds.noiseKey);
|
|
182
161
|
let node;
|
|
183
|
-
if (
|
|
162
|
+
if (config.mobile) {
|
|
163
|
+
node = (0, Utils_1.generateMobileNode)(config);
|
|
164
|
+
}
|
|
165
|
+
else if (!creds.me) {
|
|
184
166
|
node = (0, Utils_1.generateRegistrationNode)(creds, config);
|
|
185
167
|
logger.info({ node }, 'not logged in, attempting registration...');
|
|
186
168
|
}
|
|
@@ -250,11 +232,11 @@ const makeSocket = (config) => {
|
|
|
250
232
|
const l0 = frame.tag;
|
|
251
233
|
const l1 = frame.attrs || {};
|
|
252
234
|
const l2 = Array.isArray(frame.content) ? (_a = frame.content[0]) === null || _a === void 0 ? void 0 : _a.tag : '';
|
|
253
|
-
|
|
235
|
+
Object.keys(l1).forEach(key => {
|
|
254
236
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]},${l2}`, frame) || anyTriggered;
|
|
255
237
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]}`, frame) || anyTriggered;
|
|
256
238
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},${key}`, frame) || anyTriggered;
|
|
257
|
-
}
|
|
239
|
+
});
|
|
258
240
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},,${l2}`, frame) || anyTriggered;
|
|
259
241
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0}`, frame) || anyTriggered;
|
|
260
242
|
if (!anyTriggered && logger.level === 'debug') {
|
|
@@ -383,8 +365,8 @@ const makeSocket = (config) => {
|
|
|
383
365
|
}
|
|
384
366
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
385
367
|
};
|
|
386
|
-
|
|
387
368
|
/** This method was created by snowi, and implemented by KyuuRzy */
|
|
369
|
+
|
|
388
370
|
/** hey bro, if you delete this text */
|
|
389
371
|
/** you are the most cursed human being who likes to claim other people's property 😹🙌🏻 */
|
|
390
372
|
const requestPairingCode = async (phoneNumber, pairKey) => {
|
|
@@ -449,11 +431,12 @@ const makeSocket = (config) => {
|
|
|
449
431
|
});
|
|
450
432
|
|
|
451
433
|
return authState.creds.pairingCode;
|
|
452
|
-
}
|
|
434
|
+
};
|
|
435
|
+
|
|
453
436
|
async function generatePairingKey() {
|
|
454
437
|
const salt = (0, crypto_1.randomBytes)(32);
|
|
455
438
|
const randomIv = (0, crypto_1.randomBytes)(16);
|
|
456
|
-
const key =
|
|
439
|
+
const key = (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
|
|
457
440
|
const ciphered = (0, Utils_1.aesEncryptCTR)(authState.creds.pairingEphemeralKeyPair.public, key, randomIv);
|
|
458
441
|
return Buffer.concat([salt, randomIv, ciphered]);
|
|
459
442
|
}
|
|
@@ -540,18 +523,12 @@ const makeSocket = (config) => {
|
|
|
540
523
|
});
|
|
541
524
|
// login complete
|
|
542
525
|
ws.on('CB:success', async (node) => {
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
ev.emit('connection.update', { connection: 'open' });
|
|
550
|
-
}
|
|
551
|
-
catch (err) {
|
|
552
|
-
logger.error({ err }, 'error opening connection');
|
|
553
|
-
end(err);
|
|
554
|
-
}
|
|
526
|
+
await uploadPreKeysToServerIfRequired();
|
|
527
|
+
await sendPassiveIq('active');
|
|
528
|
+
logger.info('opened connection to WA');
|
|
529
|
+
clearTimeout(qrTimer); // will never happen in all likelyhood -- but just in case WA sends success on first try
|
|
530
|
+
ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } });
|
|
531
|
+
ev.emit('connection.update', { connection: 'open' });
|
|
555
532
|
});
|
|
556
533
|
ws.on('CB:stream:error', (node) => {
|
|
557
534
|
logger.error({ node }, 'stream errored out');
|
|
@@ -566,20 +543,11 @@ const makeSocket = (config) => {
|
|
|
566
543
|
ws.on('CB:ib,,downgrade_webclient', () => {
|
|
567
544
|
end(new boom_1.Boom('Multi-device beta not joined', { statusCode: Types_1.DisconnectReason.multideviceMismatch }));
|
|
568
545
|
});
|
|
569
|
-
ws.on('CB:ib,,offline_preview', (node) => {
|
|
570
|
-
logger.info('offline preview received', JSON.stringify(node));
|
|
571
|
-
sendNode({
|
|
572
|
-
tag: 'ib',
|
|
573
|
-
attrs: {},
|
|
574
|
-
content: [{ tag: 'offline_batch', attrs: { count: '100' } }]
|
|
575
|
-
});
|
|
576
|
-
});
|
|
577
546
|
ws.on('CB:ib,,edge_routing', (node) => {
|
|
578
547
|
const edgeRoutingNode = (0, WABinary_1.getBinaryNodeChild)(node, 'edge_routing');
|
|
579
548
|
const routingInfo = (0, WABinary_1.getBinaryNodeChild)(edgeRoutingNode, 'routing_info');
|
|
580
549
|
if (routingInfo === null || routingInfo === void 0 ? void 0 : routingInfo.content) {
|
|
581
550
|
authState.creds.routingInfo = Buffer.from(routingInfo === null || routingInfo === void 0 ? void 0 : routingInfo.content);
|
|
582
|
-
ev.emit('creds.update', authState.creds);
|
|
583
551
|
}
|
|
584
552
|
});
|
|
585
553
|
let didStartBuffer = false;
|
|
@@ -628,10 +596,7 @@ const makeSocket = (config) => {
|
|
|
628
596
|
type: 'md',
|
|
629
597
|
ws,
|
|
630
598
|
ev,
|
|
631
|
-
authState: {
|
|
632
|
-
creds,
|
|
633
|
-
keys
|
|
634
|
-
},
|
|
599
|
+
authState: { creds, keys },
|
|
635
600
|
signalRepository,
|
|
636
601
|
get user() {
|
|
637
602
|
return authState.creds.me;
|
package/lib/Socket/usync.d.ts
CHANGED
|
File without changes
|
package/lib/Socket/usync.js
CHANGED
|
File without changes
|
package/lib/Store/index.d.ts
CHANGED
|
File without changes
|
package/lib/Store/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Types/Auth.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Auth.js
CHANGED
|
File without changes
|
package/lib/Types/Call.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Call.js
CHANGED
|
File without changes
|
package/lib/Types/Chat.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Chat.js
CHANGED
|
File without changes
|
package/lib/Types/Contact.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Contact.js
CHANGED
|
File without changes
|
package/lib/Types/Events.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Events.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Types/Label.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Label.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Types/Message.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Message.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/Types/Newsletter.js
CHANGED
|
File without changes
|
package/lib/Types/Product.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Product.js
CHANGED
|
File without changes
|
package/lib/Types/Signal.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Signal.js
CHANGED
|
File without changes
|
package/lib/Types/Socket.d.ts
CHANGED
|
File without changes
|
package/lib/Types/Socket.js
CHANGED
|
File without changes
|
package/lib/Types/State.d.ts
CHANGED
|
File without changes
|
package/lib/Types/State.js
CHANGED
|
File without changes
|
package/lib/Types/USync.d.ts
CHANGED
|
File without changes
|
package/lib/Types/USync.js
CHANGED
|
File without changes
|
package/lib/Types/index.d.ts
CHANGED
|
File without changes
|
package/lib/Types/index.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/Utils/auth-utils.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Utils/business.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/business.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/Utils/chat-utils.js
CHANGED
|
File without changes
|
package/lib/Utils/crypto.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/crypto.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Utils/generics.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/generics.js
CHANGED
|
File without changes
|
package/lib/Utils/history.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/history.js
CHANGED
|
File without changes
|
package/lib/Utils/index.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Utils/logger.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/logger.js
CHANGED
|
File without changes
|
package/lib/Utils/lt-hash.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/lt-hash.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/Utils/make-mutex.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Utils/messages.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/messages.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/Utils/signal.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/signal.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WABinary/decode.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/decode.js
CHANGED
|
File without changes
|
package/lib/WABinary/encode.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/encode.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WABinary/index.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WABinary/types.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/types.js
CHANGED
|
File without changes
|
package/lib/WAM/BinaryInfo.d.ts
CHANGED
|
File without changes
|
package/lib/WAM/BinaryInfo.js
CHANGED
|
File without changes
|
package/lib/WAM/constants.d.ts
CHANGED
|
File without changes
|
package/lib/WAM/constants.js
CHANGED
|
File without changes
|
package/lib/WAM/encode.d.ts
CHANGED
|
File without changes
|
package/lib/WAM/encode.js
CHANGED
|
File without changes
|
package/lib/WAM/index.d.ts
CHANGED
|
File without changes
|
package/lib/WAM/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WAUSync/USyncUser.js
CHANGED
|
File without changes
|
package/lib/WAUSync/index.d.ts
CHANGED
|
File without changes
|
package/lib/WAUSync/index.js
CHANGED
|
File without changes
|
package/lib/index.d.ts
CHANGED
|
File without changes
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
const chalk = require("chalk")
|
|
4
|
-
console.log(chalk.
|
|
4
|
+
console.log(chalk.yellow("Modified Baileys By Ostyado"));
|
|
5
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
6
|
if (k2 === undefined) k2 = k;
|
|
7
7
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ostyado/baileys",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -37,6 +37,8 @@
|
|
|
37
37
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
38
38
|
"lint": "eslint src --ext .js,.ts,.jsx,.tsx",
|
|
39
39
|
"lint:fix": "eslint src --fix --ext .js,.ts,.jsx,.tsx",
|
|
40
|
+
"prepack": "tsc",
|
|
41
|
+
"prepare": "tsc",
|
|
40
42
|
"release": "release-it",
|
|
41
43
|
"test": "jest"
|
|
42
44
|
},
|
|
@@ -50,7 +52,7 @@
|
|
|
50
52
|
"chalk": "^4.1.2",
|
|
51
53
|
"futoin-hkdf": "^1.5.1",
|
|
52
54
|
"libphonenumber-js": "^1.10.20",
|
|
53
|
-
"libsignal": "
|
|
55
|
+
"libsignal": "npm:@shennmine/libsignal-node",
|
|
54
56
|
"music-metadata": "^7.12.3",
|
|
55
57
|
"node-cache": "^5.1.2",
|
|
56
58
|
"pino": "^7.0.0",
|
|
@@ -100,8 +102,5 @@
|
|
|
100
102
|
"optional": true
|
|
101
103
|
}
|
|
102
104
|
},
|
|
103
|
-
"publishConfig": {
|
|
104
|
-
"access": "public"
|
|
105
|
-
},
|
|
106
105
|
"packageManager": "yarn@1.22.19"
|
|
107
106
|
}
|