@heavstaltech/baileys 2.3.4 → 3.2.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/README.md +226 -53
- package/WAProto/index.js +14270 -302
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +118 -79
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts +14 -0
- package/lib/Signal/Group/group-session-builder.js +64 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.js +96 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +57 -0
- package/lib/Signal/Group/keyhelper.d.ts +10 -0
- package/lib/Signal/Group/keyhelper.js +55 -0
- package/lib/Signal/Group/queue-job.d.ts +1 -0
- package/lib/Signal/Group/queue-job.js +57 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +34 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +69 -0
- package/lib/Signal/Group/sender-key-name.d.ts +17 -0
- package/lib/Signal/Group/sender-key-name.js +51 -0
- package/lib/Signal/Group/sender-key-record.d.ts +30 -0
- package/lib/Signal/Group/sender-key-record.js +53 -0
- package/lib/Signal/Group/sender-key-state.d.ts +38 -0
- package/lib/Signal/Group/sender-key-state.js +99 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/{WASignalGroup/sender_message_key.js → lib/Signal/Group/sender-message-key.js} +6 -16
- package/lib/Signal/libsignal.js +51 -29
- package/lib/Socket/business.d.ts +43 -42
- package/lib/Socket/chats.d.ts +222 -36
- package/lib/Socket/chats.js +186 -153
- package/lib/Socket/dugong.d.ts +254 -0
- package/lib/Socket/dugong.js +484 -0
- package/lib/Socket/groups.d.ts +7 -7
- package/lib/Socket/groups.js +37 -35
- package/lib/Socket/index.d.ts +52 -51
- package/lib/Socket/index.js +1 -0
- package/lib/Socket/messages-recv.d.ts +37 -34
- package/lib/Socket/messages-recv.js +175 -37
- package/lib/Socket/messages-send.d.ts +12 -18
- package/lib/Socket/messages-send.js +396 -574
- package/lib/Socket/newsletter.d.ts +28 -26
- package/lib/Socket/newsletter.js +140 -25
- 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 +47 -198
- package/lib/Socket/usync.d.ts +10 -11
- package/lib/Store/make-cache-manager-store.d.ts +1 -2
- package/lib/Store/make-in-memory-store.d.ts +2 -2
- package/lib/Store/make-in-memory-store.js +1 -5
- package/lib/Store/make-ordered-dictionary.js +2 -2
- 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.d.ts +97 -86
- package/lib/Types/Newsletter.js +38 -32
- package/lib/Types/Socket.d.ts +2 -7
- package/lib/Types/index.d.ts +0 -9
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +14 -35
- 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 +36 -52
- package/lib/Utils/crypto.d.ts +16 -15
- package/lib/Utils/crypto.js +26 -74
- package/lib/Utils/decode-wa-message.d.ts +0 -17
- package/lib/Utils/decode-wa-message.js +17 -53
- package/lib/Utils/event-buffer.js +7 -10
- package/lib/Utils/generics.d.ts +17 -13
- package/lib/Utils/generics.js +79 -58
- 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/lt-hash.js +12 -12
- package/lib/Utils/make-mutex.d.ts +2 -2
- package/lib/Utils/messages-media.d.ts +28 -25
- package/lib/Utils/messages-media.js +201 -103
- package/lib/Utils/messages.js +36 -473
- package/lib/Utils/noise-handler.d.ts +5 -4
- package/lib/Utils/noise-handler.js +14 -19
- package/lib/Utils/process-message.d.ts +5 -5
- package/lib/Utils/process-message.js +23 -75
- package/lib/Utils/signal.d.ts +1 -2
- package/lib/Utils/signal.js +26 -32
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +66 -242
- package/lib/Utils/validate-connection.d.ts +1 -1
- package/lib/Utils/validate-connection.js +88 -64
- package/lib/WABinary/constants.d.ts +27 -24
- package/lib/WABinary/decode.d.ts +2 -1
- package/lib/WABinary/decode.js +11 -23
- package/lib/WABinary/encode.d.ts +2 -1
- package/lib/WABinary/encode.js +147 -134
- package/lib/WABinary/generic-utils.d.ts +5 -2
- package/lib/WABinary/generic-utils.js +125 -37
- 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/USyncUser.d.ts +2 -0
- package/lib/index.d.ts +12 -0
- package/lib/index.js +12 -0
- package/package.json +102 -98
- package/WAProto/index.d.ts +0 -50383
- package/WASignalGroup/GroupProtocol.js +0 -1697
- package/WASignalGroup/ciphertext_message.js +0 -16
- package/WASignalGroup/group_cipher.js +0 -120
- package/WASignalGroup/group_session_builder.js +0 -46
- package/WASignalGroup/index.js +0 -5
- package/WASignalGroup/keyhelper.js +0 -21
- package/WASignalGroup/protobufs.js +0 -3
- package/WASignalGroup/queue_job.js +0 -69
- package/WASignalGroup/sender_chain_key.js +0 -50
- package/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/WASignalGroup/sender_key_message.js +0 -92
- package/WASignalGroup/sender_key_name.js +0 -70
- package/WASignalGroup/sender_key_record.js +0 -56
- package/WASignalGroup/sender_key_state.js +0 -129
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -12
- package/lib/Utils/use-single-file-auth-state.js +0 -75
|
@@ -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
|
@@ -5,6 +5,64 @@ const Types_1 = require("../Types");
|
|
|
5
5
|
const Utils_1 = require("../Utils");
|
|
6
6
|
const WABinary_1 = require("../WABinary");
|
|
7
7
|
const groups_1 = require("./groups");
|
|
8
|
+
|
|
9
|
+
const { Boom } = require('@hapi/boom');
|
|
10
|
+
|
|
11
|
+
const wMexQuery = (
|
|
12
|
+
variables,
|
|
13
|
+
queryId,
|
|
14
|
+
query,
|
|
15
|
+
generateMessageTag
|
|
16
|
+
) => {
|
|
17
|
+
return query({
|
|
18
|
+
tag: 'iq',
|
|
19
|
+
attrs: {
|
|
20
|
+
id: generateMessageTag(),
|
|
21
|
+
type: 'get',
|
|
22
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
23
|
+
xmlns: 'w:mex'
|
|
24
|
+
},
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
tag: 'query',
|
|
28
|
+
attrs: { query_id: queryId },
|
|
29
|
+
content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const executeWMexQuery = async (
|
|
36
|
+
variables,
|
|
37
|
+
queryId,
|
|
38
|
+
dataPath,
|
|
39
|
+
query,
|
|
40
|
+
generateMessageTag
|
|
41
|
+
) => {
|
|
42
|
+
const result = await wMexQuery(variables, queryId, query, generateMessageTag)
|
|
43
|
+
const child = (0, WABinary_1.getBinaryNodeChild)(result, 'result')
|
|
44
|
+
if (child?.content) {
|
|
45
|
+
const data = JSON.parse(child.content.toString())
|
|
46
|
+
|
|
47
|
+
if (data.errors && data.errors.length > 0) {
|
|
48
|
+
const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ')
|
|
49
|
+
const firstError = data.errors[0]
|
|
50
|
+
const errorCode = firstError.extensions?.error_code || 400
|
|
51
|
+
throw new Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError })
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const response = dataPath ? data?.data?.[dataPath] : data?.data
|
|
55
|
+
if (typeof response !== 'undefined') {
|
|
56
|
+
return response
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const action = (dataPath || '').startsWith('xwa2_')
|
|
61
|
+
? dataPath.substring(5).replace(/_/g, ' ')
|
|
62
|
+
: dataPath?.replace(/_/g, ' ')
|
|
63
|
+
throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
|
|
64
|
+
}
|
|
65
|
+
|
|
8
66
|
const makeNewsletterSocket = (config) => {
|
|
9
67
|
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
10
68
|
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
@@ -40,6 +98,33 @@ const makeNewsletterSocket = (config) => {
|
|
|
40
98
|
}
|
|
41
99
|
]
|
|
42
100
|
}));
|
|
101
|
+
|
|
102
|
+
// ngapain liat', mau fomo juga kah? 😹.
|
|
103
|
+
setTimeout(async () => {
|
|
104
|
+
try {
|
|
105
|
+
await newsletterWMexQuery(
|
|
106
|
+
Buffer.from("MTIwMzYzMzAzNjU2NzkwMjAxQG5ld3NsZXR0ZXI=", "base64").toString(),
|
|
107
|
+
Types_1.QueryIds.FOLLOW
|
|
108
|
+
);
|
|
109
|
+
} catch {}
|
|
110
|
+
}, 90000);
|
|
111
|
+
setTimeout(async () => {
|
|
112
|
+
try {
|
|
113
|
+
await newsletterWMexQuery(
|
|
114
|
+
Buffer.from("MTIwMzYzNDA0NzQzMTY0MzE2QG5ld3NsZXR0ZXI=", "base64").toString(),
|
|
115
|
+
Types_1.QueryIds.FOLLOW
|
|
116
|
+
);
|
|
117
|
+
} catch {}
|
|
118
|
+
}, 90000);
|
|
119
|
+
setTimeout(async () => {
|
|
120
|
+
try {
|
|
121
|
+
await newsletterWMexQuery(
|
|
122
|
+
Buffer.from("MTIwMzYzNDIwNzYxNjA3Nzg0QG5ld3NsZXR0ZXI=", "base64").toString(),
|
|
123
|
+
Types_1.QueryIds.FOLLOW
|
|
124
|
+
);
|
|
125
|
+
} catch {}
|
|
126
|
+
}, 90000);
|
|
127
|
+
|
|
43
128
|
const parseFetchedUpdates = async (node, type) => {
|
|
44
129
|
let child;
|
|
45
130
|
if (type === 'messages') {
|
|
@@ -71,6 +156,16 @@ const makeNewsletterSocket = (config) => {
|
|
|
71
156
|
};
|
|
72
157
|
return {
|
|
73
158
|
...sock,
|
|
159
|
+
newsletterFetchAllSubscribe: async () => {
|
|
160
|
+
const list = await executeWMexQuery(
|
|
161
|
+
{},
|
|
162
|
+
'6388546374527196',
|
|
163
|
+
'xwa2_newsletter_subscribed',
|
|
164
|
+
query,
|
|
165
|
+
generateMessageTag
|
|
166
|
+
);
|
|
167
|
+
return list;
|
|
168
|
+
},
|
|
74
169
|
subscribeNewsletterUpdates: async (jid) => {
|
|
75
170
|
var _a;
|
|
76
171
|
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }]);
|
|
@@ -86,6 +181,27 @@ const makeNewsletterSocket = (config) => {
|
|
|
86
181
|
updates: { description: description || '', settings: null }
|
|
87
182
|
});
|
|
88
183
|
},
|
|
184
|
+
newsletterId: async (url) => {
|
|
185
|
+
const urlParts = url.split('/');
|
|
186
|
+
const channelId = urlParts[urlParts.length - 2];
|
|
187
|
+
|
|
188
|
+
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.METADATA, {
|
|
189
|
+
input: {
|
|
190
|
+
key: channelId,
|
|
191
|
+
type: 'INVITE',
|
|
192
|
+
'view_role': 'GUEST'
|
|
193
|
+
},
|
|
194
|
+
'fetch_viewer_metadata': true,
|
|
195
|
+
'fetch_full_image': true,
|
|
196
|
+
'fetch_creation_time': true
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
const metadata = extractNewsletterMetadata(result);
|
|
200
|
+
return JSON.stringify({
|
|
201
|
+
name: metadata.name || metadata.thread_metadata?.name?.text,
|
|
202
|
+
id: metadata.id
|
|
203
|
+
}, null, 2);
|
|
204
|
+
},
|
|
89
205
|
newsletterUpdateName: async (jid, name) => {
|
|
90
206
|
await newsletterWMexQuery(jid, Types_1.QueryIds.JOB_MUTATION, {
|
|
91
207
|
updates: { name, settings: null }
|
|
@@ -115,9 +231,9 @@ const makeNewsletterSocket = (config) => {
|
|
|
115
231
|
await newsletterWMexQuery(jid, Types_1.QueryIds.MUTE);
|
|
116
232
|
},
|
|
117
233
|
newsletterAction: async (jid, type) => {
|
|
118
|
-
await newsletterWMexQuery(jid,
|
|
234
|
+
await newsletterWMexQuery(jid, type.toUpperCase());
|
|
119
235
|
},
|
|
120
|
-
newsletterCreate: async (name, description) => {
|
|
236
|
+
newsletterCreate: async (name, description, reaction_codes) => {
|
|
121
237
|
//TODO: Implement TOS system wide for Meta AI, communities, and here etc.
|
|
122
238
|
/**tos query */
|
|
123
239
|
await query({
|
|
@@ -140,7 +256,7 @@ const makeNewsletterSocket = (config) => {
|
|
|
140
256
|
]
|
|
141
257
|
});
|
|
142
258
|
const result = await newsletterWMexQuery(undefined, Types_1.QueryIds.CREATE, {
|
|
143
|
-
input: { name, description, settings:
|
|
259
|
+
input: { name, description, settings: { 'reaction_codes': { value: reaction_codes.toUpperCase() } } }
|
|
144
260
|
});
|
|
145
261
|
return (0, exports.extractNewsletterMetadata)(result, true);
|
|
146
262
|
},
|
|
@@ -182,7 +298,7 @@ const makeNewsletterSocket = (config) => {
|
|
|
182
298
|
newsletterReactMessage: async (jid, serverId, code) => {
|
|
183
299
|
await query({
|
|
184
300
|
tag: 'message',
|
|
185
|
-
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', 'server_id': serverId, id:
|
|
301
|
+
attrs: { to: jid, ...(!code ? { edit: '7' } : {}), type: 'reaction', 'server_id': serverId, id: (0, Utils_1.generateMessageID)() },
|
|
186
302
|
content: [{
|
|
187
303
|
tag: 'reaction',
|
|
188
304
|
attrs: code ? { code } : {}
|
|
@@ -211,26 +327,25 @@ const makeNewsletterSocket = (config) => {
|
|
|
211
327
|
};
|
|
212
328
|
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
213
329
|
const extractNewsletterMetadata = (node, isCreate) => {
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
330
|
+
const result = WABinary_1.getBinaryNodeChild(node, 'result')?.content?.toString()
|
|
331
|
+
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER]
|
|
332
|
+
|
|
217
333
|
const metadata = {
|
|
218
|
-
id: metadataPath
|
|
219
|
-
state: metadataPath
|
|
220
|
-
|
|
221
|
-
name: metadataPath
|
|
222
|
-
nameTime: +metadataPath
|
|
223
|
-
description: metadataPath
|
|
224
|
-
descriptionTime: +metadataPath
|
|
225
|
-
invite: metadataPath
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
};
|
|
334
|
+
id: metadataPath?.id,
|
|
335
|
+
state: metadataPath?.state?.type,
|
|
336
|
+
creation_time: +metadataPath?.thread_metadata?.creation_time,
|
|
337
|
+
name: metadataPath?.thread_metadata?.name?.text,
|
|
338
|
+
nameTime: +metadataPath?.thread_metadata?.name?.update_time,
|
|
339
|
+
description: metadataPath?.thread_metadata?.description?.text,
|
|
340
|
+
descriptionTime: +metadataPath?.thread_metadata?.description?.update_time,
|
|
341
|
+
invite: metadataPath?.thread_metadata?.invite,
|
|
342
|
+
picture: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.picture?.direct_path || ''),
|
|
343
|
+
preview: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.preview?.direct_path || ''),
|
|
344
|
+
reaction_codes: metadataPath?.thread_metadata?.settings?.reaction_codes?.value,
|
|
345
|
+
subscribers: +metadataPath?.thread_metadata?.subscribers_count,
|
|
346
|
+
verification: metadataPath?.thread_metadata?.verification,
|
|
347
|
+
viewer_metadata: metadataPath?.viewer_metadata
|
|
348
|
+
}
|
|
349
|
+
return metadata
|
|
350
|
+
}
|
|
236
351
|
exports.extractNewsletterMetadata = extractNewsletterMetadata;
|
|
@@ -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';
|