@queenanya/baileys 8.2.7-beta → 8.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/WAProto/index.d.ts +1590 -6
  2. package/WAProto/index.js +4635 -3
  3. package/engine-requirements.js +1 -1
  4. package/lib/Defaults/baileys-version.json +1 -1
  5. package/lib/Defaults/index.d.ts +232 -1
  6. package/lib/Defaults/index.js +21 -6
  7. package/lib/Defaults/phonenumber-mcc.json +223 -0
  8. package/lib/Socket/Client/index.d.ts +3 -2
  9. package/lib/Socket/Client/index.js +3 -2
  10. package/lib/Socket/Client/mobile-socket-client.d.ts +12 -0
  11. package/lib/Socket/Client/mobile-socket-client.js +65 -0
  12. package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
  13. package/lib/Socket/Client/{websocket.js → web-socket-client.js} +3 -3
  14. package/lib/Socket/business.d.ts +4 -9
  15. package/lib/Socket/chats.d.ts +3 -9
  16. package/lib/Socket/chats.js +6 -89
  17. package/lib/Socket/groups.d.ts +3 -7
  18. package/lib/Socket/groups.js +13 -9
  19. package/lib/Socket/index.d.ts +6 -9
  20. package/lib/Socket/index.js +2 -2
  21. package/lib/Socket/messages-recv.d.ts +4 -9
  22. package/lib/Socket/messages-recv.js +13 -23
  23. package/lib/Socket/messages-send.d.ts +3 -8
  24. package/lib/Socket/messages-send.js +55 -86
  25. package/lib/Socket/newsletter.d.ts +3 -7
  26. package/lib/Socket/newsletter.js +2 -4
  27. package/lib/Socket/registration.d.ts +266 -0
  28. package/lib/Socket/registration.js +166 -0
  29. package/lib/Socket/socket.d.ts +1 -2
  30. package/lib/Socket/socket.js +15 -10
  31. package/lib/Socket/usync.d.ts +1 -1
  32. package/lib/Socket/usync.js +15 -10
  33. package/lib/Store/make-in-memory-store.js +10 -8
  34. package/lib/Types/Auth.d.ts +6 -0
  35. package/lib/Types/Chat.d.ts +2 -8
  36. package/lib/Types/Contact.d.ts +4 -5
  37. package/lib/Types/GroupMetadata.d.ts +4 -3
  38. package/lib/Types/Label.d.ts +0 -11
  39. package/lib/Types/Message.d.ts +5 -5
  40. package/lib/Types/Socket.d.ts +3 -5
  41. package/lib/Utils/auth-utils.js +7 -0
  42. package/lib/Utils/chat-utils.d.ts +8 -8
  43. package/lib/Utils/chat-utils.js +4 -30
  44. package/lib/Utils/crypto.d.ts +1 -1
  45. package/lib/Utils/crypto.js +1 -3
  46. package/lib/Utils/decode-wa-message.d.ts +2 -4
  47. package/lib/Utils/decode-wa-message.js +18 -161
  48. package/lib/Utils/event-buffer.js +6 -4
  49. package/lib/Utils/generics.d.ts +18 -8
  50. package/lib/Utils/generics.js +93 -7
  51. package/lib/Utils/history.js +1 -1
  52. package/lib/Utils/messages-media.d.ts +9 -16
  53. package/lib/Utils/messages-media.js +175 -88
  54. package/lib/Utils/messages.d.ts +1 -1
  55. package/lib/Utils/messages.js +17 -15
  56. package/lib/Utils/noise-handler.d.ts +2 -1
  57. package/lib/Utils/noise-handler.js +10 -5
  58. package/lib/Utils/validate-connection.d.ts +1 -0
  59. package/lib/Utils/validate-connection.js +50 -16
  60. package/lib/WABinary/constants.d.ts +4 -4
  61. package/lib/WABinary/constants.js +1271 -8
  62. package/lib/WABinary/encode.js +5 -7
  63. package/lib/WABinary/jid-utils.d.ts +4 -4
  64. package/lib/WABinary/jid-utils.js +19 -19
  65. package/lib/WAM/constants.d.ts +2 -3
  66. package/lib/WAM/encode.js +2 -2
  67. package/lib/WAUSync/Protocols/USyncContactProtocol.js +2 -2
  68. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +2 -2
  69. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +3 -3
  70. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +2 -2
  71. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +1 -1
  72. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +1 -1
  73. package/lib/WAUSync/USyncQuery.js +13 -17
  74. package/package.json +25 -23
  75. package/lib/Store/make-cache-manager-store.d.ts +0 -14
  76. package/lib/Store/make-cache-manager-store.js +0 -83
  77. /package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +0 -0
  78. /package/lib/Socket/Client/{types.js → abstract-socket-client.js} +0 -0
@@ -36,15 +36,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.getStream = exports.toBuffer = exports.toReadable = exports.mediaMessageSHA256B64 = exports.changeprofileFull = exports.generatePP = exports.generateProfilePictureFP = exports.generateProfilePictureFull = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.hkdfInfoKey = void 0;
39
+ exports.getStatusCodeForMediaRetry = exports.decryptMediaRetryData = exports.decodeMediaRetryNode = exports.encryptMediaRetryRequest = exports.getWAUploadToServer = exports.downloadEncryptedContent = exports.downloadContentFromMessage = exports.getUrlFromDirectPath = exports.encryptedStream = exports.prepareStream = exports.getHttpStream = exports.getStream = exports.toBuffer = exports.toReadable = exports.mediaMessageSHA256B64 = exports.generateProfilePicture = exports.encodeBase64EncodedStringForUpload = exports.extractImageThumb = exports.extractVideoThumb = exports.hkdfInfoKey = void 0;
40
40
  exports.getMediaKeys = getMediaKeys;
41
+ exports.uploadFile = uploadFile;
42
+ exports.vid2jpg = vid2jpg;
41
43
  exports.getAudioDuration = getAudioDuration;
42
44
  exports.getAudioWaveform = getAudioWaveform;
43
45
  exports.generateThumbnail = generateThumbnail;
