@rosyn/whats 0.1.2 → 0.1.4
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/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/dist/compat/extensions.d.ts +7 -0
- package/dist/compat/extensions.d.ts.map +1 -1
- package/dist/compat/extensions.js +51 -3
- package/dist/compat/extensions.js.map +1 -1
- package/dist/compat/index.d.ts +1 -1
- package/dist/compat/index.d.ts.map +1 -1
- package/dist/compat/index.js +312 -146
- package/dist/compat/index.js.map +1 -1
- package/dist/media/index.d.ts +1 -1
- package/dist/media/index.d.ts.map +1 -1
- package/dist/media/index.js +12 -3
- package/dist/media/index.js.map +1 -1
- package/dist/proto/index.d.ts +131 -0
- package/dist/proto/index.d.ts.map +1 -1
- package/dist/proto/index.js +467 -6
- package/dist/proto/index.js.map +1 -1
- package/dist/protocol/jid.d.ts.map +1 -1
- package/dist/protocol/jid.js +9 -1
- package/dist/protocol/jid.js.map +1 -1
- package/dist/protocol/wabin.d.ts.map +1 -1
- package/dist/protocol/wabin.js +61 -9
- package/dist/protocol/wabin.js.map +1 -1
- package/dist/signal/protocol.d.ts +1 -0
- package/dist/signal/protocol.d.ts.map +1 -1
- package/dist/signal/protocol.js +105 -11
- package/dist/signal/protocol.js.map +1 -1
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.d.ts.map +1 -1
- package/dist/storage/index.js.map +1 -1
- package/native/rosyn_whats_engine.node +0 -0
- package/package.json +1 -1
package/dist/proto/index.js
CHANGED
|
@@ -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 =
|
|
38
|
-
let shift =
|
|
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
|
|
44
|
-
shift +=
|
|
43
|
+
return Number(result);
|
|
44
|
+
shift += 7n;
|
|
45
45
|
}
|
|
46
46
|
throw new Error("Truncated varint in protobuf");
|
|
47
47
|
}
|
|
@@ -421,6 +421,42 @@ function encodeWAMessageData(msg) {
|
|
|
421
421
|
if (msg.pollCreationMessageV3) {
|
|
422
422
|
writeBytesField(out, 64, encodePollCreationMessageData(msg.pollCreationMessageV3));
|
|
423
423
|
}
|
|
424
|
+
const encodeFutureProof = (inner) => {
|
|
425
|
+
const fp = [];
|
|
426
|
+
writeBytesField(fp, 1, encodeWAMessageData(inner));
|
|
427
|
+
return Uint8Array.from(fp);
|
|
428
|
+
};
|
|
429
|
+
if (msg.messageContextInfo) {
|
|
430
|
+
const mc = [];
|
|
431
|
+
const m = msg.messageContextInfo;
|
|
432
|
+
if (m.deviceListMetadata) {
|
|
433
|
+
const dm = [];
|
|
434
|
+
if (m.deviceListMetadata.senderKeyHash)
|
|
435
|
+
writeBytesField(dm, 1, m.deviceListMetadata.senderKeyHash);
|
|
436
|
+
if (m.deviceListMetadata.senderTimestamp !== undefined)
|
|
437
|
+
writeVarintField64(dm, 2, m.deviceListMetadata.senderTimestamp);
|
|
438
|
+
if (m.deviceListMetadata.recipientKeyHash)
|
|
439
|
+
writeBytesField(dm, 8, m.deviceListMetadata.recipientKeyHash);
|
|
440
|
+
if (m.deviceListMetadata.recipientTimestamp !== undefined)
|
|
441
|
+
writeVarintField64(dm, 9, m.deviceListMetadata.recipientTimestamp);
|
|
442
|
+
writeBytesField(mc, 1, Uint8Array.from(dm));
|
|
443
|
+
}
|
|
444
|
+
if (m.deviceListMetadataVersion !== undefined)
|
|
445
|
+
writeVarintField(mc, 2, m.deviceListMetadataVersion);
|
|
446
|
+
if (m.messageSecret)
|
|
447
|
+
writeBytesField(mc, 3, m.messageSecret);
|
|
448
|
+
writeBytesField(out, 35, Uint8Array.from(mc));
|
|
449
|
+
}
|
|
450
|
+
if (msg.viewOnceMessage?.message)
|
|
451
|
+
writeBytesField(out, 37, encodeFutureProof(msg.viewOnceMessage.message));
|
|
452
|
+
if (msg.ephemeralMessage?.message)
|
|
453
|
+
writeBytesField(out, 40, encodeFutureProof(msg.ephemeralMessage.message));
|
|
454
|
+
if (msg.documentWithCaptionMessage?.message)
|
|
455
|
+
writeBytesField(out, 53, encodeFutureProof(msg.documentWithCaptionMessage.message));
|
|
456
|
+
if (msg.viewOnceMessageV2?.message)
|
|
457
|
+
writeBytesField(out, 55, encodeFutureProof(msg.viewOnceMessageV2.message));
|
|
458
|
+
if (msg.editedMessage?.message)
|
|
459
|
+
writeBytesField(out, 58, encodeFutureProof(msg.editedMessage.message));
|
|
424
460
|
if (msg.stickerPackMessage) {
|
|
425
461
|
const sp = [];
|
|
426
462
|
const s = msg.stickerPackMessage;
|
|
@@ -631,6 +667,29 @@ function decodeContextInfo(buf) {
|
|
|
631
667
|
res.remoteJid = Buffer.from(slice).toString("utf8");
|
|
632
668
|
else if (fn === 15)
|
|
633
669
|
(res.mentionedJid ??= []).push(Buffer.from(slice).toString("utf8"));
|
|
670
|
+
else if (fn === 40) {
|
|
671
|
+
const gm = {};
|
|
672
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
673
|
+
if (f2 === 1)
|
|
674
|
+
gm.groupJid = Buffer.from(sl2).toString("utf8");
|
|
675
|
+
else if (f2 === 2)
|
|
676
|
+
gm.groupSubject = Buffer.from(sl2).toString("utf8");
|
|
677
|
+
});
|
|
678
|
+
(res.groupMentions ??= []).push(gm);
|
|
679
|
+
}
|
|
680
|
+
else if (fn === 43) {
|
|
681
|
+
const fnm = {};
|
|
682
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
683
|
+
if (f2 === 1)
|
|
684
|
+
fnm.newsletterJid = Buffer.from(sl2).toString("utf8");
|
|
685
|
+
else if (f2 === 3)
|
|
686
|
+
fnm.newsletterName = Buffer.from(sl2).toString("utf8");
|
|
687
|
+
}, (f2, v2) => {
|
|
688
|
+
if (f2 === 2)
|
|
689
|
+
fnm.serverMessageId = v2;
|
|
690
|
+
});
|
|
691
|
+
res.forwardedNewsletterMessageInfo = fnm;
|
|
692
|
+
}
|
|
634
693
|
}, (fn, val) => {
|
|
635
694
|
if (fn === 21)
|
|
636
695
|
res.forwardingScore = val;
|
|
@@ -660,14 +719,22 @@ function decodeImageMessageData(buf) {
|
|
|
660
719
|
res.fileEncSha256 = Uint8Array.from(slice);
|
|
661
720
|
else if (fn === 11)
|
|
662
721
|
res.directPath = Buffer.from(slice).toString("utf8");
|
|
722
|
+
else if (fn === 16)
|
|
723
|
+
res.jpegThumbnail = Uint8Array.from(slice);
|
|
663
724
|
else if (fn === 17)
|
|
664
725
|
res.contextInfo = decodeContextInfo(slice);
|
|
665
726
|
}, (fn, val) => {
|
|
666
727
|
if (fn === 5)
|
|
667
728
|
res.fileLength = val;
|
|
729
|
+
else if (fn === 6)
|
|
730
|
+
res.height = val;
|
|
731
|
+
else if (fn === 7)
|
|
732
|
+
res.width = val;
|
|
668
733
|
else if (fn === 12)
|
|
669
734
|
res.mediaKeyTimestamp = val;
|
|
670
735
|
});
|
|
736
|
+
if (!res.mimetype && (res.url || res.directPath))
|
|
737
|
+
res.mimetype = "image/jpeg";
|
|
671
738
|
return res;
|
|
672
739
|
}
|
|
673
740
|
function decodeVideoMessageData(buf) {
|
|
@@ -687,16 +754,26 @@ function decodeVideoMessageData(buf) {
|
|
|
687
754
|
res.fileEncSha256 = Uint8Array.from(slice);
|
|
688
755
|
else if (fn === 13)
|
|
689
756
|
res.directPath = Buffer.from(slice).toString("utf8");
|
|
757
|
+
else if (fn === 16)
|
|
758
|
+
res.jpegThumbnail = Uint8Array.from(slice);
|
|
690
759
|
else if (fn === 17)
|
|
691
760
|
res.contextInfo = decodeContextInfo(slice);
|
|
692
761
|
}, (fn, val) => {
|
|
693
762
|
if (fn === 4)
|
|
694
763
|
res.fileLength = val;
|
|
764
|
+
else if (fn === 5)
|
|
765
|
+
res.seconds = val;
|
|
695
766
|
else if (fn === 8)
|
|
696
767
|
res.gifPlayback = val !== 0;
|
|
768
|
+
else if (fn === 9)
|
|
769
|
+
res.height = val;
|
|
770
|
+
else if (fn === 10)
|
|
771
|
+
res.width = val;
|
|
697
772
|
else if (fn === 14)
|
|
698
773
|
res.mediaKeyTimestamp = val;
|
|
699
774
|
});
|
|
775
|
+
if (!res.mimetype && (res.url || res.directPath))
|
|
776
|
+
res.mimetype = "video/mp4";
|
|
700
777
|
return res;
|
|
701
778
|
}
|
|
702
779
|
function decodeAudioMessageData(buf) {
|
|
@@ -728,6 +805,9 @@ function decodeAudioMessageData(buf) {
|
|
|
728
805
|
else if (fn === 10)
|
|
729
806
|
res.mediaKeyTimestamp = val;
|
|
730
807
|
});
|
|
808
|
+
if (!res.mimetype && (res.url || res.directPath)) {
|
|
809
|
+
res.mimetype = res.ptt ? "audio/ogg; codecs=opus" : "audio/mpeg";
|
|
810
|
+
}
|
|
731
811
|
return res;
|
|
732
812
|
}
|
|
733
813
|
function decodeDocumentMessageData(buf) {
|
|
@@ -776,16 +856,30 @@ function decodeStickerMessageData(buf) {
|
|
|
776
856
|
res.mimetype = Buffer.from(slice).toString("utf8");
|
|
777
857
|
else if (fn === 8)
|
|
778
858
|
res.directPath = Buffer.from(slice).toString("utf8");
|
|
859
|
+
else if (fn === 16)
|
|
860
|
+
res.pngThumbnail = Uint8Array.from(slice);
|
|
779
861
|
else if (fn === 17)
|
|
780
862
|
res.contextInfo = decodeContextInfo(slice);
|
|
781
863
|
}, (fn, val) => {
|
|
782
|
-
if (fn ===
|
|
864
|
+
if (fn === 6)
|
|
865
|
+
res.height = val;
|
|
866
|
+
else if (fn === 7)
|
|
867
|
+
res.width = val;
|
|
868
|
+
else if (fn === 9)
|
|
783
869
|
res.fileLength = val;
|
|
784
870
|
else if (fn === 10)
|
|
785
871
|
res.mediaKeyTimestamp = val;
|
|
786
872
|
else if (fn === 13)
|
|
787
873
|
res.isAnimated = val !== 0;
|
|
874
|
+
else if (fn === 19)
|
|
875
|
+
res.isAvatar = val !== 0;
|
|
876
|
+
else if (fn === 20)
|
|
877
|
+
res.isAiSticker = val !== 0;
|
|
878
|
+
else if (fn === 21)
|
|
879
|
+
res.isLottie = val !== 0;
|
|
788
880
|
});
|
|
881
|
+
if (!res.mimetype)
|
|
882
|
+
res.mimetype = "image/webp";
|
|
789
883
|
return res;
|
|
790
884
|
}
|
|
791
885
|
function decodeFutureProofMessage(buf) {
|
|
@@ -928,9 +1022,223 @@ function decodeWAMessageData(buf) {
|
|
|
928
1022
|
});
|
|
929
1023
|
res.contactsArrayMessage = ca;
|
|
930
1024
|
}
|
|
1025
|
+
else if (fn === 15) {
|
|
1026
|
+
const sk = {};
|
|
1027
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1028
|
+
if (f2 === 1)
|
|
1029
|
+
sk.groupId = Buffer.from(sl2).toString("utf8");
|
|
1030
|
+
else if (f2 === 2)
|
|
1031
|
+
sk.axolotlSenderKeyDistributionMessage = Uint8Array.from(sl2);
|
|
1032
|
+
});
|
|
1033
|
+
res.fastRatchetKeySenderKeyDistributionMessage = sk;
|
|
1034
|
+
}
|
|
1035
|
+
else if (fn === 18) {
|
|
1036
|
+
const llm = {};
|
|
1037
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1038
|
+
if (f2 === 6)
|
|
1039
|
+
llm.caption = Buffer.from(sl2).toString("utf8");
|
|
1040
|
+
else if (f2 === 16)
|
|
1041
|
+
llm.jpegThumbnail = Uint8Array.from(sl2);
|
|
1042
|
+
else if (f2 === 17)
|
|
1043
|
+
llm.contextInfo = decodeContextInfo(sl2);
|
|
1044
|
+
}, (f2, v2) => {
|
|
1045
|
+
if (f2 === 3)
|
|
1046
|
+
llm.accuracyInMeters = v2;
|
|
1047
|
+
else if (f2 === 7)
|
|
1048
|
+
llm.sequenceNumber = v2;
|
|
1049
|
+
}, (f2, sl2) => {
|
|
1050
|
+
const val = Buffer.from(sl2).readDoubleLE(0);
|
|
1051
|
+
if (f2 === 1)
|
|
1052
|
+
llm.degreesLatitude = val;
|
|
1053
|
+
else if (f2 === 2)
|
|
1054
|
+
llm.degreesLongitude = val;
|
|
1055
|
+
});
|
|
1056
|
+
res.liveLocationMessage = llm;
|
|
1057
|
+
}
|
|
1058
|
+
else if (fn === 25) {
|
|
1059
|
+
const tm = {};
|
|
1060
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1061
|
+
if (f2 === 1 || f2 === 2 || f2 === 5) {
|
|
1062
|
+
const hyd = {};
|
|
1063
|
+
readProtoFields(sl2, (f3, sl3) => {
|
|
1064
|
+
if (f3 === 1)
|
|
1065
|
+
hyd.documentMessage = decodeDocumentMessageData(sl3);
|
|
1066
|
+
else if (f3 === 2)
|
|
1067
|
+
hyd.imageMessage = decodeImageMessageData(sl3);
|
|
1068
|
+
else if (f3 === 3)
|
|
1069
|
+
hyd.videoMessage = decodeVideoMessageData(sl3);
|
|
1070
|
+
else if (f3 === 6)
|
|
1071
|
+
hyd.hydratedContentText = Buffer.from(sl3).toString("utf8");
|
|
1072
|
+
else if (f3 === 7)
|
|
1073
|
+
hyd.hydratedFooterText = Buffer.from(sl3).toString("utf8");
|
|
1074
|
+
});
|
|
1075
|
+
if (f2 === 1)
|
|
1076
|
+
tm.fourRowTemplate = hyd;
|
|
1077
|
+
else if (f2 === 2)
|
|
1078
|
+
tm.hydratedFourRowTemplate = hyd;
|
|
1079
|
+
else
|
|
1080
|
+
tm.hydratedTemplate = hyd;
|
|
1081
|
+
}
|
|
1082
|
+
else if (f2 === 3) {
|
|
1083
|
+
tm.contextInfo = decodeContextInfo(sl2);
|
|
1084
|
+
}
|
|
1085
|
+
});
|
|
1086
|
+
res.templateMessage = tm;
|
|
1087
|
+
}
|
|
931
1088
|
else if (fn === 26) {
|
|
932
1089
|
res.stickerMessage = decodeStickerMessageData(slice);
|
|
933
1090
|
}
|
|
1091
|
+
else if (fn === 28) {
|
|
1092
|
+
const gim = {};
|
|
1093
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1094
|
+
if (f2 === 1)
|
|
1095
|
+
gim.groupJid = Buffer.from(sl2).toString("utf8");
|
|
1096
|
+
else if (f2 === 2)
|
|
1097
|
+
gim.inviteCode = Buffer.from(sl2).toString("utf8");
|
|
1098
|
+
else if (f2 === 4)
|
|
1099
|
+
gim.groupName = Buffer.from(sl2).toString("utf8");
|
|
1100
|
+
else if (f2 === 6)
|
|
1101
|
+
gim.caption = Buffer.from(sl2).toString("utf8");
|
|
1102
|
+
else if (f2 === 7)
|
|
1103
|
+
gim.contextInfo = decodeContextInfo(sl2);
|
|
1104
|
+
}, (f2, v2) => {
|
|
1105
|
+
if (f2 === 3)
|
|
1106
|
+
gim.inviteExpiration = v2;
|
|
1107
|
+
});
|
|
1108
|
+
res.groupInviteMessage = gim;
|
|
1109
|
+
}
|
|
1110
|
+
else if (fn === 29) {
|
|
1111
|
+
const tbr = {};
|
|
1112
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1113
|
+
if (f2 === 1)
|
|
1114
|
+
tbr.selectedId = Buffer.from(sl2).toString("utf8");
|
|
1115
|
+
else if (f2 === 2)
|
|
1116
|
+
tbr.selectedDisplayText = Buffer.from(sl2).toString("utf8");
|
|
1117
|
+
else if (f2 === 3)
|
|
1118
|
+
tbr.contextInfo = decodeContextInfo(sl2);
|
|
1119
|
+
}, (f2, v2) => {
|
|
1120
|
+
if (f2 === 4)
|
|
1121
|
+
tbr.selectedIndex = v2;
|
|
1122
|
+
});
|
|
1123
|
+
res.templateButtonReplyMessage = tbr;
|
|
1124
|
+
}
|
|
1125
|
+
else if (fn === 36) {
|
|
1126
|
+
const lm = {};
|
|
1127
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1128
|
+
if (f2 === 1)
|
|
1129
|
+
lm.title = Buffer.from(sl2).toString("utf8");
|
|
1130
|
+
else if (f2 === 2)
|
|
1131
|
+
lm.description = Buffer.from(sl2).toString("utf8");
|
|
1132
|
+
else if (f2 === 3)
|
|
1133
|
+
lm.buttonText = Buffer.from(sl2).toString("utf8");
|
|
1134
|
+
else if (f2 === 8)
|
|
1135
|
+
lm.contextInfo = decodeContextInfo(sl2);
|
|
1136
|
+
});
|
|
1137
|
+
res.listMessage = lm;
|
|
1138
|
+
}
|
|
1139
|
+
else if (fn === 39) {
|
|
1140
|
+
const lr = {};
|
|
1141
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1142
|
+
if (f2 === 1)
|
|
1143
|
+
lr.title = Buffer.from(sl2).toString("utf8");
|
|
1144
|
+
else if (f2 === 3) {
|
|
1145
|
+
const ssr = {};
|
|
1146
|
+
readProtoFields(sl2, (f3, sl3) => {
|
|
1147
|
+
if (f3 === 1)
|
|
1148
|
+
ssr.selectedRowId = Buffer.from(sl3).toString("utf8");
|
|
1149
|
+
});
|
|
1150
|
+
lr.singleSelectReply = ssr;
|
|
1151
|
+
}
|
|
1152
|
+
else if (f2 === 4)
|
|
1153
|
+
lr.contextInfo = decodeContextInfo(sl2);
|
|
1154
|
+
else if (f2 === 5)
|
|
1155
|
+
lr.description = Buffer.from(sl2).toString("utf8");
|
|
1156
|
+
}, (f2, v2) => {
|
|
1157
|
+
if (f2 === 2)
|
|
1158
|
+
lr.listType = v2;
|
|
1159
|
+
});
|
|
1160
|
+
res.listResponseMessage = lr;
|
|
1161
|
+
}
|
|
1162
|
+
else if (fn === 42) {
|
|
1163
|
+
const bm = {};
|
|
1164
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1165
|
+
if (f2 === 2)
|
|
1166
|
+
bm.documentMessage = decodeDocumentMessageData(sl2);
|
|
1167
|
+
else if (f2 === 3)
|
|
1168
|
+
bm.imageMessage = decodeImageMessageData(sl2);
|
|
1169
|
+
else if (f2 === 4)
|
|
1170
|
+
bm.videoMessage = decodeVideoMessageData(sl2);
|
|
1171
|
+
else if (f2 === 6)
|
|
1172
|
+
bm.contentText = Buffer.from(sl2).toString("utf8");
|
|
1173
|
+
else if (f2 === 7)
|
|
1174
|
+
bm.footerText = Buffer.from(sl2).toString("utf8");
|
|
1175
|
+
else if (f2 === 8)
|
|
1176
|
+
bm.contextInfo = decodeContextInfo(sl2);
|
|
1177
|
+
}, (f2, v2) => {
|
|
1178
|
+
if (f2 === 10)
|
|
1179
|
+
bm.headerType = v2;
|
|
1180
|
+
});
|
|
1181
|
+
res.buttonsMessage = bm;
|
|
1182
|
+
}
|
|
1183
|
+
else if (fn === 45) {
|
|
1184
|
+
const im = {};
|
|
1185
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1186
|
+
if (f2 === 1) {
|
|
1187
|
+
const hdr = {};
|
|
1188
|
+
readProtoFields(sl2, (f3, sl3) => {
|
|
1189
|
+
if (f3 === 1)
|
|
1190
|
+
hdr.title = Buffer.from(sl3).toString("utf8");
|
|
1191
|
+
else if (f3 === 2)
|
|
1192
|
+
hdr.subtitle = Buffer.from(sl3).toString("utf8");
|
|
1193
|
+
else if (f3 === 3)
|
|
1194
|
+
hdr.documentMessage = decodeDocumentMessageData(sl3);
|
|
1195
|
+
else if (f3 === 4)
|
|
1196
|
+
hdr.imageMessage = decodeImageMessageData(sl3);
|
|
1197
|
+
else if (f3 === 7)
|
|
1198
|
+
hdr.videoMessage = decodeVideoMessageData(sl3);
|
|
1199
|
+
}, (f3, v3) => {
|
|
1200
|
+
if (f3 === 5)
|
|
1201
|
+
hdr.hasMediaAttachment = v3 !== 0;
|
|
1202
|
+
});
|
|
1203
|
+
im.header = hdr;
|
|
1204
|
+
}
|
|
1205
|
+
else if (f2 === 2) {
|
|
1206
|
+
readProtoFields(sl2, (f3, sl3) => {
|
|
1207
|
+
if (f3 === 1)
|
|
1208
|
+
im.body = { text: Buffer.from(sl3).toString("utf8") };
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
else if (f2 === 3) {
|
|
1212
|
+
readProtoFields(sl2, (f3, sl3) => {
|
|
1213
|
+
if (f3 === 1)
|
|
1214
|
+
im.footer = { text: Buffer.from(sl3).toString("utf8") };
|
|
1215
|
+
});
|
|
1216
|
+
}
|
|
1217
|
+
else if (f2 === 6) {
|
|
1218
|
+
const nfm = {};
|
|
1219
|
+
readProtoFields(sl2, (f3, sl3) => {
|
|
1220
|
+
if (f3 === 1) {
|
|
1221
|
+
const btn = {};
|
|
1222
|
+
readProtoFields(sl3, (f4, sl4) => {
|
|
1223
|
+
if (f4 === 1)
|
|
1224
|
+
btn.name = Buffer.from(sl4).toString("utf8");
|
|
1225
|
+
else if (f4 === 2)
|
|
1226
|
+
btn.buttonParamsJson = Buffer.from(sl4).toString("utf8");
|
|
1227
|
+
});
|
|
1228
|
+
(nfm.buttons ??= []).push(btn);
|
|
1229
|
+
}
|
|
1230
|
+
else if (f3 === 2) {
|
|
1231
|
+
nfm.messageParamsJson = Buffer.from(sl3).toString("utf8");
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
im.nativeFlowMessage = nfm;
|
|
1235
|
+
}
|
|
1236
|
+
else if (f2 === 15) {
|
|
1237
|
+
im.contextInfo = decodeContextInfo(sl2);
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
res.interactiveMessage = im;
|
|
1241
|
+
}
|
|
934
1242
|
else if (fn === 46) {
|
|
935
1243
|
const rm = {};
|
|
936
1244
|
readProtoFields(slice, (f2, sl2) => {
|
|
@@ -976,6 +1284,33 @@ function decodeWAMessageData(buf) {
|
|
|
976
1284
|
}
|
|
977
1285
|
res.deviceSentMessage = ds;
|
|
978
1286
|
}
|
|
1287
|
+
else if (fn === 35) {
|
|
1288
|
+
const mc = {};
|
|
1289
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1290
|
+
if (f2 === 1) {
|
|
1291
|
+
const dm = {};
|
|
1292
|
+
readProtoFields(sl2, (f3, sl3) => {
|
|
1293
|
+
if (f3 === 1)
|
|
1294
|
+
dm.senderKeyHash = Uint8Array.from(sl3);
|
|
1295
|
+
else if (f3 === 8)
|
|
1296
|
+
dm.recipientKeyHash = Uint8Array.from(sl3);
|
|
1297
|
+
}, (f3, v3) => {
|
|
1298
|
+
if (f3 === 2)
|
|
1299
|
+
dm.senderTimestamp = v3;
|
|
1300
|
+
else if (f3 === 9)
|
|
1301
|
+
dm.recipientTimestamp = v3;
|
|
1302
|
+
});
|
|
1303
|
+
mc.deviceListMetadata = dm;
|
|
1304
|
+
}
|
|
1305
|
+
else if (f2 === 3) {
|
|
1306
|
+
mc.messageSecret = Uint8Array.from(sl2);
|
|
1307
|
+
}
|
|
1308
|
+
}, (f2, v2) => {
|
|
1309
|
+
if (f2 === 2)
|
|
1310
|
+
mc.deviceListMetadataVersion = v2;
|
|
1311
|
+
});
|
|
1312
|
+
res.messageContextInfo = mc;
|
|
1313
|
+
}
|
|
979
1314
|
else if (fn === 37) {
|
|
980
1315
|
res.viewOnceMessage = decodeFutureProofMessage(slice);
|
|
981
1316
|
}
|
|
@@ -1053,6 +1388,17 @@ function decodeWAMessageData(buf) {
|
|
|
1053
1388
|
}
|
|
1054
1389
|
res.interactiveResponseMessage = ir;
|
|
1055
1390
|
}
|
|
1391
|
+
else if (fn === 50) {
|
|
1392
|
+
const pu = {};
|
|
1393
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1394
|
+
if (f2 === 1)
|
|
1395
|
+
pu.pollCreationMessageKey = decodeMessageKey(sl2);
|
|
1396
|
+
}, (f2, v2) => {
|
|
1397
|
+
if (f2 === 4)
|
|
1398
|
+
pu.senderTimestampMs = v2;
|
|
1399
|
+
});
|
|
1400
|
+
res.pollUpdateMessage = pu;
|
|
1401
|
+
}
|
|
1056
1402
|
else if (fn === 53) {
|
|
1057
1403
|
res.documentWithCaptionMessage = decodeFutureProofMessage(slice);
|
|
1058
1404
|
}
|
|
@@ -1062,6 +1408,121 @@ function decodeWAMessageData(buf) {
|
|
|
1062
1408
|
else if (fn === 58) {
|
|
1063
1409
|
res.editedMessage = decodeFutureProofMessage(slice);
|
|
1064
1410
|
}
|
|
1411
|
+
else if (fn === 59) {
|
|
1412
|
+
res.viewOnceMessageV2Extension = decodeFutureProofMessage(slice);
|
|
1413
|
+
}
|
|
1414
|
+
else if (fn === 60) {
|
|
1415
|
+
res.pollCreationMessageV2 = decodePollCreationMessageData(slice);
|
|
1416
|
+
}
|
|
1417
|
+
else if (fn === 62) {
|
|
1418
|
+
res.groupMentionedMessage = decodeFutureProofMessage(slice);
|
|
1419
|
+
}
|
|
1420
|
+
else if (fn === 63) {
|
|
1421
|
+
const pic = {};
|
|
1422
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1423
|
+
if (f2 === 1)
|
|
1424
|
+
pic.key = decodeMessageKey(sl2);
|
|
1425
|
+
}, (f2, v2) => {
|
|
1426
|
+
if (f2 === 2)
|
|
1427
|
+
pic.type = v2;
|
|
1428
|
+
else if (f2 === 3)
|
|
1429
|
+
pic.senderTimestampMs = v2;
|
|
1430
|
+
});
|
|
1431
|
+
res.pinInChatMessage = pic;
|
|
1432
|
+
}
|
|
1433
|
+
else if (fn === 67) {
|
|
1434
|
+
res.botInvokeMessage = decodeFutureProofMessage(slice);
|
|
1435
|
+
}
|
|
1436
|
+
else if (fn === 74) {
|
|
1437
|
+
res.lottieStickerMessage = decodeFutureProofMessage(slice);
|
|
1438
|
+
}
|
|
1439
|
+
else if (fn === 75) {
|
|
1440
|
+
const evm = {};
|
|
1441
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1442
|
+
if (f2 === 1)
|
|
1443
|
+
evm.contextInfo = decodeContextInfo(sl2);
|
|
1444
|
+
else if (f2 === 3)
|
|
1445
|
+
evm.name = Buffer.from(sl2).toString("utf8");
|
|
1446
|
+
else if (f2 === 4)
|
|
1447
|
+
evm.description = Buffer.from(sl2).toString("utf8");
|
|
1448
|
+
else if (f2 === 6)
|
|
1449
|
+
evm.joinLink = Buffer.from(sl2).toString("utf8");
|
|
1450
|
+
}, (f2, v2) => {
|
|
1451
|
+
if (f2 === 2)
|
|
1452
|
+
evm.isCanceled = v2 !== 0;
|
|
1453
|
+
else if (f2 === 7)
|
|
1454
|
+
evm.startTime = v2;
|
|
1455
|
+
else if (f2 === 8)
|
|
1456
|
+
evm.endTime = v2;
|
|
1457
|
+
});
|
|
1458
|
+
res.eventMessage = evm;
|
|
1459
|
+
}
|
|
1460
|
+
else if (fn === 83) {
|
|
1461
|
+
const am = {};
|
|
1462
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1463
|
+
if (f2 === 17)
|
|
1464
|
+
am.contextInfo = decodeContextInfo(sl2);
|
|
1465
|
+
}, (f2, v2) => {
|
|
1466
|
+
if (f2 === 2)
|
|
1467
|
+
am.expectedImageCount = v2;
|
|
1468
|
+
else if (f2 === 3)
|
|
1469
|
+
am.expectedVideoCount = v2;
|
|
1470
|
+
});
|
|
1471
|
+
res.albumMessage = am;
|
|
1472
|
+
}
|
|
1473
|
+
else if (fn === 85) {
|
|
1474
|
+
res.eventCoverImage = decodeFutureProofMessage(slice);
|
|
1475
|
+
}
|
|
1476
|
+
else if (fn === 86) {
|
|
1477
|
+
const sp = {};
|
|
1478
|
+
readProtoFields(slice, (f2, sl2) => {
|
|
1479
|
+
if (f2 === 1)
|
|
1480
|
+
sp.stickerPackId = Buffer.from(sl2).toString("utf8");
|
|
1481
|
+
else if (f2 === 2)
|
|
1482
|
+
sp.name = Buffer.from(sl2).toString("utf8");
|
|
1483
|
+
else if (f2 === 3)
|
|
1484
|
+
sp.publisher = Buffer.from(sl2).toString("utf8");
|
|
1485
|
+
else if (f2 === 6)
|
|
1486
|
+
sp.fileSha256 = Uint8Array.from(sl2);
|
|
1487
|
+
else if (f2 === 7)
|
|
1488
|
+
sp.fileEncSha256 = Uint8Array.from(sl2);
|
|
1489
|
+
else if (f2 === 8)
|
|
1490
|
+
sp.mediaKey = Uint8Array.from(sl2);
|
|
1491
|
+
else if (f2 === 9)
|
|
1492
|
+
sp.directPath = Buffer.from(sl2).toString("utf8");
|
|
1493
|
+
}, (f2, v2) => {
|
|
1494
|
+
if (f2 === 5)
|
|
1495
|
+
sp.fileLength = v2;
|
|
1496
|
+
});
|
|
1497
|
+
res.stickerPackMessage = sp;
|
|
1498
|
+
}
|
|
1499
|
+
else if (fn === 87) {
|
|
1500
|
+
res.statusMentionMessage = decodeFutureProofMessage(slice);
|
|
1501
|
+
}
|
|
1502
|
+
else if (fn === 90) {
|
|
1503
|
+
res.pollCreationOptionImageMessage = decodeFutureProofMessage(slice);
|
|
1504
|
+
}
|
|
1505
|
+
else if (fn === 91) {
|
|
1506
|
+
res.associatedChildMessage = decodeFutureProofMessage(slice);
|
|
1507
|
+
}
|
|
1508
|
+
else if (fn === 92) {
|
|
1509
|
+
res.groupStatusMentionMessage = decodeFutureProofMessage(slice);
|
|
1510
|
+
}
|
|
1511
|
+
else if (fn === 93) {
|
|
1512
|
+
res.pollCreationMessageV4 = decodeFutureProofMessage(slice);
|
|
1513
|
+
}
|
|
1514
|
+
else if (fn === 96) {
|
|
1515
|
+
res.groupStatusMessage = decodeFutureProofMessage(slice);
|
|
1516
|
+
}
|
|
1517
|
+
else if (fn === 103) {
|
|
1518
|
+
res.groupStatusMessageV2 = decodeFutureProofMessage(slice);
|
|
1519
|
+
}
|
|
1520
|
+
else if (fn === 104) {
|
|
1521
|
+
res.botForwardedMessage = decodeFutureProofMessage(slice);
|
|
1522
|
+
}
|
|
1523
|
+
else if (fn === 111) {
|
|
1524
|
+
res.pollCreationMessageV5 = decodePollCreationMessageData(slice);
|
|
1525
|
+
}
|
|
1065
1526
|
}
|
|
1066
1527
|
else if (wt === 0) {
|
|
1067
1528
|
readVarint(buf, state);
|