@rosyn/whats 0.1.2 → 0.1.5

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.
@@ -34,14 +34,14 @@ function writeDoubleField(out, fieldNumber, value) {
34
34
  out.push(buf[i]);
35
35
  }
36
36
  function readVarint(buf, state) {
37
- let result = 0;
38
- let shift = 0;
37
+ let result = 0n;
38
+ let shift = 0n;
39
39
  while (state.pos < buf.length) {
40
40
  const b = buf[state.pos++];
41
- result |= (b & 0x7f) << shift;
41
+ result |= BigInt(b & 0x7f) << shift;
42
42
  if ((b & 0x80) === 0)
43
- return result >>> 0;
44
- shift += 7;
43
+ return Number(result);
44
+ shift += 7n;
45
45
  }
46
46
  throw new Error("Truncated varint in protobuf");
47
47
  }
@@ -175,6 +175,8 @@ function encodeImageMessageData(m) {
175
175
  writeVarintField64(out, 12, m.mediaKeyTimestamp);
176
176
  if (m.contextInfo)
177
177
  writeBytesField(out, 17, encodeContextInfo(m.contextInfo));
178
+ if (m.viewOnce !== undefined)
179
+ writeVarintField(out, 25, m.viewOnce ? 1 : 0);
178
180
  return Uint8Array.from(out);
179
181
  }
