@modzneverdie/baileys 17.1.13 → 17.1.18
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 +364 -0
- package/engine-requirements.js +4 -4
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +6 -4
- package/lib/Defaults/index.js +119 -78
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +2 -1
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.js +3 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -2
- package/lib/Socket/Client/{websocket.js → web-socket-client.js} +5 -54
- package/lib/Socket/business.d.ts +58 -59
- package/lib/Socket/chats.d.ts +230 -45
- package/lib/Socket/chats.js +238 -139
- package/lib/Socket/{setup.ts → dugong.d.ts} +52 -17
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/groups.d.ts +32 -41
- package/lib/Socket/groups.js +23 -38
- package/lib/Socket/index.d.ts +64 -63
- package/lib/Socket/index.js +3 -2
- package/lib/Socket/messages-recv.js +65 -9
- package/lib/Socket/messages-send.d.ts +47 -49
- package/lib/Socket/messages-send.js +399 -415
- package/lib/Socket/newsletter.d.ts +37 -39
- package/lib/Socket/newsletter.js +136 -71
- package/lib/Socket/registration.d.ts +267 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +10 -10
- package/lib/Socket/socket.js +619 -736
- package/lib/Socket/usync.d.ts +3 -3
- package/lib/Store/index.d.ts +2 -1
- package/lib/Store/index.js +3 -1
- package/lib/Store/make-cache-manager-store.d.ts +13 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +24 -24
- package/lib/Store/make-in-memory-store.js +14 -26
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Store/make-ordered-dictionary.js +2 -2
- package/lib/Types/Auth.d.ts +7 -0
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +7 -14
- package/lib/Types/Contact.d.ts +1 -5
- package/lib/Types/Events.d.ts +2 -44
- package/lib/Types/GroupMetadata.d.ts +2 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +21 -148
- package/lib/Types/Message.js +2 -0
- package/lib/Types/Newsletter.d.ts +97 -73
- package/lib/Types/Newsletter.js +38 -18
- package/lib/Types/Socket.d.ts +9 -17
- package/lib/Types/index.d.ts +1 -8
- package/lib/Types/index.js +2 -2
- package/lib/Utils/auth-utils.d.ts +3 -3
- package/lib/Utils/auth-utils.js +13 -6
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +16 -15
- package/lib/Utils/chat-utils.js +35 -36
- package/lib/Utils/crypto.d.ts +16 -15
- package/lib/Utils/crypto.js +29 -71
- package/lib/Utils/decode-wa-message.d.ts +6 -22
- package/lib/Utils/decode-wa-message.js +56 -65
- package/lib/Utils/event-buffer.d.ts +2 -2
- package/lib/Utils/event-buffer.js +7 -11
- package/lib/Utils/generics.d.ts +20 -17
- package/lib/Utils/generics.js +84 -102
- package/lib/Utils/history.d.ts +0 -4
- package/lib/Utils/history.js +6 -4
- package/lib/Utils/link-preview.d.ts +2 -2
- package/lib/Utils/link-preview.js +1 -34
- package/lib/Utils/logger.d.ts +3 -10
- package/lib/Utils/lt-hash.d.ts +2 -2
- package/lib/Utils/lt-hash.js +6 -6
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +24 -28
- package/lib/Utils/messages-media.js +236 -298
- package/lib/Utils/messages.d.ts +10 -8
- package/lib/Utils/messages.js +60 -304
- package/lib/Utils/noise-handler.d.ts +12 -10
- package/lib/Utils/noise-handler.js +23 -18
- package/lib/Utils/process-message.d.ts +4 -5
- package/lib/Utils/process-message.js +25 -89
- package/lib/Utils/signal.d.ts +1 -2
- package/lib/Utils/signal.js +26 -26
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +0 -6
- package/lib/Utils/validate-connection.d.ts +4 -3
- package/lib/Utils/validate-connection.js +76 -20
- package/lib/WABinary/constants.d.ts +27 -24
- package/lib/WABinary/constants.js +13 -1276
- package/lib/WABinary/decode.d.ts +4 -3
- package/lib/WABinary/decode.js +13 -26
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +152 -137
- package/lib/WABinary/generic-utils.d.ts +4 -1
- package/lib/WABinary/generic-utils.js +125 -37
- package/lib/WABinary/jid-utils.d.ts +5 -10
- package/lib/WABinary/jid-utils.js +5 -26
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +1 -1
- package/lib/index.d.ts +2 -6
- package/lib/index.js +5 -19
- package/package.json +105 -107
- package/WAProto/GenerateStatics.sh +0 -4
- package/WAProto/WAProto.proto +0 -4775
- package/WAProto/index.d.ts +0 -55057
- package/WAProto/index.ts.ts +0 -53473
- package/lib/Socket/setup.js +0 -433
- package/lib/WABinary/jid-utils.js.bak +0 -83
- /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
|
@@ -1,49 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.decryptMessageNode = exports.
|
|
4
|
-
exports.decodeMessageNode = decodeMessageNode;
|
|
3
|
+
exports.decryptMessageNode = exports.decodeMessageNode = void 0;
|
|
5
4
|
const boom_1 = require("@hapi/boom");
|
|
6
5
|
const WAProto_1 = require("../../WAProto");
|
|
7
6
|
const WABinary_1 = require("../WABinary");
|
|
8
7
|
const generics_1 = require("./generics");
|
|
9
|
-
|
|
10
|
-
exports.MISSING_KEYS_ERROR_TEXT = 'Key used already or never filled';
|
|
11
|
-
exports.NACK_REASONS = {
|
|
12
|
-
ParsingError: 487,
|
|
13
|
-
UnrecognizedStanza: 488,
|
|
14
|
-
UnrecognizedStanzaClass: 489,
|
|
15
|
-
UnrecognizedStanzaType: 490,
|
|
16
|
-
InvalidProtobuf: 491,
|
|
17
|
-
InvalidHostedCompanionStanza: 493,
|
|
18
|
-
MissingMessageSecret: 495,
|
|
19
|
-
SignalErrorOldCounter: 496,
|
|
20
|
-
MessageDeletedOnPeer: 499,
|
|
21
|
-
UnhandledError: 500,
|
|
22
|
-
UnsupportedAdminRevoke: 550,
|
|
23
|
-
UnsupportedLIDGroup: 551,
|
|
24
|
-
DBOperationFailed: 552
|
|
25
|
-
};
|
|
8
|
+
const NO_MESSAGE_FOUND_ERROR_TEXT = 'Message absent from node';
|
|
26
9
|
/**
|
|
27
10
|
* Decode the received node as a message.
|
|
28
11
|
* @note this will only parse the message, not decrypt it
|
|
29
12
|
*/
|
|
30
13
|
function decodeMessageNode(stanza, meId, meLid) {
|
|
31
|
-
var _a, _b
|
|
14
|
+
var _a, _b;
|
|
32
15
|
let msgType;
|
|
33
16
|
let chatId;
|
|
34
17
|
let author;
|
|
35
18
|
const msgId = stanza.attrs.id;
|
|
36
19
|
const from = stanza.attrs.from;
|
|
37
|
-
const senderPn = (_a = stanza === null || stanza === void 0 ? void 0 : stanza.attrs) === null || _a === void 0 ? void 0 : _a.sender_pn;
|
|
38
|
-
const senderLid = (_b = stanza === null || stanza === void 0 ? void 0 : stanza.attrs) === null || _b === void 0 ? void 0 : _b.sender_lid;
|
|
39
20
|
const participant = stanza.attrs.participant;
|
|
40
|
-
const participantLid = (_c = stanza === null || stanza === void 0 ? void 0 : stanza.attrs) === null || _c === void 0 ? void 0 : _c.participant_lid;
|
|
41
21
|
const recipient = stanza.attrs.recipient;
|
|
42
22
|
const isMe = (jid) => (0, WABinary_1.areJidsSameUser)(jid, meId);
|
|
43
23
|
const isMeLid = (jid) => (0, WABinary_1.areJidsSameUser)(jid, meLid);
|
|
44
|
-
if ((0, WABinary_1.isJidUser)(from)
|
|
45
|
-
if (recipient
|
|
46
|
-
if (!isMe(from)
|
|
24
|
+
if ((0, WABinary_1.isJidUser)(from)) {
|
|
25
|
+
if (recipient) {
|
|
26
|
+
if (!isMe(from)) {
|
|
27
|
+
throw new boom_1.Boom('receipient present, but msg not from me', { data: stanza });
|
|
28
|
+
}
|
|
29
|
+
chatId = recipient;
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
chatId = from;
|
|
33
|
+
}
|
|
34
|
+
msgType = 'chat';
|
|
35
|
+
author = from;
|
|
36
|
+
}
|
|
37
|
+
else if ((0, WABinary_1.isLidUser)(from)) {
|
|
38
|
+
if (recipient) {
|
|
39
|
+
if (!isMeLid(from)) {
|
|
47
40
|
throw new boom_1.Boom('receipient present, but msg not from me', { data: stanza });
|
|
48
41
|
}
|
|
49
42
|
chatId = recipient;
|
|
@@ -62,11 +55,6 @@ function decodeMessageNode(stanza, meId, meLid) {
|
|
|
62
55
|
author = participant;
|
|
63
56
|
chatId = from;
|
|
64
57
|
}
|
|
65
|
-
else if ((0, WABinary_1.isJidNewsletter)(from)) {
|
|
66
|
-
msgType = 'newsletter';
|
|
67
|
-
author = from;
|
|
68
|
-
chatId = from;
|
|
69
|
-
}
|
|
70
58
|
else if ((0, WABinary_1.isJidBroadcast)(from)) {
|
|
71
59
|
if (!participant) {
|
|
72
60
|
throw new boom_1.Boom('No participant in group message');
|
|
@@ -81,20 +69,21 @@ function decodeMessageNode(stanza, meId, meLid) {
|
|
|
81
69
|
chatId = from;
|
|
82
70
|
author = participant;
|
|
83
71
|
}
|
|
72
|
+
else if ((0, WABinary_1.isJidNewsLetter)(from)) {
|
|
73
|
+
msgType = 'newsletter';
|
|
74
|
+
author = from;
|
|
75
|
+
chatId = from;
|
|
76
|
+
}
|
|
84
77
|
else {
|
|
85
78
|
throw new boom_1.Boom('Unknown message type', { data: stanza });
|
|
86
79
|
}
|
|
87
|
-
const fromMe = (0, WABinary_1.
|
|
88
|
-
const pushname =
|
|
80
|
+
const fromMe = (0, WABinary_1.isJidNewsLetter)(from) ? !!((_a = stanza.attrs) === null || _a === void 0 ? void 0 : _a.is_sender) : ((0, WABinary_1.isLidUser)(from) ? isMeLid : isMe)(stanza.attrs.participant || stanza.attrs.from);
|
|
81
|
+
const pushname = stanza.attrs.notify;
|
|
89
82
|
const key = {
|
|
90
83
|
remoteJid: chatId,
|
|
91
84
|
fromMe,
|
|
92
85
|
id: msgId,
|
|
93
|
-
|
|
94
|
-
senderLid,
|
|
95
|
-
participant,
|
|
96
|
-
participantLid,
|
|
97
|
-
'server_id': (_f = stanza.attrs) === null || _f === void 0 ? void 0 : _f.server_id
|
|
86
|
+
participant
|
|
98
87
|
};
|
|
99
88
|
const fullMessage = {
|
|
100
89
|
key,
|
|
@@ -103,7 +92,7 @@ function decodeMessageNode(stanza, meId, meLid) {
|
|
|
103
92
|
broadcast: (0, WABinary_1.isJidBroadcast)(from)
|
|
104
93
|
};
|
|
105
94
|
if (msgType === 'newsletter') {
|
|
106
|
-
fullMessage.newsletterServerId = +((
|
|
95
|
+
fullMessage.newsletterServerId = +((_b = stanza.attrs) === null || _b === void 0 ? void 0 : _b.server_id);
|
|
107
96
|
}
|
|
108
97
|
if (key.fromMe) {
|
|
109
98
|
fullMessage.status = WAProto_1.proto.WebMessageInfo.Status.SERVER_ACK;
|
|
@@ -114,6 +103,7 @@ function decodeMessageNode(stanza, meId, meLid) {
|
|
|
114
103
|
sender: msgType === 'chat' ? author : chatId
|
|
115
104
|
};
|
|
116
105
|
}
|
|
106
|
+
exports.decodeMessageNode = decodeMessageNode;
|
|
117
107
|
const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
118
108
|
const { fullMessage, author, sender } = decodeMessageNode(stanza, meId, meLid);
|
|
119
109
|
return {
|
|
@@ -123,17 +113,34 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
123
113
|
async decrypt() {
|
|
124
114
|
var _a;
|
|
125
115
|
let decryptables = 0;
|
|
126
|
-
|
|
116
|
+
async function processSenderKeyDistribution(msg) {
|
|
117
|
+
if (msg.senderKeyDistributionMessage) {
|
|
118
|
+
try {
|
|
119
|
+
await repository.processSenderKeyDistributionMessage({
|
|
120
|
+
authorJid: author,
|
|
121
|
+
item: msg.senderKeyDistributionMessage
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
logger.error({ key: fullMessage.key, err }, 'failed to process senderKeyDistribution');
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
if ((0, WABinary_1.isJidNewsLetter)(fullMessage.key.remoteJid)) {
|
|
130
|
+
const node = (0, WABinary_1.getBinaryNodeChild)(stanza, 'plaintext');
|
|
131
|
+
const msg = WAProto_1.proto.Message.decode(node === null || node === void 0 ? void 0 : node.content);
|
|
132
|
+
await processSenderKeyDistribution(msg);
|
|
133
|
+
fullMessage.message = msg;
|
|
134
|
+
decryptables += 1;
|
|
135
|
+
}
|
|
136
|
+
else if (Array.isArray(stanza.content)) {
|
|
127
137
|
for (const { tag, attrs, content } of stanza.content) {
|
|
128
138
|
if (tag === 'verified_name' && content instanceof Uint8Array) {
|
|
129
139
|
const cert = WAProto_1.proto.VerifiedNameCertificate.decode(content);
|
|
130
140
|
const details = WAProto_1.proto.VerifiedNameCertificate.Details.decode(cert.details);
|
|
131
141
|
fullMessage.verifiedBizName = details.verifiedName;
|
|
132
142
|
}
|
|
133
|
-
if (tag
|
|
134
|
-
fullMessage.key.isViewOnce = true;
|
|
135
|
-
}
|
|
136
|
-
if (tag !== 'enc' && tag !== 'plaintext') {
|
|
143
|
+
if (tag !== 'enc') {
|
|
137
144
|
continue;
|
|
138
145
|
}
|
|
139
146
|
if (!(content instanceof Uint8Array)) {
|
|
@@ -142,7 +149,7 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
142
149
|
decryptables += 1;
|
|
143
150
|
let msgBuffer;
|
|
144
151
|
try {
|
|
145
|
-
const e2eType =
|
|
152
|
+
const e2eType = attrs.type;
|
|
146
153
|
switch (e2eType) {
|
|
147
154
|
case 'skmsg':
|
|
148
155
|
msgBuffer = await repository.decryptGroupMessage({
|
|
@@ -160,28 +167,12 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
160
167
|
ciphertext: content
|
|
161
168
|
});
|
|
162
169
|
break;
|
|
163
|
-
case 'plaintext':
|
|
164
|
-
msgBuffer = content;
|
|
165
|
-
break;
|
|
166
|
-
case undefined:
|
|
167
|
-
msgBuffer = content;
|
|
168
|
-
break;
|
|
169
170
|
default:
|
|
170
171
|
throw new Error(`Unknown e2e type: ${e2eType}`);
|
|
171
172
|
}
|
|
172
|
-
let msg = WAProto_1.proto.Message.decode(
|
|
173
|
-
msg = ((_a = msg
|
|
174
|
-
|
|
175
|
-
try {
|
|
176
|
-
await repository.processSenderKeyDistributionMessage({
|
|
177
|
-
authorJid: author,
|
|
178
|
-
item: msg.senderKeyDistributionMessage
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
catch (err) {
|
|
182
|
-
logger.error({ key: fullMessage.key, err }, 'failed to decrypt message');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
173
|
+
let msg = WAProto_1.proto.Message.decode((0, generics_1.unpadRandomMax16)(msgBuffer));
|
|
174
|
+
msg = ((_a = msg.deviceSentMessage) === null || _a === void 0 ? void 0 : _a.message) || msg;
|
|
175
|
+
await processSenderKeyDistribution(msg);
|
|
185
176
|
if (fullMessage.message) {
|
|
186
177
|
Object.assign(fullMessage.message, msg);
|
|
187
178
|
}
|
|
@@ -199,7 +190,7 @@ const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
|
199
190
|
// if nothing was found to decrypt
|
|
200
191
|
if (!decryptables) {
|
|
201
192
|
fullMessage.messageStubType = WAProto_1.proto.WebMessageInfo.StubType.CIPHERTEXT;
|
|
202
|
-
fullMessage.messageStubParameters = [
|
|
193
|
+
fullMessage.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT, JSON.stringify(stanza, generics_1.BufferJSON.replacer)];
|
|
203
194
|
}
|
|
204
195
|
}
|
|
205
196
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { Logger } from 'pino';
|
|
1
2
|
import { BaileysEventEmitter, BaileysEventMap } from '../Types';
|
|
2
|
-
import { ILogger } from './logger';
|
|
3
3
|
/**
|
|
4
4
|
* A map that contains a list of all events that have been triggered
|
|
5
5
|
*
|
|
@@ -31,5 +31,5 @@ type BaileysBufferableEventEmitter = BaileysEventEmitter & {
|
|
|
31
31
|
* making the data processing more efficient.
|
|
32
32
|
* @param ev the baileys event emitter
|
|
33
33
|
*/
|
|
34
|
-
export declare const makeEventBuffer: (logger:
|
|
34
|
+
export declare const makeEventBuffer: (logger: Logger) => BaileysBufferableEventEmitter;
|
|
35
35
|
export {};
|
|
@@ -176,9 +176,6 @@ function append(data, historyCache, event, eventData, logger) {
|
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
178
|
data.historySets.empty = false;
|
|
179
|
-
data.historySets.syncType = eventData.syncType;
|
|
180
|
-
data.historySets.progress = eventData.progress;
|
|
181
|
-
data.historySets.peerDataRequestSessionId = eventData.peerDataRequestSessionId;
|
|
182
179
|
data.historySets.isLatest = eventData.isLatest || data.historySets.isLatest;
|
|
183
180
|
break;
|
|
184
181
|
case 'chats.upsert':
|
|
@@ -445,10 +442,7 @@ function consolidateEvents(data) {
|
|
|
445
442
|
chats: Object.values(data.historySets.chats),
|
|
446
443
|
messages: Object.values(data.historySets.messages),
|
|
447
444
|
contacts: Object.values(data.historySets.contacts),
|
|
448
|
-
|
|
449
|
-
progress: data.historySets.progress,
|
|
450
|
-
isLatest: data.historySets.isLatest,
|
|
451
|
-
peerDataRequestSessionId: data.historySets.peerDataRequestSessionId
|
|
445
|
+
isLatest: data.historySets.isLatest
|
|
452
446
|
};
|
|
453
447
|
}
|
|
454
448
|
const chatUpsertList = Object.values(data.chatUpserts);
|
|
@@ -502,10 +496,12 @@ function consolidateEvents(data) {
|
|
|
502
496
|
return map;
|
|
503
497
|
}
|
|
504
498
|
function concatChats(a, b) {
|
|
505
|
-
if (b.unreadCount === null
|
|
506
|
-
|
|
507
|
-
a.unreadCount
|
|
508
|
-
|
|
499
|
+
if (b.unreadCount === null) {
|
|
500
|
+
// neutralize unread counter
|
|
501
|
+
if (a.unreadCount < 0) {
|
|
502
|
+
a.unreadCount = undefined;
|
|
503
|
+
b.unreadCount = undefined;
|
|
504
|
+
}
|
|
509
505
|
}
|
|
510
506
|
if (typeof a.unreadCount === 'number' && typeof b.unreadCount === 'number') {
|
|
511
507
|
b = { ...b };
|
package/lib/Utils/generics.d.ts
CHANGED
|
@@ -1,21 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import {
|
|
3
|
+
import { Logger } from 'pino';
|
|
3
4
|
import { proto } from '../../WAProto';
|
|
4
|
-
import { BaileysEventEmitter, BaileysEventMap,
|
|
5
|
+
import { BaileysEventEmitter, BaileysEventMap, WACallUpdateType, WAVersion } from '../Types';
|
|
5
6
|
import { BinaryNode } from '../WABinary';
|
|
6
|
-
export declare const Browsers:
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
export declare const Browsers: {
|
|
8
|
+
ubuntu: (browser: any) => [string, string, string];
|
|
9
|
+
macOS: (browser: any) => [string, string, string];
|
|
10
|
+
baileys: (browser: any) => [string, string, string];
|
|
11
|
+
windows: (browser: any) => [string, string, string];
|
|
12
|
+
/** The appropriate browser based on your OS & release */
|
|
13
|
+
appropriate: (browser: any) => [string, string, string];
|
|
11
14
|
};
|
|
15
|
+
export declare const getPlatformId: (browser: string) => any;
|
|
12
16
|
export declare const getKeyAuthor: (key: proto.IMessageKey | undefined | null, meId?: string) => string;
|
|
13
|
-
export declare const writeRandomPadMax16: (msg: Uint8Array) => Buffer
|
|
14
|
-
export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array
|
|
15
|
-
export declare const encodeWAMessage: (message: proto.IMessage) => Buffer
|
|
16
|
-
export declare const encodeNewsletterMessage: (message: proto.IMessage) => Uint8Array<ArrayBufferLike>;
|
|
17
|
+
export declare const writeRandomPadMax16: (msg: Uint8Array) => Buffer;
|
|
18
|
+
export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array;
|
|
19
|
+
export declare const encodeWAMessage: (message: proto.IMessage) => Buffer;
|
|
17
20
|
export declare const generateRegistrationId: () => number;
|
|
18
|
-
export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array
|
|
21
|
+
export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array;
|
|
19
22
|
export declare const toNumber: (t: Long | number | null | undefined) => number;
|
|
20
23
|
/** unix timestamp of a date in seconds */
|
|
21
24
|
export declare const unixTimestampSeconds: (date?: Date) => number;
|
|
@@ -34,9 +37,9 @@ export declare const delayCancellable: (ms: number) => {
|
|
|
34
37
|
export declare function promiseTimeout<T>(ms: number | undefined, promise: (resolve: (v: T) => void, reject: (error: any) => void) => void): Promise<T>;
|
|
35
38
|
export declare const generateMessageIDV2: (userId?: string) => string;
|
|
36
39
|
export declare const generateMessageID: () => string;
|
|
37
|
-
export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) =>
|
|
38
|
-
export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<import("../Types").ConnectionState>) =>
|
|
39
|
-
export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger:
|
|
40
|
+
export declare function bindWaitForEvent<T extends keyof BaileysEventMap>(ev: BaileysEventEmitter, event: T): (check: (u: BaileysEventMap[T]) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
41
|
+
export declare const bindWaitForConnectionUpdate: (ev: BaileysEventEmitter) => (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
|
42
|
+
export declare const printQRIfNecessaryListener: (ev: BaileysEventEmitter, logger: Logger) => void;
|
|
40
43
|
/**
|
|
41
44
|
* utility that fetches latest baileys version from the master branch.
|
|
42
45
|
* Use to ensure your WA connection is always on the latest version
|
|
@@ -54,7 +57,7 @@ export declare const fetchLatestBaileysVersion: (options?: AxiosRequestConfig<an
|
|
|
54
57
|
* A utility that fetches the latest web version of whatsapp.
|
|
55
58
|
* Use to ensure your WA connection is always on the latest version
|
|
56
59
|
*/
|
|
57
|
-
export declare const fetchLatestWaWebVersion: (options: AxiosRequestConfig<
|
|
60
|
+
export declare const fetchLatestWaWebVersion: (options: AxiosRequestConfig<any>) => Promise<{
|
|
58
61
|
version: WAVersion;
|
|
59
62
|
isLatest: boolean;
|
|
60
63
|
error?: undefined;
|
|
@@ -84,6 +87,6 @@ export declare const getCodeFromWSError: (error: Error) => number;
|
|
|
84
87
|
* Is the given platform WA business
|
|
85
88
|
* @param platform AuthenticationCreds.platform
|
|
86
89
|
*/
|
|
87
|
-
export declare const isWABusinessPlatform: (platform: string) =>
|
|
90
|
+
export declare const isWABusinessPlatform: (platform: string) => boolean;
|
|
88
91
|
export declare function trimUndefined(obj: any): any;
|
|
89
92
|
export declare function bytesToCrockford(buffer: Buffer): string;
|
package/lib/Utils/generics.js
CHANGED
|
@@ -1,61 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
1
|
+
"use strict";
|
|
35
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
4
|
};
|
|
38
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.generateMessageID = exports.generateMessageIDV2 = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.
|
|
40
|
-
exports.promiseTimeout = promiseTimeout;
|
|
41
|
-
exports.bindWaitForEvent = bindWaitForEvent;
|
|
42
|
-
exports.trimUndefined = trimUndefined;
|
|
43
|
-
exports.bytesToCrockford = bytesToCrockford;
|
|
6
|
+
exports.bytesToCrockford = exports.trimUndefined = exports.isWABusinessPlatform = exports.getCodeFromWSError = exports.getCallStatusFromNode = exports.getErrorCodeFromStreamError = exports.getStatusFromReceiptType = exports.generateMdTagPrefix = exports.fetchLatestWaWebVersion = exports.fetchLatestBaileysVersion = exports.printQRIfNecessaryListener = exports.bindWaitForConnectionUpdate = exports.bindWaitForEvent = exports.generateMessageID = exports.generateMessageIDV2 = exports.promiseTimeout = exports.delayCancellable = exports.delay = exports.debouncedTimeout = exports.unixTimestampSeconds = exports.toNumber = exports.encodeBigEndian = exports.generateRegistrationId = exports.encodeWAMessage = exports.unpadRandomMax16 = exports.writeRandomPadMax16 = exports.getKeyAuthor = exports.BufferJSON = exports.Browsers = void 0;
|
|
44
7
|
const boom_1 = require("@hapi/boom");
|
|
45
8
|
const axios_1 = __importDefault(require("axios"));
|
|
46
9
|
const crypto_1 = require("crypto");
|
|
47
10
|
const os_1 = require("os");
|
|
11
|
+
const fetch_1 = require("node-fetch")
|
|
48
12
|
const WAProto_1 = require("../../WAProto");
|
|
49
13
|
const baileys_version_json_1 = require("../Defaults/baileys-version.json");
|
|
50
14
|
const Types_1 = require("../Types");
|
|
51
15
|
const WABinary_1 = require("../WABinary");
|
|
52
|
-
const
|
|
53
|
-
'Chrome': '49',
|
|
54
|
-
'Edge': '50',
|
|
55
|
-
'Firefox': '51',
|
|
56
|
-
'Opera': '53',
|
|
57
|
-
'Safari': '54'
|
|
58
|
-
};
|
|
16
|
+
const baileysVersion = [2, 3000, 1027934701]
|
|
59
17
|
const PLATFORM_MAP = {
|
|
60
18
|
'aix': 'AIX',
|
|
61
19
|
'darwin': 'Mac OS',
|
|
@@ -63,19 +21,21 @@ const PLATFORM_MAP = {
|
|
|
63
21
|
'android': 'Android',
|
|
64
22
|
'freebsd': 'FreeBSD',
|
|
65
23
|
'openbsd': 'OpenBSD',
|
|
66
|
-
'sunos': 'Solaris'
|
|
24
|
+
'sunos': 'Solaris',
|
|
25
|
+
'linux': undefined,
|
|
26
|
+
'haiku': undefined,
|
|
27
|
+
'cygwin': undefined,
|
|
28
|
+
'netbsd': undefined
|
|
67
29
|
};
|
|
68
|
-
exports.Browsers = {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
windows: (browser) => ['Windows', browser, '10.0.22631'],
|
|
73
|
-
/** The appropriate browser based on your OS & release */
|
|
74
|
-
appropriate: (browser) => [PLATFORM_MAP[(0, os_1.platform)()] || 'Ubuntu', browser, (0, os_1.release)()]
|
|
30
|
+
exports.Browsers = (browser) => {
|
|
31
|
+
const osName = PLATFORM_MAP[os_1.platform()] || 'Ubuntu';
|
|
32
|
+
const osRelease = os_1.release();
|
|
33
|
+
return [osName, browser, osRelease];
|
|
75
34
|
};
|
|
35
|
+
|
|
76
36
|
const getPlatformId = (browser) => {
|
|
77
37
|
const platformType = WAProto_1.proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
78
|
-
return platformType ? platformType.toString() : '
|
|
38
|
+
return platformType ? platformType.toString() : '1'; //chrome
|
|
79
39
|
};
|
|
80
40
|
exports.getPlatformId = getPlatformId;
|
|
81
41
|
exports.BufferJSON = {
|
|
@@ -118,8 +78,6 @@ const unpadRandomMax16 = (e) => {
|
|
|
118
78
|
exports.unpadRandomMax16 = unpadRandomMax16;
|
|
119
79
|
const encodeWAMessage = (message) => ((0, exports.writeRandomPadMax16)(WAProto_1.proto.Message.encode(message).finish()));
|
|
120
80
|
exports.encodeWAMessage = encodeWAMessage;
|
|
121
|
-
const encodeNewsletterMessage = (message) => (WAProto_1.proto.Message.encode(message).finish());
|
|
122
|
-
exports.encodeNewsletterMessage = encodeNewsletterMessage;
|
|
123
81
|
const generateRegistrationId = () => {
|
|
124
82
|
return Uint16Array.from((0, crypto_1.randomBytes)(2))[0] & 16383;
|
|
125
83
|
};
|
|
@@ -134,7 +92,7 @@ const encodeBigEndian = (e, t = 4) => {
|
|
|
134
92
|
return a;
|
|
135
93
|
};
|
|
136
94
|
exports.encodeBigEndian = encodeBigEndian;
|
|
137
|
-
const toNumber = (t) => ((typeof t === 'object' && t) ? ('toNumber' in t ? t.toNumber() : t.low) : t
|
|
95
|
+
const toNumber = (t) => ((typeof t === 'object' && t) ? ('toNumber' in t ? t.toNumber() : t.low) : t);
|
|
138
96
|
exports.toNumber = toNumber;
|
|
139
97
|
/** unix timestamp of a date in seconds */
|
|
140
98
|
const unixTimestampSeconds = (date = new Date()) => Math.floor(date.getTime() / 1000);
|
|
@@ -200,6 +158,7 @@ async function promiseTimeout(ms, promise) {
|
|
|
200
158
|
.finally(cancel);
|
|
201
159
|
return p;
|
|
202
160
|
}
|
|
161
|
+
exports.promiseTimeout = promiseTimeout;
|
|
203
162
|
const generateMessageIDV2 = (userId) => {
|
|
204
163
|
const data = Buffer.alloc(8 + 20 + 16);
|
|
205
164
|
data.writeBigUInt64BE(BigInt(Math.floor(Date.now() / 1000)));
|
|
@@ -217,7 +176,7 @@ const generateMessageIDV2 = (userId) => {
|
|
|
217
176
|
};
|
|
218
177
|
exports.generateMessageIDV2 = generateMessageIDV2;
|
|
219
178
|
// generate a random ID to attach to a message
|
|
220
|
-
const generateMessageID = () => '
|
|
179
|
+
const generateMessageID = () => 'ILSYM-' + (0, crypto_1.randomBytes)(6).toString('hex').toUpperCase();
|
|
221
180
|
exports.generateMessageID = generateMessageID;
|
|
222
181
|
function bindWaitForEvent(ev, event) {
|
|
223
182
|
return async (check, timeoutMs) => {
|
|
@@ -231,8 +190,8 @@ function bindWaitForEvent(ev, event) {
|
|
|
231
190
|
}
|
|
232
191
|
};
|
|
233
192
|
ev.on('connection.update', closeListener);
|
|
234
|
-
listener =
|
|
235
|
-
if (
|
|
193
|
+
listener = (update) => {
|
|
194
|
+
if (check(update)) {
|
|
236
195
|
resolve();
|
|
237
196
|
}
|
|
238
197
|
};
|
|
@@ -244,12 +203,14 @@ function bindWaitForEvent(ev, event) {
|
|
|
244
203
|
}));
|
|
245
204
|
};
|
|
246
205
|
}
|
|
206
|
+
exports.bindWaitForEvent = bindWaitForEvent;
|
|
247
207
|
const bindWaitForConnectionUpdate = (ev) => bindWaitForEvent(ev, 'connection.update');
|
|
248
208
|
exports.bindWaitForConnectionUpdate = bindWaitForConnectionUpdate;
|
|
249
209
|
const printQRIfNecessaryListener = (ev, logger) => {
|
|
250
210
|
ev.on('connection.update', async ({ qr }) => {
|
|
251
211
|
if (qr) {
|
|
252
|
-
const QR = await
|
|
212
|
+
const QR = await import('qrcode-terminal')
|
|
213
|
+
.then(m => m.default || m)
|
|
253
214
|
.catch(() => {
|
|
254
215
|
logger.error('QR code terminal not added as dependency');
|
|
255
216
|
});
|
|
@@ -258,8 +219,61 @@ const printQRIfNecessaryListener = (ev, logger) => {
|
|
|
258
219
|
});
|
|
259
220
|
};
|
|
260
221
|
exports.printQRIfNecessaryListener = printQRIfNecessaryListener;
|
|
222
|
+
/**
|
|
223
|
+
* utility that fetches latest baileys version from the master branch.
|
|
224
|
+
* Use to ensure your WA connection is always on the latest version
|
|
225
|
+
*/
|
|
226
|
+
const fetchLatestWaWebVersion = async (options = {}) => {
|
|
227
|
+
try {
|
|
228
|
+
const defaultHeaders = {
|
|
229
|
+
'User-Agent':
|
|
230
|
+
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
|
|
231
|
+
'Accept': '*/*'
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const headers = { ...defaultHeaders, ...options.headers }
|
|
235
|
+
|
|
236
|
+
const response = await fetch_1('https://web.whatsapp.com/sw.js', {
|
|
237
|
+
method: 'GET',
|
|
238
|
+
headers
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
if (!response.ok) {
|
|
242
|
+
throw new Error(`Failed to fetch sw.js: ${response.status} ${response.statusText}`)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const data = await response.text()
|
|
246
|
+
const regex = /"client_revision":\s*(\d+)/ // regex cukup begini untuk Node
|
|
247
|
+
const match = data.match(regex)
|
|
248
|
+
|
|
249
|
+
if (!match || !match[1]) {
|
|
250
|
+
return {
|
|
251
|
+
version: baileysVersion,
|
|
252
|
+
isLatest: false,
|
|
253
|
+
error: { message: 'Client revision not found' }
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const clientRevision = match[1]
|
|
258
|
+
return {
|
|
259
|
+
version: [2, 3000, +clientRevision],
|
|
260
|
+
isLatest: true
|
|
261
|
+
}
|
|
262
|
+
} catch (error) {
|
|
263
|
+
return {
|
|
264
|
+
version: baileysVersion,
|
|
265
|
+
isLatest: false,
|
|
266
|
+
error
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
exports.fetchLatestWaWebVersion = fetchLatestWaWebVersion;
|
|
271
|
+
/**
|
|
272
|
+
* utility that fetches latest baileys version from the master branch.
|
|
273
|
+
* Use to ensure your WA connection is always on the latest version
|
|
274
|
+
*/
|
|
261
275
|
const fetchLatestBaileysVersion = async (options = {}) => {
|
|
262
|
-
const URL = 'https://
|
|
276
|
+
const URL = 'https://raw.githubusercontent.com/kiuur/bails/master/src/Defaults/baileys-version.json';
|
|
263
277
|
try {
|
|
264
278
|
const result = await axios_1.default.get(URL, {
|
|
265
279
|
...options,
|
|
@@ -279,42 +293,6 @@ const fetchLatestBaileysVersion = async (options = {}) => {
|
|
|
279
293
|
}
|
|
280
294
|
};
|
|
281
295
|
exports.fetchLatestBaileysVersion = fetchLatestBaileysVersion;
|
|
282
|
-
/**
|
|
283
|
-
* A utility that fetches the latest web version of whatsapp.
|
|
284
|
-
* Use to ensure your WA connection is always on the latest version
|
|
285
|
-
*/
|
|
286
|
-
const fetchLatestWaWebVersion = async (options) => {
|
|
287
|
-
try {
|
|
288
|
-
const { data } = await axios_1.default.get('https://web.whatsapp.com/sw.js', {
|
|
289
|
-
...options,
|
|
290
|
-
responseType: 'json'
|
|
291
|
-
});
|
|
292
|
-
const regex = /\\?"client_revision\\?":\s*(\d+)/;
|
|
293
|
-
const match = data.match(regex);
|
|
294
|
-
if (!(match === null || match === void 0 ? void 0 : match[1])) {
|
|
295
|
-
return {
|
|
296
|
-
version: baileys_version_json_1.version,
|
|
297
|
-
isLatest: false,
|
|
298
|
-
error: {
|
|
299
|
-
message: 'Could not find client revision in the fetched content'
|
|
300
|
-
}
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
const clientRevision = match[1];
|
|
304
|
-
return {
|
|
305
|
-
version: [2, 3000, +clientRevision],
|
|
306
|
-
isLatest: true
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
catch (error) {
|
|
310
|
-
return {
|
|
311
|
-
version: baileys_version_json_1.version,
|
|
312
|
-
isLatest: false,
|
|
313
|
-
error
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
exports.fetchLatestWaWebVersion = fetchLatestWaWebVersion;
|
|
318
296
|
/** unique message tag prefix for MD clients */
|
|
319
297
|
const generateMdTagPrefix = () => {
|
|
320
298
|
const bytes = (0, crypto_1.randomBytes)(4);
|
|
@@ -322,7 +300,6 @@ const generateMdTagPrefix = () => {
|
|
|
322
300
|
};
|
|
323
301
|
exports.generateMdTagPrefix = generateMdTagPrefix;
|
|
324
302
|
const STATUS_MAP = {
|
|
325
|
-
'sender': WAProto_1.proto.WebMessageInfo.Status.SERVER_ACK,
|
|
326
303
|
'played': WAProto_1.proto.WebMessageInfo.Status.PLAYED,
|
|
327
304
|
'read': WAProto_1.proto.WebMessageInfo.Status.READ,
|
|
328
305
|
'read-self': WAProto_1.proto.WebMessageInfo.Status.READ
|
|
@@ -371,8 +348,7 @@ const getCallStatusFromNode = ({ tag, attrs }) => {
|
|
|
371
348
|
status = 'timeout';
|
|
372
349
|
}
|
|
373
350
|
else {
|
|
374
|
-
|
|
375
|
-
status = 'terminate';
|
|
351
|
+
status = 'reject';
|
|
376
352
|
}
|
|
377
353
|
break;
|
|
378
354
|
case 'reject':
|
|
@@ -421,6 +397,7 @@ function trimUndefined(obj) {
|
|
|
421
397
|
}
|
|
422
398
|
return obj;
|
|
423
399
|
}
|
|
400
|
+
exports.trimUndefined = trimUndefined;
|
|
424
401
|
const CROCKFORD_CHARACTERS = '123456789ABCDEFGHJKLMNPQRSTVWXYZ';
|
|
425
402
|
function bytesToCrockford(buffer) {
|
|
426
403
|
let value = 0;
|
|
@@ -439,3 +416,8 @@ function bytesToCrockford(buffer) {
|
|
|
439
416
|
}
|
|
440
417
|
return crockford.join('');
|
|
441
418
|
}
|
|
419
|
+
exports.bytesToCrockford = bytesToCrockford;
|
|
420
|
+
const encodeNewsletterMessage = (message) => {
|
|
421
|
+
return WAProto_1.proto.Message.encode(message).finish()
|
|
422
|
+
}
|
|
423
|
+
exports.encodeNewsletterMessage = encodeNewsletterMessage;
|
package/lib/Utils/history.d.ts
CHANGED
|
@@ -6,14 +6,10 @@ export declare const processHistoryMessage: (item: proto.IHistorySync) => {
|
|
|
6
6
|
chats: Chat[];
|
|
7
7
|
contacts: Contact[];
|
|
8
8
|
messages: proto.IWebMessageInfo[];
|
|
9
|
-
syncType: proto.HistorySync.HistorySyncType;
|
|
10
|
-
progress: number | null | undefined;
|
|
11
9
|
};
|
|
12
10
|
export declare const downloadAndProcessHistorySyncNotification: (msg: proto.Message.IHistorySyncNotification, options: AxiosRequestConfig<any>) => Promise<{
|
|
13
11
|
chats: Chat[];
|
|
14
12
|
contacts: Contact[];
|
|
15
13
|
messages: proto.IWebMessageInfo[];
|
|
16
|
-
syncType: proto.HistorySync.HistorySyncType;
|
|
17
|
-
progress: number | null | undefined;
|
|
18
14
|
}>;
|
|
19
15
|
export declare const getHistoryMsg: (message: proto.IMessage) => proto.Message.IHistorySyncNotification | null | undefined;
|