44
46
  exports.extensionForMediaMessage = extensionForMediaMessage;
45
47
  const boom_1 = require("@hapi/boom");
46
48
  const axios_1 = __importDefault(require("axios"));
47
- const child_process_1 = require("child_process");
49
+ const form_data_1 = __importDefault(require("form-data"));
50
+ const cheerio = __importStar(require("cheerio"));
48
51
  const Crypto = __importStar(require("crypto"));
49
52
  const events_1 = require("events");
50
53
  const fs_1 = require("fs");
@@ -99,18 +102,163 @@ async function getMediaKeys(buffer, mediaType) {
99
102
  macKey: expandedMediaKey.slice(48, 80),
100
103
  };
101
104
  }
102
- /** Extracts video thumb using FFMPEG */
103
- const extractVideoThumb = async (path, destPath, time, size) => new Promise((resolve, reject) => {
104
- const cmd = `ffmpeg -ss ${time} -i ${path} -y -vf scale=${size.width}:-1 -vframes 1 -f image2 ${destPath}`;
105
- (0, child_process_1.exec)(cmd, (err) => {
106
- if (err) {
107
- reject(err);
105
+ async function uploadFile(buffer, logger) {
106
+ const { fromBuffer } = await Promise.resolve().then(() => __importStar(require('file-type')));
107
+ const fileType = await fromBuffer(buffer);
108
+ if (!fileType)
109
+ throw new Error("Failed to detect file type.");
110
+ const { ext, mime } = fileType;
111
+ const services = [
112
+ {
113
+ name: "catbox",
114
+ url: "https://catbox.moe/user/api.php",
115
+ buildForm: () => {
116
+ const form = new form_data_1.default();
117
+ form.append("fileToUpload", buffer, {
118
+ filename: `file.${ext}`,
119
+ contentType: mime || "application/octet-stream"
120
+ });
121
+ form.append("reqtype", "fileupload");
122
+ return form;
123
+ },
124
+ parseResponse: res => res.data
125
+ },
126
+ {
127
+ name: "pdi.moe",
128
+ url: "https://scdn.pdi.moe/upload",
129
+ buildForm: () => {
130
+ const form = new form_data_1.default();
131
+ form.append("file", buffer, {
132
+ filename: `file.${ext}`,
133
+ contentType: mime
134
+ });
135
+ return form;
136
+ },
137
+ parseResponse: res => res.data.result.url
138
+ },
139
+ {
140
+ name: "qu.ax",
141
+ url: "https://qu.ax/upload.php",
142
+ buildForm: () => {
143
+ const form = new form_data_1.default();
144
+ form.append("files[]", buffer, {
145
+ filename: `file.${ext}`,
146
+ contentType: mime || "application/octet-stream"
147
+ });
148
+ return form;
149
+ },
150
+ parseResponse: res => {
151
+ var _a, _b, _c;
152
+ if (!((_c = (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.url))
153
+ throw new Error("Failed to get URL from qu.ax");
154
+ return res.data.files[0].url;
155
+ }
156
+ },
157
+ {
158
+ name: "uguu.se",
159
+ url: "https://uguu.se/upload.php",
160
+ buildForm: () => {
161
+ const form = new form_data_1.default();
162
+ form.append("files[]", buffer, {
163
+ filename: `file.${ext}`,
164
+ contentType: mime || "application/octet-stream"
165
+ });
166
+ return form;
167
+ },
168
+ parseResponse: res => {
169
+ var _a, _b, _c;
170
+ if (!((_c = (_b = (_a = res.data) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.url))
171
+ throw new Error("Failed to get URL from uguu.se");
172
+ return res.data.files[0].url;
173
+ }
174
+ },
175
+ {
176
+ name: "tmpfiles",
177
+ url: "https://tmpfiles.org/api/v1/upload",
178
+ buildForm: () => {
179
+ const form = new form_data_1.default();
180
+ form.append("file", buffer, {
181
+ filename: `file.${ext}`,
182
+ contentType: mime
183
+ });
184
+ return form;
185
+ },
186
+ parseResponse: res => {
187
+ const match = res.data.data.url.match(/https:\/\/tmpfiles\.org\/(.*)/);
188
+ if (!match)
189
+ throw new Error("Failed to parse tmpfiles URL.");
190
+ return `https://tmpfiles.org/dl/${match[1]}`;
191
+ }
108
192
  }
109
- else {
110
- resolve();
193
+ ];
194
+ for (const service of services) {
195
+ try {
196
+ const form = service.buildForm();
197
+ const res = await axios_1.default.post(service.url, form, {
198
+ headers: form.getHeaders()
199
+ });
200
+ const url = service.parseResponse(res);
201
+ return url;
202
+ }
203
+ catch (error) {
204
+ logger === null || logger === void 0 ? void 0 : logger.debug(`[${service.name}] eror:`, (error === null || error === void 0 ? void 0 : error.message) || error);
205
+ }
206
+ }
207
+ throw new Error("All upload services failed.");
208
+ }
209
+ async function vid2jpg(videoUrl) {
210
+ try {
211
+ const { data } = await axios_1.default.get(`https://ezgif.com/video-to-jpg?url=${encodeURIComponent(videoUrl)}`);
212
+ const $ = cheerio.load(data);
213
+ const fileToken = $('input[name="file"]').attr("value");
214
+ if (!fileToken) {
215
+ throw new Error("Failed to retrieve file token. The video URL may be invalid or inaccessible.");
216
+ }
217
+ const formData = new URLSearchParams();
218
+ formData.append("file", fileToken);
219
+ formData.append("end", "1");
220
+ formData.append("video-to-jpg", "Convert to JPG!");
221
+ const convert = await axios_1.default.post(`https://ezgif.com/video-to-jpg/${fileToken}`, formData);
222
+ const $2 = cheerio.load(convert.data);
223
+ let imageUrl = $2("#output img").first().attr("src");
224
+ if (!imageUrl) {
225
+ throw new Error("Could not locate the converted image output.");
226
+ }
227
+ if (imageUrl.startsWith("//")) {
228
+ imageUrl = "https:" + imageUrl;
229
+ }
230
+ else if (imageUrl.startsWith("/")) {
231
+ const cdnMatch = imageUrl.match(/\/(s\d+\..+?)\/.*/);
232
+ if (cdnMatch) {
233
+ imageUrl = "https://" + imageUrl.slice(2);
234
+ }
235
+ else {
236
+ imageUrl = "https://ezgif.com" + imageUrl;
237
+ }
111
238
  }
239
+ return imageUrl;
240
+ }
241
+ catch (error) {
242
+ throw new Error("Failed to convert video to JPG: " + error.message);
243
+ }
244
+ }
245
+ /**
246
+ * Originally written by Techwiz (https://github.com/techwiz37)
247
+ * Modified for customization and improvements
248
+ */
249
+ const extractVideoThumb = async (videoPath) => {
250
+ const videoBuffer = await fs_1.promises.readFile(videoPath);
251
+ const dataUrl = await uploadFile(videoBuffer);
252
+ if (!dataUrl || typeof dataUrl !== 'string') {
253
+ throw new Error('Failed to upload video: Invalid or missing URL');
254
+ }
255
+ const jpgUrl = await vid2jpg(dataUrl);
256
+ const { data: imageBuffer } = await axios_1.default.get(jpgUrl, {
257
+ responseType: 'arraybuffer',
112
258
  });
113
- });
259
+ return imageBuffer;
260
+ };
261
+ exports.extractVideoThumb = extractVideoThumb;
114
262
  const extractImageThumb = async (bufferOrFilePath, width = 32) => {
115
263
  var _a, _b;
116
264
  if (bufferOrFilePath instanceof stream_1.Readable) {
@@ -180,76 +328,6 @@ const generateProfilePicture = async (mediaUpload) => {
180
328
  };
181
329
  };
182
330
  exports.generateProfilePicture = generateProfilePicture;
183
- const generateProfilePictureFull = async (img) => {
184
- const Jimp = require('jimp');
185
- const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
186
- const jimp = await read(img);
187
- const min = Math.min(jimp.getWidth(), jimp.getHeight());
188
- const cropped = jimp.crop(0, 0, jimp.getWidth(), jimp.getHeight());
189
- let width = jimp.getWidth(), hight = jimp.getHeight(), ratio;
190
- if (width > hight) {
191
- ratio = jimp.getWidth() / 720;
192
- }
193
- else {
194
- ratio = jimp.getWidth() / 324;
195
- }
196
- ;
197
- width = width / ratio;
198
- hight = hight / ratio;
199
- img = cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG);
200
- return {
201
- img: await cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG),
202
- };
203
- };
204
- exports.generateProfilePictureFull = generateProfilePictureFull;
205
- const generateProfilePictureFP = async (buffer) => {
206
- const Jimp = require('jimp');
207
- const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
208
- const jimp = await Jimp.read(buffer);
209
- const min = jimp.getWidth();
210
- const max = jimp.getHeight();
211
- const cropped = jimp.crop(0, 0, min, max);
212
- return {
213
- img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG),
214
- preview: await cropped.normalize().getBufferAsync(Jimp.MIME_JPEG),
215
- };
216
- };
217
- exports.generateProfilePictureFP = generateProfilePictureFP;
218
- const generatePP = async (buffer) => {
219
- const Jimp = require('jimp');
220
- const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
221
- const jimp = await Jimp.read(buffer);
222
- const min = jimp.getWidth();
223
- const max = jimp.getHeight();
224
- const cropped = jimp.crop(0, 0, min, max);
225
- return {
226
- img: await cropped.scaleToFit(720, 720).getBufferAsync(Jimp.MIME_JPEG),
227
- preview: await cropped.normalize().getBufferAsync(Jimp.MIME_JPEG),
228
- };
229
- };
230
- exports.generatePP = generatePP;
231
- const changeprofileFull = async (img) => {
232
- const Jimp = require('jimp');
233
- const { read, MIME_JPEG, RESIZE_BILINEAR } = require('jimp');
234
- const jimp = await read(img);
235
- const min = Math.min(jimp.getWidth(), jimp.getHeight());
236
- const cropped = jimp.crop(0, 0, jimp.getWidth(), jimp.getHeight());
237
- let width = jimp.getWidth(), hight = jimp.getHeight(), ratio;
238
- if (width > hight) {
239
- ratio = jimp.getWidth() / 720;
240
- }
241
- else {
242
- ratio = jimp.getWidth() / 324;
243
- }
244
- ;
245
- width = width / ratio;
246
- hight = hight / ratio;
247
- img = cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG);
248
- return {
249
- img: await cropped.quality(100).resize(width, hight).getBufferAsync(MIME_JPEG),
250
- };
251
- };
252
- exports.changeprofileFull = changeprofileFull;
253
331
  /** gets the SHA256 of the given media message */
254
332
  const mediaMessageSHA256B64 = (message) => {
255
333
  const media = Object.values(message)[0];
@@ -362,11 +440,18 @@ async function generateThumbnail(file, mediaType, options) {
362
440
  }
363
441
  }
364
442
  else if (mediaType === 'video') {
365
- const imgFilename = (0, path_1.join)(getTmpFilesDirectory(), (0, generics_1.generateMessageIDV2)() + '.jpg');
366
443
  try {
367
- await extractVideoThumb(file, imgFilename, '00:00:00', { width: 32, height: 32 });
368
- const buff = await fs_1.promises.readFile(imgFilename);
369
- thumbnail = buff.toString('base64');
444
+ const thumbnailBuffer = await (0, exports.extractVideoThumb)(file);
445
+ const imgFilename = (0, path_1.join)(getTmpFilesDirectory(), (0, generics_1.generateMessageIDV2)() + '.jpg');
446
+ await fs_1.promises.writeFile(imgFilename, thumbnailBuffer);
447
+ const { buffer: processedThumbnailBuffer, original } = await (0, exports.extractImageThumb)(imgFilename);
448
+ thumbnail = processedThumbnailBuffer.toString('base64');
449
+ if (original.width && original.height) {
450
+ originalImageDimensions = {
451
+ width: original.width,
452
+ height: original.height,
453
+ };
454
+ }
370
455
  await fs_1.promises.unlink(imgFilename);
371
456
  }
372
457
  catch (err) {
@@ -437,7 +522,7 @@ const encryptedStream = async (media, mediaType, { logger, saveOriginalFileIfReq
437
522
  let writeStream;
438
523
  let didSaveToTmpPath = false;
439
524
  if (type === 'file') {
440
- bodyPath = media.url.toString();
525
+ bodyPath = media.url;
441
526
  }
442
527
  else if (saveOriginalFileIfRequired) {
443
528
  bodyPath = (0, path_1.join)(getTmpFilesDirectory(), mediaType + (0, generics_1.generateMessageIDV2)());
@@ -460,8 +545,10 @@ const encryptedStream = async (media, mediaType, { logger, saveOriginalFileIfReq
460
545
  });
461
546
  }
462
547
  sha256Plain = sha256Plain.update(data);
463
- if (writeStream && !writeStream.write(data)) {
464
- await (0, events_1.once)(writeStream, 'drain');
548
+ if (writeStream) {
549
+ if (!writeStream.write(data)) {
550
+ await (0, events_1.once)(writeStream, 'drain');
551
+ }
465
552
  }
466
553
  onChunk(aes.update(data));
467
554
  }
@@ -38,7 +38,7 @@ export declare const extractMessageContent: (content: WAMessageContent | undefin
38
38
  /**
39
39
  * Returns the device predicted by message ID
40
40
  */
41
- export declare const getDevice: (id: string) => "android" | "unknown" | "web" | "ios" | "desktop";
41
+ export declare const getDevice: (id: string) => "web" | "unknown" | "android" | "ios" | "desktop";
42
42
  /** Upserts a receipt in the message */
43
43
  export declare const updateMessageWithReceipt: (msg: Pick<WAMessage, "userReceipt">, receipt: MessageUserReceipt) => void;
44
44
  /** Update the message with a new reaction */
@@ -275,9 +275,6 @@ const generateWAMessageContent = async (message, options) => {
275
275
  extContent.font = options.font;
276
276
  }
277
277
  m.extendedTextMessage = extContent;
278
- m.messageContextInfo = {
279
- messageSecret: (0, crypto_1.randomBytes)(32)
280
- };
281
278
  }
282
279
  else if ('contacts' in message) {
283
280
  const contactLen = message.contacts.contacts.length;
@@ -566,7 +563,7 @@ const generateWAMessageContent = async (message, options) => {
566
563
  title: message.title,
567
564
  footerText: message.footer,
568
565
  description: message.text,
569
- listType: message.hasOwnProperty('listType') ? message.listType : WAProto_1.proto.Message.ListMessage.ListType.PRODUCT_LIST
566
+ listType: WAProto_1.proto.Message.ListMessage.ListType.SINGLE_SELECT
570
567
  };
571
568
  m = { listMessage };
572
569
  }
@@ -804,7 +801,9 @@ const normalizeMessageContent = (content) => {
804
801
  || (message === null || message === void 0 ? void 0 : message.groupStatusMessage)
805
802
  || (message === null || message === void 0 ? void 0 : message.limitSharingMessage)
806
803
  || (message === null || message === void 0 ? void 0 : message.botTaskMessage)
807
- || (message === null || message === void 0 ? void 0 : message.questionMessage));
804
+ || (message === null || message === void 0 ? void 0 : message.questionMessage)
805
+ || (message === null || message === void 0 ? void 0 : message.groupStatusMessageV2)
806
+ || (message === null || message === void 0 ? void 0 : message.botForwardedMessage));
808
807
  }
809
808
  };
810
809
  exports.normalizeMessageContent = normalizeMessageContent;
@@ -877,9 +876,8 @@ const updateMessageWithReaction = (msg, reaction) => {
877
876
  const authorID = (0, generics_1.getKeyAuthor)(reaction.key);
878
877
  const reactions = (msg.reactions || [])
879
878
  .filter(r => (0, generics_1.getKeyAuthor)(r.key) !== authorID);
880
- if (reaction.text) {
881
- reactions.push(reaction);
882
- }
879
+ reaction.text = reaction.text || '';
880
+ reactions.push(reaction);
883
881
  msg.reactions = reactions;
884
882
  };
885
883
  exports.updateMessageWithReaction = updateMessageWithReaction;
@@ -959,13 +957,17 @@ const downloadMediaMessage = async (message, type, options, ctx) => {
959
957
  const result = await downloadMsg()
960
958
  .catch(async (error) => {
961
959
  var _a;
962
- if (ctx && axios_1.default.isAxiosError(error) && // check if the message requires a reupload
963
- REUPLOAD_REQUIRED_STATUS.includes((_a = error.response) === null || _a === void 0 ? void 0 : _a.status)) {
964
- ctx.logger.info({ key: message.key }, 'sending reupload media request...');
965
- // request reupload
966
- message = await ctx.reuploadRequest(message);
967
- const result = await downloadMsg();
968
- return result;
960
+ if (ctx) {
961
+ if (axios_1.default.isAxiosError(error)) {
962
+ // check if the message requires a reupload
963
+ if (REUPLOAD_REQUIRED_STATUS.includes((_a = error.response) === null || _a === void 0 ? void 0 : _a.status)) {
964
+ ctx.logger.info({ key: message.key }, 'sending reupload media request...');
965
+ // request reupload
966
+ message = await ctx.reuploadRequest(message);
967
+ const result = await downloadMsg();
968
+ return result;
969
+ }
970
+ }
969
971
  }
970
972
  throw error;
971
973
  });
@@ -2,9 +2,10 @@ import { ILogger } from './logger';
2
2
  import { proto } from '../../WAProto';
3
3
  import { KeyPair } from '../Types';
4
4
  import { BinaryNode } from '../WABinary';
5
- export declare const makeNoiseHandler: ({ keyPair: { private: privateKey, public: publicKey }, NOISE_HEADER, logger, routingInfo }: {
5
+ export declare const makeNoiseHandler: ({ keyPair: { private: privateKey, public: publicKey }, NOISE_HEADER, mobile, logger, routingInfo }: {
6
6
  keyPair: KeyPair;
7
7
  NOISE_HEADER: Uint8Array;
8
+ mobile: boolean;
8
9
  logger: ILogger;
9
10
  routingInfo?: Buffer | undefined;
10
11
  }) => {
@@ -11,7 +11,7 @@ const generateIV = (counter) => {
11
11
  new DataView(iv).setUint32(8, counter);
12
12
  return new Uint8Array(iv);
13
13
  };
14
- const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey }, NOISE_HEADER, logger, routingInfo }) => {
14
+ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey }, NOISE_HEADER, mobile, logger, routingInfo }) => {
15
15
  logger = logger.child({ class: 'ns' });
16
16
  const authenticate = (data) => {
17
17
  if (!isFinished) {
@@ -83,10 +83,15 @@ const makeNoiseHandler = ({ keyPair: { private: privateKey, public: publicKey },
83
83
  const decStaticContent = decrypt(serverHello.static);
84
84
  await mixIntoKey(crypto_1.Curve.sharedKey(privateKey, decStaticContent));
85
85
  const certDecoded = decrypt(serverHello.payload);
86
- const { intermediate: certIntermediate } = WAProto_1.proto.CertChain.decode(certDecoded);
87
- const { issuerSerial } = WAProto_1.proto.CertChain.NoiseCertificate.Details.decode(certIntermediate.details);
88
- if (issuerSerial !== Defaults_1.WA_CERT_DETAILS.SERIAL) {
89
- throw new boom_1.Boom('certification match failed', { statusCode: 400 });
86
+ if (mobile) {
87
+ WAProto_1.proto.CertChain.NoiseCertificate.decode(certDecoded);
88
+ }
89
+ else {
90
+ const { intermediate: certIntermediate } = WAProto_1.proto.CertChain.decode(certDecoded);
91
+ const { issuerSerial } = WAProto_1.proto.CertChain.NoiseCertificate.Details.decode(certIntermediate.details);
92
+ if (issuerSerial !== Defaults_1.WA_CERT_DETAILS.SERIAL) {
93
+ throw new boom_1.Boom('certification match failed', { statusCode: 400 });
94
+ }
90
95
  }
91
96
  const keyEnc = encrypt(noiseKey.public);
92
97
  await mixIntoKey(crypto_1.Curve.sharedKey(noiseKey.private, serverHello.ephemeral));
@@ -1,6 +1,7 @@
1
1
  import { proto } from '../../WAProto';
2
2
  import type { AuthenticationCreds, SignalCreds, SocketConfig } from '../Types';
3
3
  import { BinaryNode } from '../WABinary';
4
+ export declare const generateMobileNode: (config: SocketConfig) => proto.IClientPayload;
4
5
  export declare const generateLoginNode: (userJid: string, config: SocketConfig) => proto.IClientPayload;
5
6
  export declare const generateRegistrationNode: ({ registrationId, signedPreKey, signedIdentityKey }: SignalCreds, config: SocketConfig) => proto.ClientPayload;
6
7
  export declare const configureSuccessfulPairing: (stanza: BinaryNode, { advSecretKey, signedIdentityKey, signalIdentities }: Pick<AuthenticationCreds, "advSecretKey" | "signedIdentityKey" | "signalIdentities">) => {
@@ -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 = void 0;
3
+ exports.encodeSignedDeviceIdentity = exports.configureSuccessfulPairing = exports.generateRegistrationNode = exports.generateLoginNode = exports.generateMobileNode = 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,19 +10,30 @@ 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 } : {};
13
20
  return {
14
21
  appVersion: {
15
- primary: config.version[0],
16
- secondary: config.version[1],
17
- tertiary: config.version[2],
22
+ primary: version[0],
23
+ secondary: version[1],
24
+ tertiary: version[2],
18
25
  },
19
- platform: WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB,
26
+ platform,
20
27
  releaseChannel: WAProto_1.proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
21
- osVersion: '0.1',
22
- device: 'Desktop',
23
- osBuildNumber: '0.1',
28
+ mcc: ((_a = config.auth.creds.registration) === null || _a === void 0 ? void 0 : _a.phoneNumberMobileCountryCode) || '000',
29
+ mnc: ((_b = config.auth.creds.registration) === null || _b === void 0 ? void 0 : _b.phoneNumberMobileNetworkCode) || '000',
30
+ osVersion: osVersion,
31
+ manufacturer,
32
+ device,
33
+ osBuildNumber: osVersion,
24
34
  localeLanguageIso6391: 'en',
25
- localeCountryIso31661Alpha2: config.countryCode
35
+ localeCountryIso31661Alpha2: config.countryCode,
36
+ ...phoneId
26
37
  };
27
38
  };
28
39
  const PLATFORM_MAP = {
@@ -42,9 +53,32 @@ const getClientPayload = (config) => {
42
53
  connectReason: WAProto_1.proto.ClientPayload.ConnectReason.USER_ACTIVATED,
43
54
  userAgent: getUserAgent(config),
44
55
  };
45
- payload.webInfo = getWebInfo(config);
56
+ if (!config.mobile) {
57
+ payload.webInfo = getWebInfo(config);
58
+ }
46
59
  return payload;
47
60
  };
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, // XMPP heartbeat setting (false: server actively pings) (true: client actively pings)
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;
48
82
  const generateLoginNode = (userJid, config) => {
49
83
  const { user, device } = (0, WABinary_1.jidDecode)(userJid);
50
84
  const payload = {
@@ -103,21 +137,21 @@ const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, s
103
137
  }
104
138
  const bizName = businessNode === null || businessNode === void 0 ? void 0 : businessNode.attrs.name;
105
139
  const jid = deviceNode.attrs.jid;
106
- const { details, hmac } = WAProto_1.proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content);
107
- // check HMAC matches
108
- const advSign = (0, crypto_2.hmacSign)(details, Buffer.from(advSecretKey, 'base64'));
140
+ const { details, hmac, accountType } = WAProto_1.proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content);
141
+ const isHostedAccount = accountType !== undefined && accountType === WAProto_1.proto.ADVEncryptionType.HOSTED;
142
+ const hmacPrefix = isHostedAccount ? Buffer.from([6, 5]) : Buffer.alloc(0);
143
+ const advSign = (0, crypto_2.hmacSign)(Buffer.concat([hmacPrefix, details]), Buffer.from(advSecretKey, 'base64'));
109
144
  if (Buffer.compare(hmac, advSign) !== 0) {
110
145
  throw new boom_1.Boom('Invalid account signature');
111
146
  }
112
147
  const account = WAProto_1.proto.ADVSignedDeviceIdentity.decode(details);
113
148
  const { accountSignatureKey, accountSignature, details: deviceDetails } = account;
114
- // verify the device signature matches
115
149
  const accountMsg = Buffer.concat([Buffer.from([6, 0]), deviceDetails, signedIdentityKey.public]);
116
150
  if (!crypto_2.Curve.verify(accountSignatureKey, accountMsg, accountSignature)) {
117
151
  throw new boom_1.Boom('Failed to verify account signature');
118
152
  }
119
- // sign the details with our identity key
120
- const deviceMsg = Buffer.concat([Buffer.from([6, 1]), deviceDetails, signedIdentityKey.public, accountSignatureKey]);
153
+ const devicePrefix = isHostedAccount ? Buffer.from([6, 6]) : Buffer.from([6, 1]);
154
+ const deviceMsg = Buffer.concat([devicePrefix, deviceDetails, signedIdentityKey.public, accountSignatureKey]);
121
155
  account.deviceSignature = crypto_2.Curve.sign(signedIdentityKey.private, deviceMsg);
122
156
  const identity = (0, signal_1.createSignalIdentity)(jid, accountSignatureKey);
123
157
  const accountEnc = (0, exports.encodeSignedDeviceIdentity)(account, false);
@@ -4,6 +4,8 @@ export declare const TAGS: {
4
4
  DICTIONARY_1: number;
5
5
  DICTIONARY_2: number;
6
6
  DICTIONARY_3: number;
7
+ INTEROP_JID: number;
8
+ FB_JID: number;
7
9
  AD_JID: number;
8
10
  LIST_8: number;
9
11
  LIST_16: number;
@@ -14,11 +16,9 @@ export declare const TAGS: {
14
16
  BINARY_32: number;
15
17
  NIBBLE_8: number;
16
18
  PACKED_MAX: number;
17
- SINGLE_BYTE_MAX: number;
18
- STREAM_END: number;
19
19
  };
20
- export declare const DOUBLE_BYTE_TOKENS: string[][];
21
- export declare const SINGLE_BYTE_TOKENS: (string | null)[];
20
+ export declare const DOUBLE_BYTE_TOKENS: readonly [readonly ["read-self", "active", "fbns", "protocol", "reaction", "screen_width", "heartbeat", "deviceid", "2:47DEQpj8", "uploadfieldstat", "voip_settings", "retry", "priority", "longitude", "conflict", "false", "ig_professional", "replaced", "preaccept", "cover_photo", "uncompressed", "encopt", "ppic", "04", "passive", "status-revoke-drop", "keygen", "540", "offer", "rate", "opus", "latitude", "w:gp2", "ver", "4", "business_profile", "medium", "sender", "prev_v_id", "email", "website", "invited", "sign_credential", "05", "transport", "skey", "reason", "peer_abtest_bucket", "America/Sao_Paulo", "appid", "refresh", "100", "06", "404", "101", "104", "107", "102", "109", "103", "member_add_mode", "105", "transaction-id", "110", "106", "outgoing", "108", "111", "tokens", "followers", "ig_handle", "self_pid", "tue", "dec", "thu", "joinable", "peer_pid", "mon", "features", "wed", "peer_device_presence", "pn", "delete", "07", "fri", "audio_duration", "admin", "connected", "delta", "rcat", "disable", "collection", "08", "480", "sat", "phash", "all", "invite", "accept", "critical_unblock_low", "group_update", "signed_credential", "blinded_credential", "eph_setting", "net", "09", "background_location", "refresh_id", "Asia/Kolkata", "privacy_mode_ts", "account_sync", "voip_payload_type", "service_areas", "acs_public_key", "v_id", "0a", "fallback_class", "relay", "actual_actors", "metadata", "w:biz", "5", "connected-limit", "notice", "0b", "host_storage", "fb_page", "subject", "privatestats", "invis", "groupadd", "010", "note.m4r", "uuid", "0c", "8000", "sun", "372", "1020", "stage", "1200", "720", "canonical", "fb", "011", "video_duration", "0d", "1140", "superadmin", "012", "Opening.m4r", "keystore_attestation", "dleq_proof", "013", "timestamp", "ab_key", "w:sync:app:state", "0e", "vertical", "600", "p_v_id", "6", "likes", "014", "500", "1260", "creator", "0f", "rte", "destination", "group", "group_info", "syncd_anti_tampering_fatal_exception_enabled", "015", "dl_bw", "Asia/Jakarta", "vp8/h.264", "online", "1320", "fb:multiway", "10", "timeout", "016", "nse_retry", "urn:xmpp:whatsapp:dirty", "017", "a_v_id", "web_shops_chat_header_button_enabled", "nse_call", "inactive-upgrade", "none", "web", "groups", "2250", "mms_hot_content_timespan_in_seconds", "contact_blacklist", "nse_read", "suspended_group_deletion_notification", "binary_version", "018", "https://www.whatsapp.com/otp/copy/", "reg_push", "shops_hide_catalog_attachment_entrypoint", "server_sync", ".", "ephemeral_messages_allowed_values", "019", "mms_vcache_aggregation_enabled", "iphone", "America/Argentina/Buenos_Aires", "01a", "mms_vcard_autodownload_size_kb", "nse_ver", "shops_header_dropdown_menu_item", "dhash", "catalog_status", "communities_mvp_new_iqs_serverprop", "blocklist", "default", "11", "ephemeral_messages_enabled", "01b", "original_dimensions", "8", "mms4_media_retry_notification_encryption_enabled", "mms4_server_error_receipt_encryption_enabled", "original_image_url", "sync", "multiway", "420", "companion_enc_static", "shops_profile_drawer_entrypoint", "01c", "vcard_as_document_size_kb", "status_video_max_duration", "request_image_url", "01d", "regular_high", "s_t", "abt", "share_ext_min_preliminary_image_quality", "01e", "32", "syncd_key_rotation_enabled", "data_namespace", "md_downgrade_read_receipts2", "patch", "polltype", "ephemeral_messages_setting", "userrate", "15", "partial_pjpeg_bw_threshold", "played-self", "catalog_exists", "01f", "mute_v2"], readonly ["reject", "dirty", "announcement", "020", "13", "9", "status_video_max_bitrate", "fb:thrift_iq", "offline_batch", "022", "full", "ctwa_first_business_reply_logging", "h.264", "smax_id", "group_description_length", "https://www.whatsapp.com/otp/code", "status_image_max_edge", "smb_upsell_business_profile_enabled", "021", "web_upgrade_to_md_modal", "14", "023", "s_o", "smaller_video_thumbs_status_enabled", "media_max_autodownload", "960", "blocking_status", "peer_msg", "joinable_group_call_client_version", "group_call_video_maximization_enabled", "return_snapshot", "high", "America/Mexico_City", "entry_point_block_logging_enabled", "pop", "024", "1050", "16", "1380", "one_tap_calling_in_group_chat_size", "regular_low", "inline_joinable_education_enabled", "hq_image_max_edge", "locked", "America/Bogota", "smb_biztools_deeplink_enabled", "status_image_quality", "1088", "025", "payments_upi_intent_transaction_limit", "voip", "w:g2", "027", "md_pin_chat_enabled", "026", "multi_scan_pjpeg_download_enabled", "shops_product_grid", "transaction_id", "ctwa_context_enabled", "20", "fna", "hq_image_quality", "alt_jpeg_doc_detection_quality", "group_call_max_participants", "pkey", "America/Belem", "image_max_kbytes", "web_cart_v1_1_order_message_changes_enabled", "ctwa_context_enterprise_enabled", "urn:xmpp:whatsapp:account", "840", "Asia/Kuala_Lumpur", "max_participants", "video_remux_after_repair_enabled", "stella_addressbook_restriction_type", "660", "900", "780", "context_menu_ios13_enabled", "mute-state", "ref", "payments_request_messages", "029", "frskmsg", "vcard_max_size_kb", "sample_buffer_gif_player_enabled", "match_last_seen", "510", "4983", "video_max_bitrate", "028", "w:comms:chat", "17", "frequently_forwarded_max", "groups_privacy_blacklist", "Asia/Karachi", "02a", "web_download_document_thumb_mms_enabled", "02b", "hist_sync", "biz_block_reasons_version", "1024", "18", "web_is_direct_connection_for_plm_transparent", "view_once_write", "file_max_size", "paid_convo_id", "online_privacy_setting", "video_max_edge", "view_once_read", "enhanced_storage_management", "multi_scan_pjpeg_encoding_enabled", "ctwa_context_forward_enabled", "video_transcode_downgrade_enable", "template_doc_mime_types", "hq_image_bw_threshold", "30", "body", "u_aud_limit_sil_restarts_ctrl", "other", "participating", "w:biz:directory", "1110", "vp8", "4018", "meta", "doc_detection_image_max_edge", "image_quality", "1170", "02c", "smb_upsell_chat_banner_enabled", "key_expiry_time_second", "pid", "stella_interop_enabled", "19", "linked_device_max_count", "md_device_sync_enabled", "02d", "02e", "360", "enhanced_block_enabled", "ephemeral_icon_in_forwarding", "paid_convo_status", "gif_provider", "project_name", "server-error", "canonical_url_validation_enabled", "wallpapers_v2", "syncd_clear_chat_delete_chat_enabled", "medianotify", "02f", "shops_required_tos_version", "vote", "reset_skey_on_id_change", "030", "image_max_edge", "multicast_limit_global", "ul_bw", "21", "25", "5000", "poll", "570", "22", "031", "1280", "WhatsApp", "032", "bloks_shops_enabled", "50", "upload_host_switching_enabled", "web_ctwa_context_compose_enabled", "ptt_forwarded_features_enabled", "unblocked", "partial_pjpeg_enabled", "fbid:devices", "height", "ephemeral_group_query_ts", "group_join_permissions", "order", "033", "alt_jpeg_status_quality", "migrate", "popular-bank", "win_uwp_deprecation_killswitch_enabled", "web_download_status_thumb_mms_enabled", "blocking", "url_text", "035", "web_forwarding_limit_to_groups", "1600", "val", "1000", "syncd_msg_date_enabled", "bank-ref-id", "max_subject", "payments_web_enabled", "web_upload_document_thumb_mms_enabled", "size", "request", "ephemeral", "24", "receipt_agg", "ptt_remember_play_position", "sampling_weight", "enc_rekey", "mute_always", "037", "034", "23", "036", "action", "click_to_chat_qr_enabled", "width", "disabled", "038", "md_blocklist_v2", "played_self_enabled", "web_buttons_message_enabled", "flow_id", "clear", "450", "fbid:thread", "bloks_session_state", "America/Lima", "attachment_picker_refresh", "download_host_switching_enabled", "1792", "u_aud_limit_sil_restarts_test2", "custom_urls", "device_fanout", "optimistic_upload", "2000", "key_cipher_suite", "web_smb_upsell_in_biz_profile_enabled", "e", "039", "siri_post_status_shortcut", "pair-device", "lg", "lc", "stream_attribution_url", "model", "mspjpeg_phash_gen", "catalog_send_all", "new_multi_vcards_ui", "share_biz_vcard_enabled", "-", "clean", "200", "md_blocklist_v2_server", "03b", "03a", "web_md_migration_experience", "ptt_conversation_waveform", "u_aud_limit_sil_restarts_test1"], readonly ["64", "ptt_playback_speed_enabled", "web_product_list_message_enabled", "paid_convo_ts", "27", "manufacturer", "psp-routing", "grp_uii_cleanup", "ptt_draft_enabled", "03c", "business_initiated", "web_catalog_products_onoff", "web_upload_link_thumb_mms_enabled", "03e", "mediaretry", "35", "hfm_string_changes", "28", "America/Fortaleza", "max_keys", "md_mhfs_days", "streaming_upload_chunk_size", "5541", "040", "03d", "2675", "03f", "...", "512", "mute", "48", "041", "alt_jpeg_quality", "60", "042", "md_smb_quick_reply", "5183", "c", "1343", "40", "1230", "043", "044", "mms_cat_v1_forward_hot_override_enabled", "user_notice", "ptt_waveform_send", "047", "Asia/Calcutta", "250", "md_privacy_v2", "31", "29", "128", "md_messaging_enabled", "046", "crypto", "690", "045", "enc_iv", "75", "failure", "ptt_oot_playback", "AIzaSyDR5yfaG7OG8sMTUj8kfQEb8T9pN8BM6Lk", "w", "048", "2201", "web_large_files_ui", "Asia/Makassar", "812", "status_collapse_muted", "1334", "257", "2HP4dm", "049", "patches", "1290", "43cY6T", "America/Caracas", "web_sticker_maker", "campaign", "ptt_pausable_enabled", "33", "42", "attestation", "biz", "04b", "query_linked", "s", "125", "04a", "810", "availability", "1411", "responsiveness_v2_m1", "catalog_not_created", "34", "America/Santiago", "1465", "enc_p", "04d", "status_info", "04f", "key_version", "..", "04c", "04e", "md_group_notification", "1598", "1215", "web_cart_enabled", "37", "630", "1920", "2394", "-1", "vcard", "38", "elapsed", "36", "828", "peer", "pricing_category", "1245", "invalid", "stella_ios_enabled", "2687", "45", "1528", "39", "u_is_redial_audio_1104_ctrl", "1025", "1455", "58", "2524", "2603", "054", "bsp_system_message_enabled", "web_pip_redesign", "051", "verify_apps", "1974", "1272", "1322", "1755", "052", "70", "050", "1063", "1135", "1361", "80", "1096", "1828", "1851", "1251", "1921", "key_config_id", "1254", "1566", "1252", "2525", "critical_block", "1669", "max_available", "w:auth:backup:token", "product", "2530", "870", "1022", "participant_uuid", "web_cart_on_off", "1255", "1432", "1867", "41", "1415", "1440", "240", "1204", "1608", "1690", "1846", "1483", "1687", "1749", "69", "url_number", "053", "1325", "1040", "365", "59", "Asia/Riyadh", "1177", "test_recommended", "057", "1612", "43", "1061", "1518", "1635", "055", "1034", "1375", "750", "1430", "event_code", "1682", "503", "55", "865", "78", "1309", "1365", "44", "America/Guayaquil", "535", "LIMITED", "1377", "1613", "1420", "1599", "1822", "05a", "1681", "password", "1111", "1214", "1376", "1478", "47", "1082", "4282", "Europe/Istanbul", "1307", "46", "058", "1124", "256", "rate-overlimit", "retail", "u_a_socket_err_fix_succ_test", "1292", "1370", "1388", "520", "861", "psa", "regular", "1181", "1766", "05b", "1183", "1213", "1304", "1537"], readonly ["1724", "profile_picture", "1071", "1314", "1605", "407", "990", "1710", "746", "pricing_model", "056", "059", "061", "1119", "6027", "65", "877", "1607", "05d", "917", "seen", "1516", "49", "470", "973", "1037", "1350", "1394", "1480", "1796", "keys", "794", "1536", "1594", "2378", "1333", "1524", "1825", "116", "309", "52", "808", "827", "909", "495", "1660", "361", "957", "google", "1357", "1565", "1967", "996", "1775", "586", "736", "1052", "1670", "bank", "177", "1416", "2194", "2222", "1454", "1839", "1275", "53", "997", "1629", "6028", "smba", "1378", "1410", "05c", "1849", "727", "create", "1559", "536", "1106", "1310", "1944", "670", "1297", "1316", "1762", "en", "1148", "1295", "1551", "1853", "1890", "1208", "1784", "7200", "05f", "178", "1283", "1332", "381", "643", "1056", "1238", "2024", "2387", "179", "981", "1547", "1705", "05e", "290", "903", "1069", "1285", "2436", "062", "251", "560", "582", "719", "56", "1700", "2321", "325", "448", "613", "777", "791", "51", "488", "902", "Asia/Almaty", "is_hidden", "1398", "1527", "1893", "1999", "2367", "2642", "237", "busy", "065", "067", "233", "590", "993", "1511", "54", "723", "860", "363", "487", "522", "605", "995", "1321", "1691", "1865", "2447", "2462", "NON_TRANSACTIONAL", "433", "871", "432", "1004", "1207", "2032", "2050", "2379", "2446", "279", "636", "703", "904", "248", "370", "691", "700", "1068", "1655", "2334", "060", "063", "364", "533", "534", "567", "1191", "1210", "1473", "1827", "069", "701", "2531", "514", "prev_dhash", "064", "496", "790", "1046", "1139", "1505", "1521", "1108", "207", "544", "637", "final", "1173", "1293", "1694", "1939", "1951", "1993", "2353", "2515", "504", "601", "857", "modify", "spam_request", "p_121_aa_1101_test4", "866", "1427", "1502", "1638", "1744", "2153", "068", "382", "725", "1704", "1864", "1990", "2003", "Asia/Dubai", "508", "531", "1387", "1474", "1632", "2307", "2386", "819", "2014", "066", "387", "1468", "1706", "2186", "2261", "471", "728", "1147", "1372", "1961"]];
21
+ export declare const SINGLE_BYTE_TOKENS: string[];
22
22
  export declare const TOKEN_MAP: {
23
23
  [token: string]: {
24
24
  dict?: number;