180
182
  function encodeVideoMessageData(m) {
@@ -201,8 +203,19 @@ function encodeVideoMessageData(m) {
201
203
  writeVarintField64(out, 14, m.mediaKeyTimestamp);
202
204
  if (m.contextInfo)
203
205
  writeBytesField(out, 17, encodeContextInfo(m.contextInfo));
206
+ if (m.viewOnce !== undefined)
207
+ writeVarintField(out, 20, m.viewOnce ? 1 : 0);
204
208
  return Uint8Array.from(out);
205
209
  }
210
+ function encodeAudioStickerMessage(sticker) {
211
+ return writeFutureProofMessage({ stickerMessage: sticker });
212
+ }
213
+ function decodeAudioStickerMessage(buf) {
214
+ const outer = decodeFutureProofMessage(buf);
215
+ const audioSticker = (outer.message ?? {});
216
+ const stickerMessage = audioSticker.stickerMessage ?? audioSticker.message?.stickerMessage;
217
+ return stickerMessage ? { stickerMessage } : audioSticker;
218
+ }
206
219
  function encodeAudioMessageData(m) {
207
220
  const out = [];
208
221
  if (m.url !== undefined)
@@ -229,6 +242,8 @@ function encodeAudioMessageData(m) {
229
242
  writeBytesField(out, 17, encodeContextInfo(m.contextInfo));
230
243
  if (m.waveform)
231
244
  writeBytesField(out, 19, m.waveform);
245
+ if (m.viewOnce !== undefined)
246
+ writeVarintField(out, 21, m.viewOnce ? 1 : 0);
232
247
  return Uint8Array.from(out);
233
248
  }
234
249
  function encodeDocumentMessageData(m) {
@@ -257,6 +272,8 @@ function encodeDocumentMessageData(m) {
257
272
  writeBytesField(out, 17, encodeContextInfo(m.contextInfo));
258
273
  if (m.caption !== undefined)
259
274
  writeBytesField(out, 20, Buffer.from(m.caption, "utf8"));
275
+ if (m.viewOnce !== undefined)
276
+ writeVarintField(out, 30, m.viewOnce ? 1 : 0);
260
277
  return Uint8Array.from(out);
261
278
  }
262
279
  function encodeStickerMessageData(m) {
@@ -277,10 +294,37 @@ function encodeStickerMessageData(m) {
277
294
  writeVarintField64(out, 9, m.fileLength);
278
295
  if (m.mediaKeyTimestamp !== undefined)
279
296
  writeVarintField64(out, 10, m.mediaKeyTimestamp);
297
+ if (m.firstFrameLength !== undefined)
298
+ writeVarintField(out, 11, m.firstFrameLength);
299
+ if (m.firstFrameSidecar)
300
+ writeBytesField(out, 12, m.firstFrameSidecar);
301
+ if (m.isAnimated !== undefined)
302
+ writeVarintField(out, 13, m.isAnimated ? 1 : 0);
303
+ if (m.pngThumbnail)
304
+ writeBytesField(out, 16, m.pngThumbnail);
280
305
  if (m.contextInfo)
281
306
  writeBytesField(out, 17, encodeContextInfo(m.contextInfo));
307
+ if (m.stickerSentTS !== undefined)
308
+ writeVarintField64(out, 18, m.stickerSentTS);
309
+ if (m.isAvatar !== undefined)
310
+ writeVarintField(out, 19, m.isAvatar ? 1 : 0);
311
+ if (m.isAiSticker !== undefined)
312
+ writeVarintField(out, 20, m.isAiSticker ? 1 : 0);
313
+ if (m.isLottie !== undefined)
314
+ writeVarintField(out, 21, m.isLottie ? 1 : 0);
315
+ if (m.accessibilityLabel !== undefined)
316
+ writeBytesField(out, 22, Buffer.from(m.accessibilityLabel, "utf8"));
317
+ if (m.emojis !== undefined)
318
+ writeBytesField(out, 25, Buffer.from(m.emojis, "utf8"));
319
+ if (m.audioMessage)
320
+ writeBytesField(out, 26, encodeAudioMessageData(m.audioMessage));
282
321
  return Uint8Array.from(out);
283
322
  }
323
+ function writeFutureProofMessage(inner) {
324
+ const futureProof = [];
325
+ writeBytesField(futureProof, 1, encodeWAMessageData(inner));
326
+ return Uint8Array.from(futureProof);
327
+ }
284
328
  function encodeWAMessageData(msg) {
285
329
  const out = [];
286
330
  if (msg.conversation !== undefined) {
@@ -421,6 +465,51 @@ function encodeWAMessageData(msg) {
421
465
  if (msg.pollCreationMessageV3) {
422
466
  writeBytesField(out, 64, encodePollCreationMessageData(msg.pollCreationMessageV3));
423
467
  }
468
+ const encodeFutureProof = (inner) => writeFutureProofMessage(inner);
469
+ if (msg.messageContextInfo) {
470
+ const mc = [];
471
+ const m = msg.messageContextInfo;
472
+ if (m.deviceListMetadata) {
473
+ const dm = [];
474
+ if (m.deviceListMetadata.senderKeyHash)
475
+ writeBytesField(dm, 1, m.deviceListMetadata.senderKeyHash);
476
+ if (m.deviceListMetadata.senderTimestamp !== undefined)
477
+ writeVarintField64(dm, 2, m.deviceListMetadata.senderTimestamp);
478
+ if (m.deviceListMetadata.recipientKeyHash)
479
+ writeBytesField(dm, 8, m.deviceListMetadata.recipientKeyHash);
480
+ if (m.deviceListMetadata.recipientTimestamp !== undefined)
481
+ writeVarintField64(dm, 9, m.deviceListMetadata.recipientTimestamp);
482
+ writeBytesField(mc, 1, Uint8Array.from(dm));
483
+ }
484
+ if (m.deviceListMetadataVersion !== undefined)
485
+ writeVarintField(mc, 2, m.deviceListMetadataVersion);
486
+ if (m.messageSecret)
487
+ writeBytesField(mc, 3, m.messageSecret);
488
+ writeBytesField(out, 35, Uint8Array.from(mc));
489
+ }
490
+ if (msg.viewOnceMessage?.message)
491
+ writeBytesField(out, 37, encodeFutureProof(msg.viewOnceMessage.message));
492
+ if (msg.ephemeralMessage?.message)
493
+ writeBytesField(out, 40, encodeFutureProof(msg.ephemeralMessage.message));
494
+ if (msg.documentWithCaptionMessage?.message)
495
+ writeBytesField(out, 53, encodeFutureProof(msg.documentWithCaptionMessage.message));
496
+ if (msg.viewOnceMessageV2?.message)
497
+ writeBytesField(out, 55, encodeFutureProof(msg.viewOnceMessageV2.message));
498
+ if (msg.editedMessage?.message)
499
+ writeBytesField(out, 58, encodeFutureProof(msg.editedMessage.message));
500
+ if (msg.viewOnceMessageV2Extension?.message)
501
+ writeBytesField(out, 59, encodeFutureProof(msg.viewOnceMessageV2Extension.message));
502
+ if (msg.audioStickerMessage?.message) {
503
+ const envelope = msg.audioStickerMessage.message;
504
+ const inner = envelope.message ?? envelope;
505
+ const sticker = envelope.stickerMessage ?? inner.stickerMessage;
506
+ if (sticker?.audioMessage) {
507
+ writeBytesField(out, 134, writeFutureProofMessage({ stickerMessage: sticker }));
508
+ }
509
+ else {
510
+ writeBytesField(out, 134, writeFutureProofMessage(inner));
511
+ }
512
+ }
424
513
  if (msg.stickerPackMessage) {
425
514
  const sp = [];
426
515
  const s = msg.stickerPackMessage;
@@ -631,6 +720,29 @@ function decodeContextInfo(buf) {
631
720
  res.remoteJid = Buffer.from(slice).toString("utf8");
632
721
  else if (fn === 15)
633
722
  (res.mentionedJid ??= []).push(Buffer.from(slice).toString("utf8"));
723
+ else if (fn === 40) {
724
+ const gm = {};
725
+ readProtoFields(slice, (f2, sl2) => {
726
+ if (f2 === 1)
727
+ gm.groupJid = Buffer.from(sl2).toString("utf8");
728
+ else if (f2 === 2)
729
+ gm.groupSubject = Buffer.from(sl2).toString("utf8");
730
+ });
731
+ (res.groupMentions ??= []).push(gm);
732
+ }
733
+ else if (fn === 43) {
734
+ const fnm = {};
735
+ readProtoFields(slice, (f2, sl2) => {
736
+ if (f2 === 1)
737
+ fnm.newsletterJid = Buffer.from(sl2).toString("utf8");
738
+ else if (f2 === 3)
739
+ fnm.newsletterName = Buffer.from(sl2).toString("utf8");
740
+ }, (f2, v2) => {
741
+ if (f2 === 2)
742
+ fnm.serverMessageId = v2;
743
+ });
744
+ res.forwardedNewsletterMessageInfo = fnm;
745
+ }
634
746
  }, (fn, val) => {
635
747
  if (fn === 21)
636
748
  res.forwardingScore = val;
@@ -660,14 +772,24 @@ function decodeImageMessageData(buf) {
660
772
  res.fileEncSha256 = Uint8Array.from(slice);
661
773
  else if (fn === 11)
662
774
  res.directPath = Buffer.from(slice).toString("utf8");
775
+ else if (fn === 16)
776
+ res.jpegThumbnail = Uint8Array.from(slice);
663
777
  else if (fn === 17)
664
778
  res.contextInfo = decodeContextInfo(slice);
665
779
  }, (fn, val) => {
666
780
  if (fn === 5)
667
781
  res.fileLength = val;
782
+ else if (fn === 6)
783
+ res.height = val;
784
+ else if (fn === 7)
785
+ res.width = val;
668
786
  else if (fn === 12)
669
787
  res.mediaKeyTimestamp = val;
788
+ else if (fn === 25)
789
+ res.viewOnce = val !== 0;
670
790
  });
791
+ if (!res.mimetype && (res.url || res.directPath))
792
+ res.mimetype = "image/jpeg";
671
793
  return res;
672
794
  }
673
795
  function decodeVideoMessageData(buf) {
@@ -687,16 +809,28 @@ function decodeVideoMessageData(buf) {
687
809
  res.fileEncSha256 = Uint8Array.from(slice);
688
810
  else if (fn === 13)
689
811
  res.directPath = Buffer.from(slice).toString("utf8");
812
+ else if (fn === 16)
813
+ res.jpegThumbnail = Uint8Array.from(slice);
690
814
  else if (fn === 17)
691
815
  res.contextInfo = decodeContextInfo(slice);
692
816
  }, (fn, val) => {
693
817
  if (fn === 4)
694
818
  res.fileLength = val;
819
+ else if (fn === 5)
820
+ res.seconds = val;
695
821
  else if (fn === 8)
696
822
  res.gifPlayback = val !== 0;
823
+ else if (fn === 9)
824
+ res.height = val;
825
+ else if (fn === 10)
826
+ res.width = val;
697
827
  else if (fn === 14)
698
828
  res.mediaKeyTimestamp = val;
829
+ else if (fn === 20)
830
+ res.viewOnce = val !== 0;
699
831
  });
832
+ if (!res.mimetype && (res.url || res.directPath))
833
+ res.mimetype = "video/mp4";
700
834
  return res;
701
835
  }
702
836
  function decodeAudioMessageData(buf) {
@@ -727,7 +861,12 @@ function decodeAudioMessageData(buf) {
727
861
  res.ptt = val !== 0;
728
862
  else if (fn === 10)
729
863
  res.mediaKeyTimestamp = val;
864
+ else if (fn === 21)
865
+ res.viewOnce = val !== 0;
730
866
  });
867
+ if (!res.mimetype && (res.url || res.directPath)) {
868
+ res.mimetype = res.ptt ? "audio/ogg; codecs=opus" : "audio/mpeg";
869
+ }
731
870
  return res;
732
871
  }
733
872
  function decodeDocumentMessageData(buf) {
@@ -758,6 +897,8 @@ function decodeDocumentMessageData(buf) {
758
897
  res.fileLength = val;
759
898
  else if (fn === 11)
760
899
  res.mediaKeyTimestamp = val;
900
+ else if (fn === 30)
901
+ res.viewOnce = val !== 0;
761
902
  });
762
903
  return res;
763
904
  }
@@ -776,16 +917,42 @@ function decodeStickerMessageData(buf) {
776
917
  res.mimetype = Buffer.from(slice).toString("utf8");
777
918
  else if (fn === 8)
778
919
  res.directPath = Buffer.from(slice).toString("utf8");
920
+ else if (fn === 12)
921
+ res.firstFrameSidecar = Uint8Array.from(slice);
922
+ else if (fn === 16)
923
+ res.pngThumbnail = Uint8Array.from(slice);
779
924
  else if (fn === 17)
780
925
  res.contextInfo = decodeContextInfo(slice);
926
+ else if (fn === 22)
927
+ res.accessibilityLabel = Buffer.from(slice).toString("utf8");
928
+ else if (fn === 25)
929
+ res.emojis = Buffer.from(slice).toString("utf8");
930
+ else if (fn === 26)
931
+ res.audioMessage = decodeAudioMessageData(slice);
781
932
  }, (fn, val) => {
782
- if (fn === 9)
933
+ if (fn === 6)
934
+ res.height = val;
935
+ else if (fn === 7)
936
+ res.width = val;
937
+ else if (fn === 9)
783
938
  res.fileLength = val;
784
939
  else if (fn === 10)
785
940
  res.mediaKeyTimestamp = val;
941
+ else if (fn === 11)
942
+ res.firstFrameLength = val;
786
943
  else if (fn === 13)
787
944
  res.isAnimated = val !== 0;
945
+ else if (fn === 18)
946
+ res.stickerSentTS = val;
947
+ else if (fn === 19)
948
+ res.isAvatar = val !== 0;
949
+ else if (fn === 20)
950
+ res.isAiSticker = val !== 0;
951
+ else if (fn === 21)
952
+ res.isLottie = val !== 0;
788
953
  });
954
+ if (!res.mimetype)
955
+ res.mimetype = "image/webp";
789
956
  return res;
790
957
  }
791
958
  function decodeFutureProofMessage(buf) {
@@ -928,9 +1095,223 @@ function decodeWAMessageData(buf) {
928
1095
  });
929
1096
  res.contactsArrayMessage = ca;
930
1097
  }
1098
+ else if (fn === 15) {
1099
+ const sk = {};
1100
+ readProtoFields(slice, (f2, sl2) => {
1101
+ if (f2 === 1)
1102
+ sk.groupId = Buffer.from(sl2).toString("utf8");
1103
+ else if (f2 === 2)
1104
+ sk.axolotlSenderKeyDistributionMessage = Uint8Array.from(sl2);
1105
+ });
1106
+ res.fastRatchetKeySenderKeyDistributionMessage = sk;
1107
+ }
1108
+ else if (fn === 18) {
1109
+ const llm = {};
1110
+ readProtoFields(slice, (f2, sl2) => {
1111
+ if (f2 === 6)
1112
+ llm.caption = Buffer.from(sl2).toString("utf8");
1113
+ else if (f2 === 16)
1114
+ llm.jpegThumbnail = Uint8Array.from(sl2);
1115
+ else if (f2 === 17)
1116
+ llm.contextInfo = decodeContextInfo(sl2);
1117
+ }, (f2, v2) => {
1118
+ if (f2 === 3)
1119
+ llm.accuracyInMeters = v2;
1120
+ else if (f2 === 7)
1121
+ llm.sequenceNumber = v2;
1122
+ }, (f2, sl2) => {
1123
+ const val = Buffer.from(sl2).readDoubleLE(0);
1124
+ if (f2 === 1)
1125
+ llm.degreesLatitude = val;
1126
+ else if (f2 === 2)
1127
+ llm.degreesLongitude = val;
1128
+ });
1129
+ res.liveLocationMessage = llm;
1130
+ }
1131
+ else if (fn === 25) {
1132
+ const tm = {};
1133
+ readProtoFields(slice, (f2, sl2) => {
1134
+ if (f2 === 1 || f2 === 2 || f2 === 5) {
1135
+ const hyd = {};
1136
+ readProtoFields(sl2, (f3, sl3) => {
1137
+ if (f3 === 1)
1138
+ hyd.documentMessage = decodeDocumentMessageData(sl3);
1139
+ else if (f3 === 2)
1140
+ hyd.imageMessage = decodeImageMessageData(sl3);
1141
+ else if (f3 === 3)
1142
+ hyd.videoMessage = decodeVideoMessageData(sl3);
1143
+ else if (f3 === 6)
1144
+ hyd.hydratedContentText = Buffer.from(sl3).toString("utf8");
1145
+ else if (f3 === 7)
1146
+ hyd.hydratedFooterText = Buffer.from(sl3).toString("utf8");
1147
+ });
1148
+ if (f2 === 1)
1149
+ tm.fourRowTemplate = hyd;
1150
+ else if (f2 === 2)
1151
+ tm.hydratedFourRowTemplate = hyd;
1152
+ else
1153
+ tm.hydratedTemplate = hyd;
1154
+ }
1155
+ else if (f2 === 3) {
1156
+ tm.contextInfo = decodeContextInfo(sl2);
1157
+ }
1158
+ });
1159
+ res.templateMessage = tm;
1160
+ }
931
1161
  else if (fn === 26) {
932
1162
  res.stickerMessage = decodeStickerMessageData(slice);
933
1163
  }
1164
+ else if (fn === 28) {
1165
+ const gim = {};
1166
+ readProtoFields(slice, (f2, sl2) => {
1167
+ if (f2 === 1)
1168
+ gim.groupJid = Buffer.from(sl2).toString("utf8");
1169
+ else if (f2 === 2)
1170
+ gim.inviteCode = Buffer.from(sl2).toString("utf8");
1171
+ else if (f2 === 4)
1172
+ gim.groupName = Buffer.from(sl2).toString("utf8");
1173
+ else if (f2 === 6)
1174
+ gim.caption = Buffer.from(sl2).toString("utf8");
1175
+ else if (f2 === 7)
1176
+ gim.contextInfo = decodeContextInfo(sl2);
1177
+ }, (f2, v2) => {
1178
+ if (f2 === 3)
1179
+ gim.inviteExpiration = v2;
1180
+ });
1181
+ res.groupInviteMessage = gim;
1182
+ }
1183
+ else if (fn === 29) {
1184
+ const tbr = {};
1185
+ readProtoFields(slice, (f2, sl2) => {
1186
+ if (f2 === 1)
1187
+ tbr.selectedId = Buffer.from(sl2).toString("utf8");
1188
+ else if (f2 === 2)
1189
+ tbr.selectedDisplayText = Buffer.from(sl2).toString("utf8");
1190
+ else if (f2 === 3)
1191
+ tbr.contextInfo = decodeContextInfo(sl2);
1192
+ }, (f2, v2) => {
1193
+ if (f2 === 4)
1194
+ tbr.selectedIndex = v2;
1195
+ });
1196
+ res.templateButtonReplyMessage = tbr;
1197
+ }
1198
+ else if (fn === 36) {
1199
+ const lm = {};
1200
+ readProtoFields(slice, (f2, sl2) => {
1201
+ if (f2 === 1)
1202
+ lm.title = Buffer.from(sl2).toString("utf8");
1203
+ else if (f2 === 2)
1204
+ lm.description = Buffer.from(sl2).toString("utf8");
1205
+ else if (f2 === 3)
1206
+ lm.buttonText = Buffer.from(sl2).toString("utf8");
1207
+ else if (f2 === 8)
1208
+ lm.contextInfo = decodeContextInfo(sl2);
1209
+ });
1210
+ res.listMessage = lm;
1211
+ }
1212
+ else if (fn === 39) {
1213
+ const lr = {};
1214
+ readProtoFields(slice, (f2, sl2) => {
1215
+ if (f2 === 1)
1216
+ lr.title = Buffer.from(sl2).toString("utf8");
1217
+ else if (f2 === 3) {
1218
+ const ssr = {};
1219
+ readProtoFields(sl2, (f3, sl3) => {
1220
+ if (f3 === 1)
1221
+ ssr.selectedRowId = Buffer.from(sl3).toString("utf8");
1222
+ });
1223
+ lr.singleSelectReply = ssr;
1224
+ }
1225
+ else if (f2 === 4)
1226
+ lr.contextInfo = decodeContextInfo(sl2);
1227
+ else if (f2 === 5)
1228
+ lr.description = Buffer.from(sl2).toString("utf8");
1229
+ }, (f2, v2) => {
1230
+ if (f2 === 2)
1231
+ lr.listType = v2;
1232
+ });
1233
+ res.listResponseMessage = lr;
1234
+ }
1235
+ else if (fn === 42) {
1236
+ const bm = {};
1237
+ readProtoFields(slice, (f2, sl2) => {
1238
+ if (f2 === 2)
1239
+ bm.documentMessage = decodeDocumentMessageData(sl2);
1240
+ else if (f2 === 3)
1241
+ bm.imageMessage = decodeImageMessageData(sl2);
1242
+ else if (f2 === 4)
1243
+ bm.videoMessage = decodeVideoMessageData(sl2);
1244
+ else if (f2 === 6)
1245
+ bm.contentText = Buffer.from(sl2).toString("utf8");
1246
+ else if (f2 === 7)
1247
+ bm.footerText = Buffer.from(sl2).toString("utf8");
1248
+ else if (f2 === 8)
1249
+ bm.contextInfo = decodeContextInfo(sl2);
1250
+ }, (f2, v2) => {
1251
+ if (f2 === 10)
1252
+ bm.headerType = v2;
1253
+ });
1254
+ res.buttonsMessage = bm;
1255
+ }
1256
+ else if (fn === 45) {
1257
+ const im = {};
1258
+ readProtoFields(slice, (f2, sl2) => {
1259
+ if (f2 === 1) {
1260
+ const hdr = {};
1261
+ readProtoFields(sl2, (f3, sl3) => {
1262
+ if (f3 === 1)
1263
+ hdr.title = Buffer.from(sl3).toString("utf8");
1264
+ else if (f3 === 2)
1265
+ hdr.subtitle = Buffer.from(sl3).toString("utf8");
1266
+ else if (f3 === 3)
1267
+ hdr.documentMessage = decodeDocumentMessageData(sl3);
1268
+ else if (f3 === 4)
1269
+ hdr.imageMessage = decodeImageMessageData(sl3);
1270
+ else if (f3 === 7)
1271
+ hdr.videoMessage = decodeVideoMessageData(sl3);
1272
+ }, (f3, v3) => {
1273
+ if (f3 === 5)
1274
+ hdr.hasMediaAttachment = v3 !== 0;
1275
+ });
1276
+ im.header = hdr;
1277
+ }
1278
+ else if (f2 === 2) {
1279
+ readProtoFields(sl2, (f3, sl3) => {
1280
+ if (f3 === 1)
1281
+ im.body = { text: Buffer.from(sl3).toString("utf8") };
1282
+ });
1283
+ }
1284
+ else if (f2 === 3) {
1285
+ readProtoFields(sl2, (f3, sl3) => {
1286
+ if (f3 === 1)
1287
+ im.footer = { text: Buffer.from(sl3).toString("utf8") };
1288
+ });
1289
+ }
1290
+ else if (f2 === 6) {
1291
+ const nfm = {};
1292
+ readProtoFields(sl2, (f3, sl3) => {
1293
+ if (f3 === 1) {
1294
+ const btn = {};
1295
+ readProtoFields(sl3, (f4, sl4) => {
1296
+ if (f4 === 1)
1297
+ btn.name = Buffer.from(sl4).toString("utf8");
1298
+ else if (f4 === 2)
1299
+ btn.buttonParamsJson = Buffer.from(sl4).toString("utf8");
1300
+ });
1301
+ (nfm.buttons ??= []).push(btn);
1302
+ }
1303
+ else if (f3 === 2) {
1304
+ nfm.messageParamsJson = Buffer.from(sl3).toString("utf8");
1305
+ }
1306
+ });
1307
+ im.nativeFlowMessage = nfm;
1308
+ }
1309
+ else if (f2 === 15) {
1310
+ im.contextInfo = decodeContextInfo(sl2);
1311
+ }
1312
+ });
1313
+ res.interactiveMessage = im;
1314
+ }
934
1315
  else if (fn === 46) {
935
1316
  const rm = {};
936
1317
  readProtoFields(slice, (f2, sl2) => {
@@ -976,6 +1357,33 @@ function decodeWAMessageData(buf) {
976
1357
  }
977
1358
  res.deviceSentMessage = ds;
978
1359
  }
1360
+ else if (fn === 35) {
1361
+ const mc = {};
1362
+ readProtoFields(slice, (f2, sl2) => {
1363
+ if (f2 === 1) {
1364
+ const dm = {};
1365
+ readProtoFields(sl2, (f3, sl3) => {
1366
+ if (f3 === 1)
1367
+ dm.senderKeyHash = Uint8Array.from(sl3);
1368
+ else if (f3 === 8)
1369
+ dm.recipientKeyHash = Uint8Array.from(sl3);
1370
+ }, (f3, v3) => {
1371
+ if (f3 === 2)
1372
+ dm.senderTimestamp = v3;
1373
+ else if (f3 === 9)
1374
+ dm.recipientTimestamp = v3;
1375
+ });
1376
+ mc.deviceListMetadata = dm;
1377
+ }
1378
+ else if (f2 === 3) {
1379
+ mc.messageSecret = Uint8Array.from(sl2);
1380
+ }
1381
+ }, (f2, v2) => {
1382
+ if (f2 === 2)
1383
+ mc.deviceListMetadataVersion = v2;
1384
+ });
1385
+ res.messageContextInfo = mc;
1386
+ }
979
1387
  else if (fn === 37) {
980
1388
  res.viewOnceMessage = decodeFutureProofMessage(slice);
981
1389
  }
@@ -1053,6 +1461,17 @@ function decodeWAMessageData(buf) {
1053
1461
  }
1054
1462
  res.interactiveResponseMessage = ir;
1055
1463
  }
1464
+ else if (fn === 50) {
1465
+ const pu = {};
1466
+ readProtoFields(slice, (f2, sl2) => {
1467
+ if (f2 === 1)
1468
+ pu.pollCreationMessageKey = decodeMessageKey(sl2);
1469
+ }, (f2, v2) => {
1470
+ if (f2 === 4)
1471
+ pu.senderTimestampMs = v2;
1472
+ });
1473
+ res.pollUpdateMessage = pu;
1474
+ }
1056
1475
  else if (fn === 53) {
1057
1476
  res.documentWithCaptionMessage = decodeFutureProofMessage(slice);
1058
1477
  }
@@ -1062,6 +1481,124 @@ function decodeWAMessageData(buf) {
1062
1481
  else if (fn === 58) {
1063
1482
  res.editedMessage = decodeFutureProofMessage(slice);
1064
1483
  }
1484
+ else if (fn === 59) {
1485
+ res.viewOnceMessageV2Extension = decodeFutureProofMessage(slice);
1486
+ }
1487
+ else if (fn === 60) {
1488
+ res.pollCreationMessageV2 = decodePollCreationMessageData(slice);
1489
+ }
1490
+ else if (fn === 62) {
1491
+ res.groupMentionedMessage = decodeFutureProofMessage(slice);
1492
+ }
1493
+ else if (fn === 63) {
1494
+ const pic = {};
1495
+ readProtoFields(slice, (f2, sl2) => {
1496
+ if (f2 === 1)
1497
+ pic.key = decodeMessageKey(sl2);
1498
+ }, (f2, v2) => {
1499
+ if (f2 === 2)
1500
+ pic.type = v2;
1501
+ else if (f2 === 3)
1502
+ pic.senderTimestampMs = v2;
1503
+ });
1504
+ res.pinInChatMessage = pic;
1505
+ }
1506
+ else if (fn === 67) {
1507
+ res.botInvokeMessage = decodeFutureProofMessage(slice);
1508
+ }
1509
+ else if (fn === 74) {
1510
+ res.lottieStickerMessage = decodeFutureProofMessage(slice);
1511
+ }
1512
+ else if (fn === 75) {
1513
+ const evm = {};
1514
+ readProtoFields(slice, (f2, sl2) => {
1515
+ if (f2 === 1)
1516
+ evm.contextInfo = decodeContextInfo(sl2);
1517
+ else if (f2 === 3)
1518
+ evm.name = Buffer.from(sl2).toString("utf8");
1519
+ else if (f2 === 4)
1520
+ evm.description = Buffer.from(sl2).toString("utf8");
1521
+ else if (f2 === 6)
1522
+ evm.joinLink = Buffer.from(sl2).toString("utf8");
1523
+ }, (f2, v2) => {
1524
+ if (f2 === 2)
1525
+ evm.isCanceled = v2 !== 0;
1526
+ else if (f2 === 7)
1527
+ evm.startTime = v2;
1528
+ else if (f2 === 8)
1529
+ evm.endTime = v2;
1530
+ });
1531
+ res.eventMessage = evm;
1532
+ }
1533
+ else if (fn === 83) {
1534
+ const am = {};
1535
+ readProtoFields(slice, (f2, sl2) => {
1536
+ if (f2 === 17)
1537
+ am.contextInfo = decodeContextInfo(sl2);
1538
+ }, (f2, v2) => {
1539
+ if (f2 === 2)
1540
+ am.expectedImageCount = v2;
1541
+ else if (f2 === 3)
1542
+ am.expectedVideoCount = v2;
1543
+ });
1544
+ res.albumMessage = am;
1545
+ }
1546
+ else if (fn === 85) {
1547
+ res.eventCoverImage = decodeFutureProofMessage(slice);
1548
+ }
1549
+ else if (fn === 86) {
1550
+ const sp = {};
1551
+ readProtoFields(slice, (f2, sl2) => {
1552
+ if (f2 === 1)
1553
+ sp.stickerPackId = Buffer.from(sl2).toString("utf8");
1554
+ else if (f2 === 2)
1555
+ sp.name = Buffer.from(sl2).toString("utf8");
1556
+ else if (f2 === 3)
1557
+ sp.publisher = Buffer.from(sl2).toString("utf8");
1558
+ else if (f2 === 6)
1559
+ sp.fileSha256 = Uint8Array.from(sl2);
1560
+ else if (f2 === 7)
1561
+ sp.fileEncSha256 = Uint8Array.from(sl2);
1562
+ else if (f2 === 8)
1563
+ sp.mediaKey = Uint8Array.from(sl2);
1564
+ else if (f2 === 9)
1565
+ sp.directPath = Buffer.from(sl2).toString("utf8");
1566
+ }, (f2, v2) => {
1567
+ if (f2 === 5)
1568
+ sp.fileLength = v2;
1569
+ });
1570
+ res.stickerPackMessage = sp;
1571
+ }
1572
+ else if (fn === 87) {
1573
+ res.statusMentionMessage = decodeFutureProofMessage(slice);
1574
+ }
1575
+ else if (fn === 90) {
1576
+ res.pollCreationOptionImageMessage = decodeFutureProofMessage(slice);
1577
+ }
1578
+ else if (fn === 91) {
1579
+ res.associatedChildMessage = decodeFutureProofMessage(slice);
1580
+ }
1581
+ else if (fn === 92) {
1582
+ res.groupStatusMentionMessage = decodeFutureProofMessage(slice);
1583
+ }
1584
+ else if (fn === 93) {
1585
+ res.pollCreationMessageV4 = decodeFutureProofMessage(slice);
1586
+ }
1587
+ else if (fn === 96) {
1588
+ res.groupStatusMessage = decodeFutureProofMessage(slice);
1589
+ }
1590
+ else if (fn === 103) {
1591
+ res.groupStatusMessageV2 = decodeFutureProofMessage(slice);
1592
+ }
1593
+ else if (fn === 104) {
1594
+ res.botForwardedMessage = decodeFutureProofMessage(slice);
1595
+ }
1596
+ else if (fn === 111) {
1597
+ res.pollCreationMessageV5 = decodePollCreationMessageData(slice);
1598
+ }
1599
+ else if (fn === 134) {
1600
+ res.audioStickerMessage = { message: decodeAudioStickerMessage(slice) };
1601
+ }
1065
1602
  }
1066
1603
  else if (wt === 0) {
1067
1604
  readVarint(buf, state);