@queenanya/baileys 7.4.13 → 7.5.11
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 +26 -26
- package/WAProto/index.js +66875 -96112
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +1 -231
- package/lib/Defaults/index.js +11 -23
- package/lib/Socket/Client/index.d.ts +2 -3
- package/lib/Socket/Client/index.js +2 -3
- package/lib/Socket/Client/{web-socket-client.d.ts → websocket.d.ts} +1 -1
- package/lib/Socket/Client/{web-socket-client.js → websocket.js} +2 -2
- package/lib/Socket/business.d.ts +29 -22
- package/lib/Socket/chats.d.ts +14 -3
- package/lib/Socket/chats.js +76 -48
- package/lib/Socket/groups.d.ts +21 -4
- package/lib/Socket/groups.js +12 -1
- package/lib/Socket/index.d.ts +37 -32
- package/lib/Socket/index.js +2 -2
- package/lib/Socket/messages-recv.d.ts +28 -22
- package/lib/Socket/messages-recv.js +291 -180
- package/lib/Socket/messages-send.d.ts +23 -13
- package/lib/Socket/messages-send.js +110 -76
- package/lib/Socket/newsletter.d.ts +17 -7
- package/lib/Socket/newsletter.js +67 -54
- package/lib/Socket/socket.d.ts +3 -1
- package/lib/Socket/socket.js +15 -17
- package/lib/Store/make-cache-manager-store.d.ts +2 -1
- package/lib/Store/make-in-memory-store.js +13 -11
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +1 -6
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +12 -7
- package/lib/Types/Contact.d.ts +1 -1
- package/lib/Types/Events.d.ts +44 -2
- package/lib/Types/GroupMetadata.d.ts +3 -1
- package/lib/Types/Label.d.ts +11 -0
- package/lib/Types/Message.d.ts +37 -30
- package/lib/Types/Newsletter.d.ts +0 -13
- package/lib/Types/Newsletter.js +1 -15
- package/lib/Types/Socket.d.ts +10 -3
- package/lib/Types/index.d.ts +8 -0
- package/lib/Utils/auth-utils.js +1 -7
- package/lib/Utils/chat-utils.d.ts +5 -4
- package/lib/Utils/chat-utils.js +41 -20
- package/lib/Utils/crypto.d.ts +2 -1
- package/lib/Utils/crypto.js +4 -2
- package/lib/Utils/decode-wa-message.d.ts +1 -0
- package/lib/Utils/decode-wa-message.js +34 -14
- package/lib/Utils/event-buffer.js +14 -8
- package/lib/Utils/generics.d.ts +37 -13
- package/lib/Utils/generics.js +102 -18
- package/lib/Utils/history.d.ts +6 -2
- package/lib/Utils/history.js +3 -0
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/link-preview.js +24 -1
- package/lib/Utils/logger.d.ts +1 -3
- package/lib/Utils/make-mutex.js +1 -0
- package/lib/Utils/messages-media.d.ts +3 -2
- package/lib/Utils/messages-media.js +17 -32
- package/lib/Utils/messages.d.ts +1 -0
- package/lib/Utils/messages.js +67 -72
- package/lib/Utils/noise-handler.d.ts +3 -3
- package/lib/Utils/noise-handler.js +7 -12
- package/lib/Utils/process-message.d.ts +3 -2
- package/lib/Utils/process-message.js +55 -21
- package/lib/Utils/signal.js +23 -16
- package/lib/Utils/use-multi-file-auth-state.js +17 -3
- package/lib/Utils/validate-connection.d.ts +0 -1
- package/lib/Utils/validate-connection.js +10 -44
- package/lib/WABinary/constants.js +5 -5
- package/lib/WABinary/decode.d.ts +3 -2
- package/lib/WABinary/decode.js +6 -4
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +8 -6
- package/lib/WABinary/generic-utils.d.ts +1 -0
- package/lib/WABinary/jid-utils.d.ts +3 -3
- package/lib/WABinary/jid-utils.js +5 -5
- package/lib/WAM/BinaryInfo.d.ts +3 -2
- package/lib/WAM/constants.d.ts +3 -2
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +2 -2
- package/package.json +38 -36
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -13
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/registration.d.ts +0 -267
- package/lib/Socket/registration.js +0 -166
- /package/lib/Socket/Client/{abstract-socket-client.d.ts → types.d.ts} +0 -0
- /package/lib/Socket/Client/{abstract-socket-client.js → types.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode =
|
|
3
|
+
exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = void 0;
|
|
4
4
|
const boom_1 = require("@hapi/boom");
|
|
5
5
|
const crypto_1 = require("crypto");
|
|
6
6
|
const WAProto_1 = require("../../WAProto");
|
|
@@ -10,30 +10,19 @@ const crypto_2 = require("./crypto");
|
|
|
10
10
|
const generics_1 = require("./generics");
|
|
11
11
|
const signal_1 = require("./signal");
|
|
12
12
|
const getUserAgent = (config) => {
|
|
13
|
-
var _a, _b;
|
|
14
|
-
const osVersion = config.mobile ? '15.3.1' : '0.1';
|
|
15
|
-
const version = config.mobile ? [2, 24, 6] : config.version;
|
|
16
|
-
const device = config.mobile ? 'iPhone_7' : 'Desktop';
|
|
17
|
-
const manufacturer = config.mobile ? 'Apple' : '';
|
|
18
|
-
const platform = config.mobile ? WAProto_1.proto.ClientPayload.UserAgent.Platform.IOS : WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB;
|
|
19
|
-
const phoneId = config.mobile ? { phoneId: config.auth.creds.phoneId } : {};
|
|
20
13
|
return {
|
|
21
14
|
appVersion: {
|
|
22
|
-
primary: version[0],
|
|
23
|
-
secondary: version[1],
|
|
24
|
-
tertiary: version[2],
|
|
15
|
+
primary: config.version[0],
|
|
16
|
+
secondary: config.version[1],
|
|
17
|
+
tertiary: config.version[2],
|
|
25
18
|
},
|
|
26
|
-
platform,
|
|
19
|
+
platform: WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB,
|
|
27
20
|
releaseChannel: WAProto_1.proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
manufacturer,
|
|
32
|
-
device,
|
|
33
|
-
osBuildNumber: osVersion,
|
|
21
|
+
osVersion: '0.1',
|
|
22
|
+
device: 'Desktop',
|
|
23
|
+
osBuildNumber: '0.1',
|
|
34
24
|
localeLanguageIso6391: 'en',
|
|
35
|
-
localeCountryIso31661Alpha2: 'US'
|
|
36
|
-
...phoneId
|
|
25
|
+
localeCountryIso31661Alpha2: 'US'
|
|
37
26
|
};
|
|
38
27
|
};
|
|
39
28
|
const PLATFORM_MAP = {
|
|
@@ -53,32 +42,9 @@ const getClientPayload = (config) => {
|
|
|
53
42
|
connectReason: WAProto_1.proto.ClientPayload.ConnectReason.USER_ACTIVATED,
|
|
54
43
|
userAgent: getUserAgent(config),
|
|
55
44
|
};
|
|
56
|
-
|
|
57
|
-
payload.webInfo = getWebInfo(config);
|
|
58
|
-
}
|
|
45
|
+
payload.webInfo = getWebInfo(config);
|
|
59
46
|
return payload;
|
|
60
47
|
};
|
|
61
|
-
const generateMobileNode = (config) => {
|
|
62
|
-
if (!config.auth.creds) {
|
|
63
|
-
throw new boom_1.Boom('No registration data found', { data: config });
|
|
64
|
-
}
|
|
65
|
-
const payload = {
|
|
66
|
-
...getClientPayload(config),
|
|
67
|
-
sessionId: Math.floor(Math.random() * 999999999 + 1),
|
|
68
|
-
shortConnect: true,
|
|
69
|
-
connectAttemptCount: 0,
|
|
70
|
-
device: 0,
|
|
71
|
-
dnsSource: {
|
|
72
|
-
appCached: false,
|
|
73
|
-
dnsMethod: WAProto_1.proto.ClientPayload.DNSSource.DNSResolutionMethod.SYSTEM,
|
|
74
|
-
},
|
|
75
|
-
passive: false,
|
|
76
|
-
pushName: 'test',
|
|
77
|
-
username: Number(`${config.auth.creds.registration.phoneNumberCountryCode}${config.auth.creds.registration.phoneNumberNationalNumber}`),
|
|
78
|
-
};
|
|
79
|
-
return WAProto_1.proto.ClientPayload.fromObject(payload);
|
|
80
|
-
};
|
|
81
|
-
exports.generateMobileNode = generateMobileNode;
|
|
82
48
|
const generateLoginNode = (userJid, config) => {
|
|
83
49
|
const { user, device } = (0, WABinary_1.jidDecode)(userJid);
|
|
84
50
|
const payload = {
|
|
@@ -30,11 +30,11 @@ exports.SINGLE_BYTE_TOKENS = [
|
|
|
30
30
|
'', 'xmlstreamstart', 'xmlstreamend', 's.whatsapp.net', 'type', 'participant', 'from', 'receipt', 'id', 'broadcast', 'status', 'message', 'notification', 'notify', 'to', 'jid', 'user', 'class', 'offline', 'g.us', 'result', 'mediatype', 'enc', 'skmsg', 'off_cnt', 'xmlns', 'presence', 'participants', 'ack', 't', 'iq', 'device_hash', 'read', 'value', 'media', 'picture', 'chatstate', 'unavailable', 'text', 'urn:xmpp:whatsapp:push', 'devices', 'verified_name', 'contact', 'composing', 'edge_routing', 'routing_info', 'item', 'image', 'verified_level', 'get', 'fallback_hostname', '2', 'media_conn', '1', 'v', 'handshake', 'fallback_class', 'count', 'config', 'offline_preview', 'download_buckets', 'w:profile:picture', 'set', 'creation', 'location', 'fallback_ip4', 'msg', 'urn:xmpp:ping', 'fallback_ip6', 'call-creator', 'relaylatency', 'success', 'subscribe', 'video', 'business_hours_config', 'platform', 'hostname', 'version', 'unknown', '0', 'ping', 'hash', 'edit', 'subject', 'max_buckets', 'download', 'delivery', 'props', 'sticker', 'name', 'last', 'contacts', 'business', 'primary', 'preview', 'w:p', 'pkmsg', 'call-id', 'retry', 'prop', 'call', 'auth_ttl', 'available', 'relay_id', 'last_id', 'day_of_week', 'w', 'host', 'seen', 'bits', 'list', 'atn', 'upload', 'is_new', 'w:stats', 'key', 'paused', 'specific_hours', 'multicast', 'stream:error', 'mmg.whatsapp.net', 'code', 'deny', 'played', 'profile', 'fna', 'device-list', 'close_time', 'latency', 'gcm', 'pop', 'audio', '26', 'w:web', 'open_time', 'error', 'auth', 'ip4', 'update', 'profile_options', 'config_value', 'category', 'catalog_not_created', '00', 'config_code', 'mode', 'catalog_status', 'ip6', 'blocklist', 'registration', '7', 'web', 'fail', 'w:m', 'cart_enabled', 'ttl', 'gif', '300', 'device_orientation', 'identity', 'query', '401', 'media-gig2-1.cdn.whatsapp.net', 'in', '3', 'te2', 'add', 'fallback', 'categories', 'ptt', 'encrypt', 'notice', 'thumbnail-document', 'item-not-found', '12', 'thumbnail-image', 'stage', 'thumbnail-link', 'usync', 'out', 'thumbnail-video', '8', '01', 'context', 'sidelist', 'thumbnail-gif', 'terminate', 'not-authorized', 'orientation', 'dhash', 'capability', 'side_list', 'md-app-state', 'description', 'serial', 'readreceipts', 'te', 'business_hours', 'md-msg-hist', 'tag', 'attribute_padding', 'document', 'open_24h', 'delete', 'expiration', 'active', 'prev_v_id', 'true', 'passive', 'index', '4', 'conflict', 'remove', 'w:gp2', 'config_expo_key', 'screen_height', 'replaced', '02', 'screen_width', 'uploadfieldstat', '2:47DEQpj8', 'media-bog1-1.cdn.whatsapp.net', 'encopt', 'url', 'catalog_exists', 'keygen', 'rate', 'offer', 'opus', 'media-mia3-1.cdn.whatsapp.net', 'privacy', 'media-mia3-2.cdn.whatsapp.net', 'signature', 'preaccept', 'token_id', 'media-eze1-1.cdn.whatsapp.net'
|
|
31
31
|
];
|
|
32
32
|
exports.TOKEN_MAP = {};
|
|
33
|
-
for (
|
|
34
|
-
exports.TOKEN_MAP[
|
|
33
|
+
for (const [i, SINGLE_BYTE_TOKEN] of exports.SINGLE_BYTE_TOKENS.entries()) {
|
|
34
|
+
exports.TOKEN_MAP[SINGLE_BYTE_TOKEN] = { index: i };
|
|
35
35
|
}
|
|
36
|
-
for (
|
|
37
|
-
for (
|
|
38
|
-
exports.TOKEN_MAP[
|
|
36
|
+
for (const [i, DOUBLE_BYTE_TOKEN] of exports.DOUBLE_BYTE_TOKENS.entries()) {
|
|
37
|
+
for (const [j, element] of DOUBLE_BYTE_TOKEN.entries()) {
|
|
38
|
+
exports.TOKEN_MAP[element] = { dict: i, index: j };
|
|
39
39
|
}
|
|
40
40
|
}
|
package/lib/WABinary/decode.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
3
|
-
export declare const decompressingIfRequired: (buffer: Buffer) => Buffer
|
|
4
|
+
export declare const decompressingIfRequired: (buffer: Buffer) => Promise<Buffer>;
|
|
4
5
|
export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, 'DOUBLE_BYTE_TOKENS' | 'SINGLE_BYTE_TOKENS' | 'TAGS'>, indexRef?: {
|
|
5
6
|
index: number;
|
|
6
7
|
}) => BinaryNode;
|
|
7
|
-
export declare const decodeBinaryNode: (buff: Buffer) => BinaryNode
|
|
8
|
+
export declare const decodeBinaryNode: (buff: Buffer) => Promise<BinaryNode>;
|
package/lib/WABinary/decode.js
CHANGED
|
@@ -24,12 +24,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.decodeBinaryNode = exports.decodeDecompressedBinaryNode = exports.decompressingIfRequired = void 0;
|
|
27
|
+
const util_1 = require("util");
|
|
27
28
|
const zlib_1 = require("zlib");
|
|
28
29
|
const constants = __importStar(require("./constants"));
|
|
29
30
|
const jid_utils_1 = require("./jid-utils");
|
|
30
|
-
const
|
|
31
|
+
const inflatePromise = (0, util_1.promisify)(zlib_1.inflate);
|
|
32
|
+
const decompressingIfRequired = async (buffer) => {
|
|
31
33
|
if (2 & buffer.readUInt8()) {
|
|
32
|
-
buffer =
|
|
34
|
+
buffer = await inflatePromise(buffer.slice(1));
|
|
33
35
|
}
|
|
34
36
|
else { // nodes with no compression have a 0x00 prefix, we remove that
|
|
35
37
|
buffer = buffer.slice(1);
|
|
@@ -245,8 +247,8 @@ const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0 }) =>
|
|
|
245
247
|
};
|
|
246
248
|
};
|
|
247
249
|
exports.decodeDecompressedBinaryNode = decodeDecompressedBinaryNode;
|
|
248
|
-
const decodeBinaryNode = (buff) => {
|
|
249
|
-
const decompBuff = (0, exports.decompressingIfRequired)(buff);
|
|
250
|
+
const decodeBinaryNode = async (buff) => {
|
|
251
|
+
const decompBuff = await (0, exports.decompressingIfRequired)(buff);
|
|
250
252
|
return (0, exports.decodeDecompressedBinaryNode)(decompBuff, constants);
|
|
251
253
|
};
|
|
252
254
|
exports.decodeBinaryNode = decodeBinaryNode;
|
package/lib/WABinary/encode.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
3
|
-
export declare const encodeBinaryNode: ({ tag, attrs, content }: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, 'TAGS' | 'TOKEN_MAP'>, buffer?: number[]) =>
|
|
2
|
+
export declare const encodeBinaryNode: ({ tag, attrs, content }: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, 'TAGS' | 'TOKEN_MAP'>, buffer?: number[]) => number[];
|
package/lib/WABinary/encode.js
CHANGED
|
@@ -35,7 +35,11 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
|
|
|
35
35
|
buffer.push((value >> (curShift * 8)) & 0xff);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
const pushBytes = (bytes) =>
|
|
38
|
+
const pushBytes = (bytes) => {
|
|
39
|
+
for (const b of bytes) {
|
|
40
|
+
buffer.push(b);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
39
43
|
const pushInt16 = (value) => {
|
|
40
44
|
pushBytes([(value >> 8) & 0xff, value & 0xff]);
|
|
41
45
|
};
|
|
@@ -137,8 +141,7 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
|
|
|
137
141
|
if (str.length > TAGS.PACKED_MAX) {
|
|
138
142
|
return false;
|
|
139
143
|
}
|
|
140
|
-
for (
|
|
141
|
-
const char = str[i];
|
|
144
|
+
for (const char of str) {
|
|
142
145
|
const isInNibbleRange = char >= '0' && char <= '9';
|
|
143
146
|
if (!isInNibbleRange && char !== '-' && char !== '.') {
|
|
144
147
|
return false;
|
|
@@ -150,8 +153,7 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
|
|
|
150
153
|
if (str.length > TAGS.PACKED_MAX) {
|
|
151
154
|
return false;
|
|
152
155
|
}
|
|
153
|
-
for (
|
|
154
|
-
const char = str[i];
|
|
156
|
+
for (const char of str) {
|
|
155
157
|
const isInNibbleRange = char >= '0' && char <= '9';
|
|
156
158
|
if (!isInNibbleRange && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f')) {
|
|
157
159
|
return false;
|
|
@@ -223,6 +225,6 @@ const encodeBinaryNode = ({ tag, attrs, content }, opts = constants, buffer = [0
|
|
|
223
225
|
else {
|
|
224
226
|
throw new Error(`invalid children for header "${tag}": ${content} (${typeof content})`);
|
|
225
227
|
}
|
|
226
|
-
return
|
|
228
|
+
return buffer;
|
|
227
229
|
};
|
|
228
230
|
exports.encodeBinaryNode = encodeBinaryNode;
|
|
@@ -9,7 +9,7 @@ export type JidWithDevice = {
|
|
|
9
9
|
device?: number;
|
|
10
10
|
};
|
|
11
11
|
export type FullJid = JidWithDevice & {
|
|
12
|
-
server: JidServer
|
|
12
|
+
server: JidServer;
|
|
13
13
|
domainType?: number;
|
|
14
14
|
};
|
|
15
15
|
export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number, agent?: number) => string;
|
|
@@ -26,6 +26,6 @@ export declare const isJidBroadcast: (jid: string | undefined) => boolean | unde
|
|
|
26
26
|
export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
|
|
27
27
|
/** is the jid the status broadcast */
|
|
28
28
|
export declare const isJidStatusBroadcast: (jid: string) => boolean;
|
|
29
|
-
/** is the jid
|
|
30
|
-
export declare const
|
|
29
|
+
/** is the jid a newsletter */
|
|
30
|
+
export declare const isJidNewsletter: (jid: string | undefined) => boolean | undefined;
|
|
31
31
|
export declare const jidNormalizedUser: (jid: string | undefined) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.jidNormalizedUser = exports.
|
|
3
|
+
exports.jidNormalizedUser = exports.isJidNewsletter = exports.isJidStatusBroadcast = exports.isJidGroup = exports.isJidBroadcast = exports.isLidUser = exports.isJidUser = exports.areJidsSameUser = exports.jidDecode = exports.jidEncode = exports.STORIES_JID = exports.PSA_WID = exports.SERVER_JID = exports.OFFICIAL_BIZ_JID = exports.S_WHATSAPP_NET = void 0;
|
|
4
4
|
exports.S_WHATSAPP_NET = '@s.whatsapp.net';
|
|
5
5
|
exports.OFFICIAL_BIZ_JID = '16505361212@c.us';
|
|
6
6
|
exports.SERVER_JID = 'server@c.us';
|
|
@@ -20,7 +20,7 @@ const jidDecode = (jid) => {
|
|
|
20
20
|
const [userAgent, device] = userCombined.split(':');
|
|
21
21
|
const user = userAgent.split('_')[0];
|
|
22
22
|
return {
|
|
23
|
-
server,
|
|
23
|
+
server: server,
|
|
24
24
|
user,
|
|
25
25
|
domainType: server === 'lid' ? 1 : 0,
|
|
26
26
|
device: device ? +device : undefined
|
|
@@ -48,9 +48,9 @@ exports.isJidGroup = isJidGroup;
|
|
|
48
48
|
/** is the jid the status broadcast */
|
|
49
49
|
const isJidStatusBroadcast = (jid) => jid === 'status@broadcast';
|
|
50
50
|
exports.isJidStatusBroadcast = isJidStatusBroadcast;
|
|
51
|
-
/** is the jid
|
|
52
|
-
const
|
|
53
|
-
exports.
|
|
51
|
+
/** is the jid a newsletter */
|
|
52
|
+
const isJidNewsletter = (jid) => (jid === null || jid === void 0 ? void 0 : jid.endsWith('@newsletter'));
|
|
53
|
+
exports.isJidNewsletter = isJidNewsletter;
|
|
54
54
|
const jidNormalizedUser = (jid) => {
|
|
55
55
|
const result = (0, exports.jidDecode)(jid);
|
|
56
56
|
if (!result) {
|
package/lib/WAM/BinaryInfo.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
2
3
|
export declare class BinaryInfo {
|
|
3
4
|
protocolVersion: number;
|
|
4
5
|
sequence: number;
|
|
5
6
|
events: {
|
|
6
7
|
[x: string]: {
|
|
7
8
|
props: {
|
|
8
|
-
[x: string]:
|
|
9
|
+
[x: string]: import("./constants").Value;
|
|
9
10
|
};
|
|
10
11
|
globals: {
|
|
11
|
-
[x: string]:
|
|
12
|
+
[x: string]: import("./constants").Value;
|
|
12
13
|
};
|
|
13
14
|
};
|
|
14
15
|
}[];
|
package/lib/WAM/constants.d.ts
CHANGED
|
@@ -28,11 +28,12 @@ type EventByName<T extends Event['name']> = Extract<Event, {
|
|
|
28
28
|
export type EventInputType = {
|
|
29
29
|
[key in Event['name']]: {
|
|
30
30
|
props: {
|
|
31
|
-
[k in keyof EventByName<key>['props']]:
|
|
31
|
+
[k in keyof EventByName<key>['props']]: Value;
|
|
32
32
|
};
|
|
33
33
|
globals: {
|
|
34
|
-
[x: string]:
|
|
34
|
+
[x: string]: Value;
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
37
|
} & {};
|
|
38
|
+
export type Value = number | null | string;
|
|
38
39
|
export {};
|
package/lib/WAM/encode.d.ts
CHANGED
package/lib/WAM/encode.js
CHANGED
|
@@ -13,10 +13,10 @@ const encodeWAM = (binaryInfo) => {
|
|
|
13
13
|
.reduce((a, b) => a + b);
|
|
14
14
|
const buffer = Buffer.alloc(totalSize);
|
|
15
15
|
let offset = 0;
|
|
16
|
-
binaryInfo.buffer
|
|
16
|
+
for (const buffer_ of binaryInfo.buffer) {
|
|
17
17
|
buffer_.copy(buffer, offset);
|
|
18
18
|
offset += buffer_.length;
|
|
19
|
-
}
|
|
19
|
+
}
|
|
20
20
|
return buffer;
|
|
21
21
|
};
|
|
22
22
|
exports.encodeWAM = encodeWAM;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@queenanya/baileys",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.11",
|
|
4
4
|
"description": "WhatsApp API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"whatsapp",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"automation",
|
|
13
13
|
"multi-device"
|
|
14
14
|
],
|
|
15
|
-
"homepage": "https://github.com/QueenAnya/
|
|
15
|
+
"homepage": "https://github.com/QueenAnya/Baileys",
|
|
16
16
|
"repository": {
|
|
17
17
|
"url": "git@github.com:QueenAnya/Bail.git"
|
|
18
18
|
},
|
|
@@ -27,48 +27,51 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@adiwajshing/keyed-db": "^0.2.4",
|
|
30
|
-
"@
|
|
30
|
+
"@queenanya/eslint-config": "github:whiskeysockets/eslint-config",
|
|
31
|
+
"@hapi/boom": "^10.0.1",
|
|
31
32
|
"async-lock": "^1.4.1",
|
|
32
|
-
"audio-decode": "^2.
|
|
33
|
-
"axios": "^1.
|
|
34
|
-
"cache-manager": "
|
|
35
|
-
"futoin-hkdf": "^1.5.
|
|
36
|
-
"
|
|
37
|
-
"
|
|
33
|
+
"audio-decode": "^2.2.0",
|
|
34
|
+
"axios": "^1.7.3",
|
|
35
|
+
"cache-manager": "^5.7.6",
|
|
36
|
+
"futoin-hkdf": "^1.5.3",
|
|
37
|
+
"jimp": "^0.22.12",
|
|
38
|
+
"json": "^11.0.0",
|
|
39
|
+
"libphonenumber-js": "^1.11.4",
|
|
40
|
+
"libsignal": "npm:@queenanya/libsignal@latest",
|
|
41
|
+
"lodash": "^4.17.21",
|
|
38
42
|
"music-metadata": "^7.12.3",
|
|
39
43
|
"node-cache": "^5.1.2",
|
|
40
|
-
"pino": "^
|
|
41
|
-
"protobufjs": "^7.2
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
+
"pino": "^9.3.0",
|
|
45
|
+
"protobufjs": "^7.3.2",
|
|
46
|
+
"release-it": "^17.6.0",
|
|
47
|
+
"uuid": "^10.0.0",
|
|
48
|
+
"ws": "^8.18.0"
|
|
44
49
|
},
|
|
45
50
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@types/
|
|
48
|
-
"@types/
|
|
49
|
-
"@types/
|
|
50
|
-
"@types/
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"open": "^8.4.2",
|
|
51
|
+
"@types/got": "^9.6.12",
|
|
52
|
+
"@types/jest": "^29.5.12",
|
|
53
|
+
"@types/node": "^20.14.10",
|
|
54
|
+
"@types/sharp": "^0.31.1",
|
|
55
|
+
"@types/ws": "^8.5.11",
|
|
56
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
57
|
+
"eslint": "^9.7.0",
|
|
58
|
+
"jest": "^29.7.0",
|
|
59
|
+
"json": "^11.0.0",
|
|
60
|
+
"link-preview-js": "^3.0.5",
|
|
61
|
+
"open": "^10.1.0",
|
|
58
62
|
"qrcode-terminal": "^0.12.0",
|
|
59
|
-
"release-it": "^
|
|
60
|
-
"sharp": "^0.
|
|
61
|
-
"ts-jest": "^
|
|
62
|
-
"ts-node": "^10.
|
|
63
|
+
"release-it": "^17.6.0",
|
|
64
|
+
"sharp": "^0.33.4",
|
|
65
|
+
"ts-jest": "^29.2.2",
|
|
66
|
+
"ts-node": "^10.9.2",
|
|
63
67
|
"typedoc": "^0.24.7",
|
|
64
|
-
"typescript": "^4.6.4"
|
|
65
|
-
"json": "^11.0.0"
|
|
68
|
+
"typescript": "^4.6.4"
|
|
66
69
|
},
|
|
67
70
|
"peerDependencies": {
|
|
68
|
-
"jimp": "^0.
|
|
71
|
+
"jimp": "^0.22.12",
|
|
69
72
|
"link-preview-js": "^3.0.0",
|
|
70
73
|
"qrcode-terminal": "^0.12.0",
|
|
71
|
-
"sharp": "^0.32.
|
|
74
|
+
"sharp": "^0.32.6"
|
|
72
75
|
},
|
|
73
76
|
"peerDependenciesMeta": {
|
|
74
77
|
"jimp": {
|
|
@@ -92,10 +95,9 @@
|
|
|
92
95
|
"changelog:preview": "conventional-changelog -p angular -u",
|
|
93
96
|
"changelog:update": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
|
|
94
97
|
"example": "node --inspect -r ts-node/register Example/example.ts",
|
|
95
|
-
"example:mobile": "node --inspect -r ts-node/register Example/example.ts --mobile",
|
|
96
98
|
"gen:protobuf": "sh WAProto/GenerateStatics.sh",
|
|
97
|
-
"lint": "eslint src --ext .js,.ts
|
|
98
|
-
"lint:fix": "
|
|
99
|
+
"lint": "eslint src --ext .js,.ts",
|
|
100
|
+
"lint:fix": "yarn lint --fix",
|
|
99
101
|
"release": "release-it",
|
|
100
102
|
"test": "jest"
|
|
101
103
|
}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"93": 412,
|
|
3
|
-
"355": 276,
|
|
4
|
-
"213": 603,
|
|
5
|
-
"1-684": 544,
|
|
6
|
-
"376": 213,
|
|
7
|
-
"244": 631,
|
|
8
|
-
"1-264": 365,
|
|
9
|
-
"1-268": 344,
|
|
10
|
-
"54": 722,
|
|
11
|
-
"374": 283,
|
|
12
|
-
"297": 363,
|
|
13
|
-
"61": 505,
|
|
14
|
-
"43": 232,
|
|
15
|
-
"994": 400,
|
|
16
|
-
"1-242": 364,
|
|
17
|
-
"973": 426,
|
|
18
|
-
"880": 470,
|
|
19
|
-
"1-246": 342,
|
|
20
|
-
"375": 257,
|
|
21
|
-
"32": 206,
|
|
22
|
-
"501": 702,
|
|
23
|
-
"229": 616,
|
|
24
|
-
"1-441": 350,
|
|
25
|
-
"975": 402,
|
|
26
|
-
"591": 736,
|
|
27
|
-
"387": 218,
|
|
28
|
-
"267": 652,
|
|
29
|
-
"55": 724,
|
|
30
|
-
"1-284": 348,
|
|
31
|
-
"673": 528,
|
|
32
|
-
"359": 284,
|
|
33
|
-
"226": 613,
|
|
34
|
-
"257": 642,
|
|
35
|
-
"855": 456,
|
|
36
|
-
"237": 624,
|
|
37
|
-
"238": 625,
|
|
38
|
-
"1-345": 346,
|
|
39
|
-
"236": 623,
|
|
40
|
-
"235": 622,
|
|
41
|
-
"56": 730,
|
|
42
|
-
"86": 454,
|
|
43
|
-
"57": 732,
|
|
44
|
-
"269": 654,
|
|
45
|
-
"682": 548,
|
|
46
|
-
"506": 712,
|
|
47
|
-
"385": 219,
|
|
48
|
-
"53": 368,
|
|
49
|
-
"357": 280,
|
|
50
|
-
"420": 230,
|
|
51
|
-
"243": 630,
|
|
52
|
-
"45": 238,
|
|
53
|
-
"253": 638,
|
|
54
|
-
"1-767": 366,
|
|
55
|
-
"1-809": 370,
|
|
56
|
-
"1-849": 370,
|
|
57
|
-
"1-829": 370,
|
|
58
|
-
"593": 740,
|
|
59
|
-
"20": 602,
|
|
60
|
-
"503": 706,
|
|
61
|
-
"240": 627,
|
|
62
|
-
"291": 657,
|
|
63
|
-
"372": 248,
|
|
64
|
-
"251": 636,
|
|
65
|
-
"500": 750,
|
|
66
|
-
"298": 288,
|
|
67
|
-
"679": 542,
|
|
68
|
-
"358": 244,
|
|
69
|
-
"33": 208,
|
|
70
|
-
"689": 547,
|
|
71
|
-
"241": 628,
|
|
72
|
-
"220": 607,
|
|
73
|
-
"995": 282,
|
|
74
|
-
"49": 262,
|
|
75
|
-
"233": 620,
|
|
76
|
-
"350": 266,
|
|
77
|
-
"30": 202,
|
|
78
|
-
"299": 290,
|
|
79
|
-
"1-473": 352,
|
|
80
|
-
"1-671": 535,
|
|
81
|
-
"502": 704,
|
|
82
|
-
"224": 537,
|
|
83
|
-
"592": 738,
|
|
84
|
-
"509": 372,
|
|
85
|
-
"504": 708,
|
|
86
|
-
"852": 454,
|
|
87
|
-
"36": 216,
|
|
88
|
-
"354": 274,
|
|
89
|
-
"91": 404,
|
|
90
|
-
"62": 510,
|
|
91
|
-
"98": 432,
|
|
92
|
-
"964": 418,
|
|
93
|
-
"353": 234,
|
|
94
|
-
"972": 425,
|
|
95
|
-
"39": 222,
|
|
96
|
-
"225": 612,
|
|
97
|
-
"1-876": 338,
|
|
98
|
-
"81": 440,
|
|
99
|
-
"962": 416,
|
|
100
|
-
"254": 639,
|
|
101
|
-
"686": 545,
|
|
102
|
-
"383": 221,
|
|
103
|
-
"965": 419,
|
|
104
|
-
"371": 247,
|
|
105
|
-
"961": 415,
|
|
106
|
-
"266": 651,
|
|
107
|
-
"231": 618,
|
|
108
|
-
"218": 606,
|
|
109
|
-
"423": 295,
|
|
110
|
-
"370": 246,
|
|
111
|
-
"352": 270,
|
|
112
|
-
"389": 294,
|
|
113
|
-
"261": 646,
|
|
114
|
-
"265": 650,
|
|
115
|
-
"60": 502,
|
|
116
|
-
"960": 472,
|
|
117
|
-
"223": 610,
|
|
118
|
-
"356": 278,
|
|
119
|
-
"692": 551,
|
|
120
|
-
"222": 609,
|
|
121
|
-
"230": 617,
|
|
122
|
-
"52": 334,
|
|
123
|
-
"691": 550,
|
|
124
|
-
"373": 259,
|
|
125
|
-
"377": 212,
|
|
126
|
-
"976": 428,
|
|
127
|
-
"382": 297,
|
|
128
|
-
"1-664": 354,
|
|
129
|
-
"212": 604,
|
|
130
|
-
"258": 643,
|
|
131
|
-
"95": 414,
|
|
132
|
-
"264": 649,
|
|
133
|
-
"674": 536,
|
|
134
|
-
"977": 429,
|
|
135
|
-
"31": 204,
|
|
136
|
-
"687": 546,
|
|
137
|
-
"64": 530,
|
|
138
|
-
"505": 710,
|
|
139
|
-
"227": 614,
|
|
140
|
-
"234": 621,
|
|
141
|
-
"683": 555,
|
|
142
|
-
"1-670": 534,
|
|
143
|
-
"47": 242,
|
|
144
|
-
"968": 226,
|
|
145
|
-
"92": 410,
|
|
146
|
-
"680": 552,
|
|
147
|
-
"970": 423,
|
|
148
|
-
"507": 714,
|
|
149
|
-
"675": 537,
|
|
150
|
-
"595": 744,
|
|
151
|
-
"51": 716,
|
|
152
|
-
"63": 515,
|
|
153
|
-
"48": 260,
|
|
154
|
-
"351": 268,
|
|
155
|
-
"1-787, 1-939": 330,
|
|
156
|
-
"974": 427,
|
|
157
|
-
"242": 630,
|
|
158
|
-
"40": 226,
|
|
159
|
-
"7": 250,
|
|
160
|
-
"250": 635,
|
|
161
|
-
"290": 658,
|
|
162
|
-
"1-869": 356,
|
|
163
|
-
"1-758": 358,
|
|
164
|
-
"508": 308,
|
|
165
|
-
"1-784": 360,
|
|
166
|
-
"685": 544,
|
|
167
|
-
"378": 292,
|
|
168
|
-
"239": 626,
|
|
169
|
-
"966": 420,
|
|
170
|
-
"221": 608,
|
|
171
|
-
"381": 220,
|
|
172
|
-
"248": 633,
|
|
173
|
-
"232": 619,
|
|
174
|
-
"65": 525,
|
|
175
|
-
"386": 293,
|
|
176
|
-
"677": 540,
|
|
177
|
-
"27": 655,
|
|
178
|
-
"211": 659,
|
|
179
|
-
"34": 214,
|
|
180
|
-
"94": 413,
|
|
181
|
-
"249": 634,
|
|
182
|
-
"597": 746,
|
|
183
|
-
"268": 653,
|
|
184
|
-
"46": 240,
|
|
185
|
-
"41": 228,
|
|
186
|
-
"963": 417,
|
|
187
|
-
"886": 466,
|
|
188
|
-
"992": 436,
|
|
189
|
-
"255": 640,
|
|
190
|
-
"66": 520,
|
|
191
|
-
"228": 615,
|
|
192
|
-
"690": 554,
|
|
193
|
-
"676": 539,
|
|
194
|
-
"1-868": 374,
|
|
195
|
-
"216": 605,
|
|
196
|
-
"90": 286,
|
|
197
|
-
"993": 438,
|
|
198
|
-
"1-649": 376,
|
|
199
|
-
"688": 553,
|
|
200
|
-
"1-340": 332,
|
|
201
|
-
"256": 641,
|
|
202
|
-
"380": 255,
|
|
203
|
-
"971": 424,
|
|
204
|
-
"44": 234,
|
|
205
|
-
"1": 310,
|
|
206
|
-
"598": 748,
|
|
207
|
-
"998": 434,
|
|
208
|
-
"678": 541,
|
|
209
|
-
"379": 225,
|
|
210
|
-
"58": 734,
|
|
211
|
-
"681": 543,
|
|
212
|
-
"967": 421,
|
|
213
|
-
"260": 645,
|
|
214
|
-
"263": 648,
|
|
215
|
-
"670": 514,
|
|
216
|
-
"245": 632,
|
|
217
|
-
"856": 457,
|
|
218
|
-
"599": 362,
|
|
219
|
-
"850": 467,
|
|
220
|
-
"262": 647,
|
|
221
|
-
"82": 450,
|
|
222
|
-
"84": 452
|
|
223
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { Socket } from 'net';
|
|
3
|
-
import { AbstractSocketClient } from './abstract-socket-client';
|
|
4
|
-
export declare class MobileSocketClient extends AbstractSocketClient {
|
|
5
|
-
protected socket: Socket | null;
|
|
6
|
-
get isOpen(): boolean;
|
|
7
|
-
get isClosed(): boolean;
|
|
8
|
-
get isClosing(): boolean;
|
|
9
|
-
get isConnecting(): boolean;
|
|
10
|
-
connect(): Promise<void>;
|
|
11
|
-
close(): Promise<void>;
|
|
12
|
-
send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
|
|
13
|
-
}
|