@vanzxy/baileys 1.3.7 → 1.3.8
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.
Potentially problematic release.
This version of @vanzxy/baileys might be problematic. Click here for more details.
- package/README.md +1 -1
- package/WAProto/index.d.ts +9 -0
- package/lib/Defaults/index.d.ts +147 -0
- package/lib/Defaults/index.js +2 -2
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/lib/Signal/Group/group_cipher.d.ts +10 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/libsignal.d.ts +54 -0
- package/lib/Signal/lid-mapping.d.ts +20 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/types.d.ts +5 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/business.d.ts +395 -0
- package/lib/Socket/chats.d.ts +136 -0
- package/lib/Socket/communities.d.ts +561 -0
- package/lib/Socket/communities.js +4 -2
- package/lib/Socket/dugong.d.ts +117 -0
- package/lib/Socket/dugong.js +26 -1
- package/lib/Socket/groups.d.ts +285 -0
- package/lib/Socket/index.d.ts +531 -0
- package/lib/Socket/messages-recv.d.ts +333 -0
- package/lib/Socket/messages-send.d.ts +329 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/newsletter.d.ts +281 -0
- package/lib/Socket/newsletter.js +19 -19
- package/lib/Socket/socket.d.ts +60 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/make-in-memory-store.d.ts +62 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Types/Auth.d.ts +117 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Chat.d.ts +124 -0
- package/lib/Types/Contact.d.ts +26 -0
- package/lib/Types/Events.d.ts +256 -0
- package/lib/Types/GroupMetadata.d.ts +71 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/Message.d.ts +11 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/RichType.d.ts +2 -0
- package/lib/Types/Signal.d.ts +87 -0
- package/lib/Types/Socket.d.ts +136 -0
- package/lib/Types/State.d.ts +5 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/index.d.ts +66 -0
- package/lib/Utils/auth-utils.d.ts +57 -0
- package/lib/Utils/browser-utils.d.ts +8 -0
- package/lib/Utils/business.d.ts +49 -0
- package/lib/Utils/business.js +2 -1
- package/lib/Utils/chat-utils.d.ts +407 -0
- package/lib/Utils/chat-utils.js +15 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/lib/Utils/crypto.d.ts +41 -0
- package/lib/Utils/decode-wa-message.d.ts +83 -0
- package/lib/Utils/decode-wa-message.js +1 -3
- package/lib/Utils/event-buffer.d.ts +12 -0
- package/lib/Utils/generics.d.ts +63 -0
- package/lib/Utils/generics.js +2 -4
- package/lib/Utils/history.d.ts +90 -0
- package/lib/Utils/identity-change-handler.d.ts +13 -0
- package/lib/Utils/index.d.ts +24 -0
- package/lib/Utils/link-preview.d.ts +12 -0
- package/lib/Utils/logger.d.ts +2 -0
- package/lib/Utils/lt-hash.d.ts +12 -0
- package/lib/Utils/lt-hash.js +21 -2
- package/lib/Utils/make-mutex.d.ts +6 -0
- package/lib/Utils/message-retry-manager.d.ts +79 -0
- package/lib/Utils/messages-media.d.ts +135 -0
- package/lib/Utils/messages.d.ts +44 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/offline-node-processor.d.ts +9 -0
- package/lib/Utils/pre-key-manager.d.ts +25 -0
- package/lib/Utils/process-message.d.ts +82 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/rich-message-utils.d.ts +48 -0
- package/lib/Utils/signal.d.ts +82 -0
- package/lib/Utils/stanza-ack.d.ts +16 -0
- package/lib/Utils/sync-action-utils.d.ts +2 -0
- package/lib/Utils/tc-token-utils.d.ts +29 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-single-file-auth-state.js +6 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.js +12 -0
- package/lib/Utils/validate-connection.d.ts +42 -0
- package/lib/WABinary/constants.d.ts +61 -0
- package/lib/WABinary/decode.d.ts +9 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/generic-utils.d.ts +74 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/jid-utils.d.ts +28 -0
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WAM/BinaryInfo.d.ts +7 -0
- package/lib/WAM/constants.d.ts +34926 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/index.d.ts +7 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncUser.d.ts +16 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/index.d.ts +12 -0
- package/package.json +12 -7
- package/postinstall-banner.js +23 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export function downloadHistory(msg: any, options: any): Promise<any>;
|
|
2
|
+
export function processHistoryMessage(item: any, logger: any): {
|
|
3
|
+
messages: any[];
|
|
4
|
+
contacts: any[];
|
|
5
|
+
chats: any[];
|
|
6
|
+
lidPnMappings: any[];
|
|
7
|
+
pastParticipants?: undefined;
|
|
8
|
+
syncType?: undefined;
|
|
9
|
+
progress?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
chats: any[];
|
|
12
|
+
contacts: ({
|
|
13
|
+
id: any;
|
|
14
|
+
name: any;
|
|
15
|
+
username: any;
|
|
16
|
+
lid: any;
|
|
17
|
+
phoneNumber: any;
|
|
18
|
+
verifiedName?: undefined;
|
|
19
|
+
notify?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
id: any;
|
|
22
|
+
verifiedName: any;
|
|
23
|
+
name?: undefined;
|
|
24
|
+
username?: undefined;
|
|
25
|
+
lid?: undefined;
|
|
26
|
+
phoneNumber?: undefined;
|
|
27
|
+
notify?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
id: any;
|
|
30
|
+
notify: any;
|
|
31
|
+
name?: undefined;
|
|
32
|
+
username?: undefined;
|
|
33
|
+
lid?: undefined;
|
|
34
|
+
phoneNumber?: undefined;
|
|
35
|
+
verifiedName?: undefined;
|
|
36
|
+
})[];
|
|
37
|
+
messages: any[];
|
|
38
|
+
lidPnMappings: {
|
|
39
|
+
lid: any;
|
|
40
|
+
pn: any;
|
|
41
|
+
}[];
|
|
42
|
+
pastParticipants: any;
|
|
43
|
+
syncType: any;
|
|
44
|
+
progress: any;
|
|
45
|
+
};
|
|
46
|
+
export function downloadAndProcessHistorySyncNotification(msg: any, options: any, logger: any): Promise<{
|
|
47
|
+
messages: any[];
|
|
48
|
+
contacts: any[];
|
|
49
|
+
chats: any[];
|
|
50
|
+
lidPnMappings: any[];
|
|
51
|
+
pastParticipants?: undefined;
|
|
52
|
+
syncType?: undefined;
|
|
53
|
+
progress?: undefined;
|
|
54
|
+
} | {
|
|
55
|
+
chats: any[];
|
|
56
|
+
contacts: ({
|
|
57
|
+
id: any;
|
|
58
|
+
name: any;
|
|
59
|
+
username: any;
|
|
60
|
+
lid: any;
|
|
61
|
+
phoneNumber: any;
|
|
62
|
+
verifiedName?: undefined;
|
|
63
|
+
notify?: undefined;
|
|
64
|
+
} | {
|
|
65
|
+
id: any;
|
|
66
|
+
verifiedName: any;
|
|
67
|
+
name?: undefined;
|
|
68
|
+
username?: undefined;
|
|
69
|
+
lid?: undefined;
|
|
70
|
+
phoneNumber?: undefined;
|
|
71
|
+
notify?: undefined;
|
|
72
|
+
} | {
|
|
73
|
+
id: any;
|
|
74
|
+
notify: any;
|
|
75
|
+
name?: undefined;
|
|
76
|
+
username?: undefined;
|
|
77
|
+
lid?: undefined;
|
|
78
|
+
phoneNumber?: undefined;
|
|
79
|
+
verifiedName?: undefined;
|
|
80
|
+
})[];
|
|
81
|
+
messages: any[];
|
|
82
|
+
lidPnMappings: {
|
|
83
|
+
lid: any;
|
|
84
|
+
pn: any;
|
|
85
|
+
}[];
|
|
86
|
+
pastParticipants: any;
|
|
87
|
+
syncType: any;
|
|
88
|
+
progress: any;
|
|
89
|
+
}>;
|
|
90
|
+
export function getHistoryMsg(message: any): any;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function handleIdentityChange(node: any, ctx: any): Promise<{
|
|
2
|
+
action: string;
|
|
3
|
+
device?: undefined;
|
|
4
|
+
error?: undefined;
|
|
5
|
+
} | {
|
|
6
|
+
action: string;
|
|
7
|
+
device: number;
|
|
8
|
+
error?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
action: string;
|
|
11
|
+
error: unknown;
|
|
12
|
+
device?: undefined;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from "./generics.js";
|
|
2
|
+
export * from "./decode-wa-message.js";
|
|
3
|
+
export * from "./messages.js";
|
|
4
|
+
export * from "./messages-media.js";
|
|
5
|
+
export * from "./validate-connection.js";
|
|
6
|
+
export * from "./crypto.js";
|
|
7
|
+
export * from "./signal.js";
|
|
8
|
+
export * from "./noise-handler.js";
|
|
9
|
+
export * from "./history.js";
|
|
10
|
+
export * from "./chat-utils.js";
|
|
11
|
+
export * from "./lt-hash.js";
|
|
12
|
+
export * from "./auth-utils.js";
|
|
13
|
+
export * from "./use-multi-file-auth-state.js";
|
|
14
|
+
export * from "./use-single-file-auth-state.js";
|
|
15
|
+
export * from "./use-sqlite-auth-state.js";
|
|
16
|
+
export * from "./link-preview.js";
|
|
17
|
+
export * from "./event-buffer.js";
|
|
18
|
+
export * from "./process-message.js";
|
|
19
|
+
export * from "./rich-message-utils.js";
|
|
20
|
+
export * from "./message-retry-manager.js";
|
|
21
|
+
export * from "./browser-utils.js";
|
|
22
|
+
export * from "./companion-reg-client-utils.js";
|
|
23
|
+
export * from "./identity-change-handler.js";
|
|
24
|
+
export * from "./stanza-ack.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function getUrlInfo(text: any, opts?: {
|
|
2
|
+
thumbnailWidth: number;
|
|
3
|
+
fetchOpts: {
|
|
4
|
+
timeout: number;
|
|
5
|
+
};
|
|
6
|
+
}): Promise<{
|
|
7
|
+
'canonical-url': any;
|
|
8
|
+
'matched-text': any;
|
|
9
|
+
title: any;
|
|
10
|
+
description: any;
|
|
11
|
+
originalThumbnailUrl: any;
|
|
12
|
+
} | undefined>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
|
|
3
|
+
* over a series of mutations. You can add/remove mutations and it'll return a hash equal to
|
|
4
|
+
* if the same series of mutations was made sequentially.
|
|
5
|
+
*
|
|
6
|
+
* Vanz@Fix (bug 36 follow-up): whatsapp-rust-bridge is a native module and was previously
|
|
7
|
+
* statically imported here, which crashed the *entire* library at import time on platforms
|
|
8
|
+
* without a prebuilt binary (ARM musl/Alpine/Termux/some Pterodactyl nodes) — even for bots
|
|
9
|
+
* that never touch app-state sync. Same top-level-await try/catch pattern as crypto.js:
|
|
10
|
+
* only throws (with a clear message) if app-state sync (LT hash) is actually used.
|
|
11
|
+
*/
|
|
12
|
+
export let LT_HASH_ANTI_TAMPERING: any;
|
package/lib/Utils/lt-hash.js
CHANGED
|
@@ -1,8 +1,27 @@
|
|
|
1
|
-
import { LTHashAntiTampering } from 'whatsapp-rust-bridge';
|
|
2
1
|
/**
|
|
3
2
|
* LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
|
|
4
3
|
* over a series of mutations. You can add/remove mutations and it'll return a hash equal to
|
|
5
4
|
* if the same series of mutations was made sequentially.
|
|
5
|
+
*
|
|
6
|
+
* Vanz@Fix (bug 36 follow-up): whatsapp-rust-bridge is a native module and was previously
|
|
7
|
+
* statically imported here, which crashed the *entire* library at import time on platforms
|
|
8
|
+
* without a prebuilt binary (ARM musl/Alpine/Termux/some Pterodactyl nodes) — even for bots
|
|
9
|
+
* that never touch app-state sync. Same top-level-await try/catch pattern as crypto.js:
|
|
10
|
+
* only throws (with a clear message) if app-state sync (LT hash) is actually used.
|
|
6
11
|
*/
|
|
7
|
-
|
|
12
|
+
let LT_HASH_ANTI_TAMPERING;
|
|
13
|
+
try {
|
|
14
|
+
const { LTHashAntiTampering } = await import('whatsapp-rust-bridge');
|
|
15
|
+
LT_HASH_ANTI_TAMPERING = new LTHashAntiTampering();
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
const message = '`whatsapp-rust-bridge` failed to load (no prebuilt binary for this platform/arch). ' +
|
|
19
|
+
'App-state sync (LT hash) is unavailable here. Original error: ' + (err?.message || err);
|
|
20
|
+
LT_HASH_ANTI_TAMPERING = new Proxy({}, {
|
|
21
|
+
get() {
|
|
22
|
+
throw new Error(message);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export { LT_HASH_ANTI_TAMPERING };
|
|
8
27
|
//# sourceMappingURL=lt-hash.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const RetryReason: any;
|
|
2
|
+
export class MessageRetryManager {
|
|
3
|
+
constructor(logger: any, maxMsgRetryCount: any);
|
|
4
|
+
logger: any;
|
|
5
|
+
recentMessagesMap: any;
|
|
6
|
+
messageKeyIndex: Map<any, any>;
|
|
7
|
+
sessionRecreateHistory: any;
|
|
8
|
+
retryCounters: any;
|
|
9
|
+
baseKeys: any;
|
|
10
|
+
pendingPhoneRequests: {};
|
|
11
|
+
maxMsgRetryCount: any;
|
|
12
|
+
statistics: {
|
|
13
|
+
totalRetries: number;
|
|
14
|
+
successfulRetries: number;
|
|
15
|
+
failedRetries: number;
|
|
16
|
+
mediaRetries: number;
|
|
17
|
+
sessionRecreations: number;
|
|
18
|
+
phoneRequests: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Add a recent message to the cache for retry handling
|
|
22
|
+
*/
|
|
23
|
+
addRecentMessage(to: any, id: any, message: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get a recent message from the cache
|
|
26
|
+
*/
|
|
27
|
+
getRecentMessage(to: any, id: any): any;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a session should be recreated based on retry count, history, and error code.
|
|
30
|
+
* MAC errors (codes 4 and 7) trigger immediate session recreation regardless of timeout.
|
|
31
|
+
*/
|
|
32
|
+
shouldRecreateSession(jid: any, hasSession: any, errorCode: any): {
|
|
33
|
+
reason: string;
|
|
34
|
+
recreate: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Parse error code from retry receipt's retry node.
|
|
38
|
+
* Returns undefined if no error code is present.
|
|
39
|
+
*/
|
|
40
|
+
parseRetryErrorCode(errorAttr: any): any;
|
|
41
|
+
/**
|
|
42
|
+
* Check if an error code indicates a MAC failure
|
|
43
|
+
*/
|
|
44
|
+
isMacError(errorCode: any): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Increment retry counter for a message
|
|
47
|
+
*/
|
|
48
|
+
incrementRetryCount(messageId: any): any;
|
|
49
|
+
/**
|
|
50
|
+
* Get retry count for a message
|
|
51
|
+
*/
|
|
52
|
+
getRetryCount(messageId: any): any;
|
|
53
|
+
/**
|
|
54
|
+
* Check if message has exceeded maximum retry attempts
|
|
55
|
+
*/
|
|
56
|
+
hasExceededMaxRetries(messageId: any): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Mark retry as successful
|
|
59
|
+
*/
|
|
60
|
+
markRetrySuccess(messageId: any): void;
|
|
61
|
+
/**
|
|
62
|
+
* Mark retry as failed
|
|
63
|
+
*/
|
|
64
|
+
markRetryFailed(messageId: any): void;
|
|
65
|
+
/**
|
|
66
|
+
* Schedule a phone request with delay
|
|
67
|
+
*/
|
|
68
|
+
schedulePhoneRequest(messageId: any, callback: any, delay?: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* Cancel pending phone request
|
|
71
|
+
*/
|
|
72
|
+
cancelPendingPhoneRequest(messageId: any): void;
|
|
73
|
+
clear(): void;
|
|
74
|
+
saveBaseKey(addr: any, msgId: any, baseKey: any): void;
|
|
75
|
+
hasSameBaseKey(addr: any, msgId: any, baseKey: any): boolean;
|
|
76
|
+
deleteBaseKey(addr: any, msgId: any): void;
|
|
77
|
+
keyToString(key: any): string;
|
|
78
|
+
removeRecentMessage(messageId: any): void;
|
|
79
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/** generates all the keys required to encrypt/decrypt & sign a media message */
|
|
2
|
+
export function getMediaKeys(buffer: any, mediaType: any): Promise<{
|
|
3
|
+
iv: any;
|
|
4
|
+
cipherKey: any;
|
|
5
|
+
macKey: any;
|
|
6
|
+
}>;
|
|
7
|
+
export function getAudioDuration(buffer: any): Promise<any>;
|
|
8
|
+
/**
|
|
9
|
+
referenced from and modifying https://github.com/wppconnect-team/wa-js/blob/main/src/chat/functions/prepareAudioWaveform.ts
|
|
10
|
+
*/
|
|
11
|
+
export function getAudioWaveform(buffer: any, logger: any): Promise<Uint8Array<ArrayBuffer> | undefined>;
|
|
12
|
+
/** generates a thumbnail for a given media, if required */
|
|
13
|
+
export function generateThumbnail(file: any, mediaType: any, options: any): Promise<{
|
|
14
|
+
thumbnail: any;
|
|
15
|
+
originalImageDimensions: {
|
|
16
|
+
width: any;
|
|
17
|
+
height: any;
|
|
18
|
+
} | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
export function extensionForMediaMessage(message: any): any;
|
|
21
|
+
export function getImageProcessingLibrary(): Promise<any>;
|
|
22
|
+
export function hkdfInfoKey(type: any): string;
|
|
23
|
+
export function getRawMediaUploadData(media: any, mediaType: any, logger: any): Promise<{
|
|
24
|
+
filePath: any;
|
|
25
|
+
fileSha256: any;
|
|
26
|
+
fileLength: number;
|
|
27
|
+
}>;
|
|
28
|
+
export function extractVideoThumb(path: any, time: any, size: any): Promise<any>;
|
|
29
|
+
export function extractImageThumb(bufferOrFilePath: any, width?: number): Promise<{
|
|
30
|
+
buffer: any;
|
|
31
|
+
original: {
|
|
32
|
+
width: any;
|
|
33
|
+
height: any;
|
|
34
|
+
};
|
|
35
|
+
}>;
|
|
36
|
+
export function encodeBase64EncodedStringForUpload(b64: any): string;
|
|
37
|
+
export function generateProfilePicture(mediaUpload: any, dimensions: any): Promise<{
|
|
38
|
+
img: any;
|
|
39
|
+
}>;
|
|
40
|
+
export function mediaMessageSHA256B64(message: any): any;
|
|
41
|
+
export function toReadable(buffer: any): any;
|
|
42
|
+
export function toBuffer(stream: any): Promise<any>;
|
|
43
|
+
export function getStream(item: any, opts: any): Promise<{
|
|
44
|
+
stream: any;
|
|
45
|
+
type: string;
|
|
46
|
+
}>;
|
|
47
|
+
export function getHttpStream(url: any, options?: {}): Promise<any>;
|
|
48
|
+
export function encryptedStream(media: any, mediaType: any, { logger, saveOriginalFileIfRequired, opts }?: {}): Promise<{
|
|
49
|
+
mediaKey: any;
|
|
50
|
+
originalFilePath: any;
|
|
51
|
+
encFilePath: any;
|
|
52
|
+
mac: any;
|
|
53
|
+
fileEncSha256: any;
|
|
54
|
+
fileSha256: any;
|
|
55
|
+
fileLength: number;
|
|
56
|
+
}>;
|
|
57
|
+
export const DEF_MEDIA_HOST: "mmg.whatsapp.net";
|
|
58
|
+
export function getUrlFromDirectPath(directPath: any, host?: string): string;
|
|
59
|
+
export function downloadContentFromMessage({ mediaKey, directPath, url }: {
|
|
60
|
+
mediaKey: any;
|
|
61
|
+
directPath: any;
|
|
62
|
+
url: any;
|
|
63
|
+
}, type: any, opts?: {}): Promise<any>;
|
|
64
|
+
export function downloadEncryptedContent(downloadUrl: any, { cipherKey, iv }: {
|
|
65
|
+
cipherKey: any;
|
|
66
|
+
iv: any;
|
|
67
|
+
}, { startByte, endByte, options }?: {}): Promise<any>;
|
|
68
|
+
export function uploadWithNodeHttp({ url, filePath, headers, timeoutMs, agent }: {
|
|
69
|
+
url: any;
|
|
70
|
+
filePath: any;
|
|
71
|
+
headers: any;
|
|
72
|
+
timeoutMs: any;
|
|
73
|
+
agent: any;
|
|
74
|
+
}, redirectCount?: number): Promise<any>;
|
|
75
|
+
export function getWAUploadToServer({ customUploadHosts, fetchAgent, logger, options }: {
|
|
76
|
+
customUploadHosts: any;
|
|
77
|
+
fetchAgent: any;
|
|
78
|
+
logger: any;
|
|
79
|
+
options: any;
|
|
80
|
+
}, refreshMediaConn: any): (filePath: any, { mediaType, fileEncSha256B64, timeoutMs, newsletter }: {
|
|
81
|
+
mediaType: any;
|
|
82
|
+
fileEncSha256B64: any;
|
|
83
|
+
timeoutMs: any;
|
|
84
|
+
newsletter: any;
|
|
85
|
+
}) => Promise<{
|
|
86
|
+
mediaUrl: any;
|
|
87
|
+
directPath: any;
|
|
88
|
+
meta_hmac: any;
|
|
89
|
+
fbid: any;
|
|
90
|
+
ts: any;
|
|
91
|
+
thumbnailDirectPath: any;
|
|
92
|
+
thumbnailSha256: any;
|
|
93
|
+
}>;
|
|
94
|
+
export function encryptMediaRetryRequest(key: any, mediaKey: any, meId: any): {
|
|
95
|
+
tag: string;
|
|
96
|
+
attrs: {
|
|
97
|
+
id: any;
|
|
98
|
+
to: string;
|
|
99
|
+
type: string;
|
|
100
|
+
};
|
|
101
|
+
content: ({
|
|
102
|
+
tag: string;
|
|
103
|
+
attrs: {
|
|
104
|
+
jid?: undefined;
|
|
105
|
+
from_me?: undefined;
|
|
106
|
+
participant?: undefined;
|
|
107
|
+
};
|
|
108
|
+
content: {
|
|
109
|
+
tag: string;
|
|
110
|
+
attrs: {};
|
|
111
|
+
content: any;
|
|
112
|
+
}[];
|
|
113
|
+
} | {
|
|
114
|
+
tag: string;
|
|
115
|
+
attrs: {
|
|
116
|
+
jid: any;
|
|
117
|
+
from_me: string;
|
|
118
|
+
participant: any;
|
|
119
|
+
};
|
|
120
|
+
content?: undefined;
|
|
121
|
+
})[];
|
|
122
|
+
};
|
|
123
|
+
export function decodeMediaRetryNode(node: any): {
|
|
124
|
+
key: {
|
|
125
|
+
id: any;
|
|
126
|
+
remoteJid: any;
|
|
127
|
+
fromMe: boolean;
|
|
128
|
+
participant: any;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
export function decryptMediaRetryData({ ciphertext, iv }: {
|
|
132
|
+
ciphertext: any;
|
|
133
|
+
iv: any;
|
|
134
|
+
}, mediaKey: any, msgId: any): any;
|
|
135
|
+
export function getStatusCodeForMediaRetry(code: any): number;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aggregates all poll updates in a poll.
|
|
3
|
+
* @param msg the poll creation message
|
|
4
|
+
* @param meId your jid
|
|
5
|
+
* @returns A list of options & their voters
|
|
6
|
+
*/
|
|
7
|
+
export function getAggregateVotesInPollMessage({ message, pollUpdates }: {
|
|
8
|
+
message: any;
|
|
9
|
+
pollUpdates: any;
|
|
10
|
+
}, meId: any): any[];
|
|
11
|
+
/**
|
|
12
|
+
* Aggregates all event responses in an event message.
|
|
13
|
+
* @param msg the event creation message
|
|
14
|
+
* @param meId your jid
|
|
15
|
+
* @returns A list of response types & their responders
|
|
16
|
+
*/
|
|
17
|
+
export function getAggregateResponsesInEventMessage({ eventResponses }: {
|
|
18
|
+
eventResponses: any;
|
|
19
|
+
}, meId: any): any[];
|
|
20
|
+
export function extractUrlFromText(text: any): any;
|
|
21
|
+
export function generateLinkPreviewIfRequired(text: any, getUrlInfo: any, logger: any): Promise<any>;
|
|
22
|
+
export function prepareWAMessageMedia(message: any, options: any): Promise<any>;
|
|
23
|
+
export function prepareDisappearingMessageSettingContent(ephemeralExpiration: any): any;
|
|
24
|
+
export function generateForwardMessageContent(message: any, forceForward: any): any;
|
|
25
|
+
export function hasNonNullishProperty(message: any, key: any): boolean;
|
|
26
|
+
export function hasOptionalProperty(obj: any, key: any): boolean;
|
|
27
|
+
export function hasValidAlbumMedia(message: any): boolean;
|
|
28
|
+
export function hasValidInteractiveHeader(message: any): boolean;
|
|
29
|
+
export function hasValidCarouselHeader(message: any): boolean;
|
|
30
|
+
export function generateWAMessageContent(message: any, options: any): Promise<any>;
|
|
31
|
+
export function generateWAMessageFromContent(jid: any, message: any, options: any): any;
|
|
32
|
+
export function generateWAMessage(jid: any, content: any, options: any): Promise<any>;
|
|
33
|
+
export function getContentType(content: any): string | undefined;
|
|
34
|
+
export function normalizeMessageContent(content: any): any;
|
|
35
|
+
export function extractMessageContent(content: any): any;
|
|
36
|
+
export function getDevice(id: any): "web" | "unknown" | "android" | "ios" | "desktop";
|
|
37
|
+
export function updateMessageWithReceipt(msg: any, receipt: any): void;
|
|
38
|
+
export function updateMessageWithReaction(msg: any, reaction: any): void;
|
|
39
|
+
export function updateMessageWithPollUpdate(msg: any, update: any): void;
|
|
40
|
+
export function updateMessageWithEventResponse(msg: any, update: any): void;
|
|
41
|
+
export function aggregateMessageKeysNotFromMe(keys: any): any[];
|
|
42
|
+
export function downloadMediaMessage(message: any, type: any, options: any, ctx: any): Promise<any>;
|
|
43
|
+
export function assertMediaContent(content: any): any;
|
|
44
|
+
export function shouldIncludeBizBinaryNode(message: any): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function makeNoiseHandler({ keyPair: { private: privateKey, public: publicKey }, NOISE_HEADER, logger, routingInfo }: {
|
|
2
|
+
keyPair: {
|
|
3
|
+
private: any;
|
|
4
|
+
public: any;
|
|
5
|
+
};
|
|
6
|
+
NOISE_HEADER: any;
|
|
7
|
+
logger: any;
|
|
8
|
+
routingInfo: any;
|
|
9
|
+
}): {
|
|
10
|
+
encrypt: (plaintext: any) => any;
|
|
11
|
+
decrypt: (ciphertext: any) => any;
|
|
12
|
+
authenticate: (data: any) => void;
|
|
13
|
+
mixIntoKey: (data: any) => void;
|
|
14
|
+
finishInit: () => Promise<void>;
|
|
15
|
+
processHandshake: ({ serverHello }: {
|
|
16
|
+
serverHello: any;
|
|
17
|
+
}, noiseKey: any) => any;
|
|
18
|
+
encodeFrame: (data: any) => any;
|
|
19
|
+
decodeFrame: (newData: any, onFrame: any) => Promise<void>;
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a processor for offline stanza nodes that:
|
|
3
|
+
* - Queues nodes for sequential processing
|
|
4
|
+
* - Yields to the event loop periodically to avoid blocking
|
|
5
|
+
* - Catches handler errors to prevent the processing loop from crashing
|
|
6
|
+
*/
|
|
7
|
+
export function makeOfflineNodeProcessor(nodeProcessorMap: any, deps: any, batchSize?: number): {
|
|
8
|
+
enqueue: (type: any, node: any) => void;
|
|
9
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages pre-key operations with proper concurrency control
|
|
3
|
+
*/
|
|
4
|
+
export class PreKeyManager {
|
|
5
|
+
constructor(store: any, logger: any);
|
|
6
|
+
store: any;
|
|
7
|
+
logger: any;
|
|
8
|
+
queues: Map<any, any>;
|
|
9
|
+
/**
|
|
10
|
+
* Get or create a queue for a specific key type
|
|
11
|
+
*/
|
|
12
|
+
getQueue(keyType: any): any;
|
|
13
|
+
/**
|
|
14
|
+
* Process pre-key operations (updates and deletions)
|
|
15
|
+
*/
|
|
16
|
+
processOperations(data: any, keyType: any, transactionCache: any, mutations: any, isInTransaction: any): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Process deletions with validation
|
|
19
|
+
*/
|
|
20
|
+
processDeletions(keyType: any, ids: any, transactionCache: any, mutations: any, isInTransaction: any): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Validate and process pre-key deletions outside transactions
|
|
23
|
+
*/
|
|
24
|
+
validateDeletions(data: any, keyType: any): Promise<any>;
|
|
25
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decrypt a poll vote
|
|
3
|
+
* @param vote encrypted vote
|
|
4
|
+
* @param ctx additional info about the poll required for decryption
|
|
5
|
+
* @returns list of SHA256 options
|
|
6
|
+
*/
|
|
7
|
+
export function decryptPollVote({ encPayload, encIv }: {
|
|
8
|
+
encPayload: any;
|
|
9
|
+
encIv: any;
|
|
10
|
+
}, { pollCreatorJid, pollMsgId, pollEncKey, voterJid }: {
|
|
11
|
+
pollCreatorJid: any;
|
|
12
|
+
pollMsgId: any;
|
|
13
|
+
pollEncKey: any;
|
|
14
|
+
voterJid: any;
|
|
15
|
+
}): any;
|
|
16
|
+
/**
|
|
17
|
+
* Decrypt an event response
|
|
18
|
+
* @param response encrypted event response
|
|
19
|
+
* @param ctx additional info about the event required for decryption
|
|
20
|
+
* @returns event response message
|
|
21
|
+
*/
|
|
22
|
+
export function decryptEventResponse({ encPayload, encIv }: {
|
|
23
|
+
encPayload: any;
|
|
24
|
+
encIv: any;
|
|
25
|
+
}, { eventCreatorJid, eventMsgId, eventEncKey, responderJid }: {
|
|
26
|
+
eventCreatorJid: any;
|
|
27
|
+
eventMsgId: any;
|
|
28
|
+
eventEncKey: any;
|
|
29
|
+
responderJid: any;
|
|
30
|
+
}): any;
|
|
31
|
+
/**
|
|
32
|
+
* Decrypt a `secretEncryptedMessage` carrying a `MESSAGE_EDIT` payload.
|
|
33
|
+
*
|
|
34
|
+
* WhatsApp started wrapping message edits in an E2EE envelope (May 2026).
|
|
35
|
+
* The new content is encrypted with a key derived from the original
|
|
36
|
+
* message's `messageContextInfo.messageSecret` using HKDF-SHA256
|
|
37
|
+
* + AES-256-GCM, same family as polls and event responses but with
|
|
38
|
+
* different constants (validated against live WhatsApp Android traffic):
|
|
39
|
+
*
|
|
40
|
+
* info = msgId || origSenderJid || editorJid || "Message Edit"
|
|
41
|
+
* aad = (empty) <-- differs from Poll Vote / Event Response
|
|
42
|
+
* key = HKDF-SHA256(salt=zeros, ikm=messageSecret, info, L=32)
|
|
43
|
+
*
|
|
44
|
+
* The decrypted plaintext is a regular `proto.Message` whose
|
|
45
|
+
* `protocolMessage.editedMessage` field holds the new content — same
|
|
46
|
+
* shape as the legacy `protocolMessage.editedMessage` edit path, so
|
|
47
|
+
* consumers can treat the result identically.
|
|
48
|
+
*
|
|
49
|
+
* @param edit encrypted edit payload (encPayload + encIv from SecretEncryptedMessage)
|
|
50
|
+
* @param ctx info about the original message required for decryption
|
|
51
|
+
* @returns decoded outer `Message` whose `protocolMessage.editedMessage`
|
|
52
|
+
* carries the new content (extendedTextMessage / conversation / etc.)
|
|
53
|
+
*/
|
|
54
|
+
export function decryptMessageEdit({ encPayload, encIv }: {
|
|
55
|
+
encPayload: any;
|
|
56
|
+
encIv: any;
|
|
57
|
+
}, { originalSenderJid, originalMsgId, editEncKey, editorJid }: {
|
|
58
|
+
originalSenderJid: any;
|
|
59
|
+
originalMsgId: any;
|
|
60
|
+
editEncKey: any;
|
|
61
|
+
editorJid: any;
|
|
62
|
+
}): any;
|
|
63
|
+
export function cleanMessage(message: any, meId: any, meLid: any): void;
|
|
64
|
+
export function isRealMessage(message: any): boolean;
|
|
65
|
+
export function shouldIncrementChatUnread(message: any): boolean;
|
|
66
|
+
export function getChatId({ remoteJid, participant, fromMe }: {
|
|
67
|
+
remoteJid: any;
|
|
68
|
+
participant: any;
|
|
69
|
+
fromMe: any;
|
|
70
|
+
}): any;
|
|
71
|
+
export default processMessage;
|
|
72
|
+
declare function processMessage(message: any, { shouldProcessHistoryMsg, placeholderResendCache, ev, creds, signalRepository, keyStore, logger, options, getMessage }: {
|
|
73
|
+
shouldProcessHistoryMsg: any;
|
|
74
|
+
placeholderResendCache: any;
|
|
75
|
+
ev: any;
|
|
76
|
+
creds: any;
|
|
77
|
+
signalRepository: any;
|
|
78
|
+
keyStore: any;
|
|
79
|
+
logger: any;
|
|
80
|
+
options: any;
|
|
81
|
+
getMessage: any;
|
|
82
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function shouldIncludeReportingToken(message: any): boolean;
|
|
2
|
+
export function getMessageReportingToken(msgProtobuf: any, message: any, key: any): Promise<{
|
|
3
|
+
tag: string;
|
|
4
|
+
attrs: {};
|
|
5
|
+
content: {
|
|
6
|
+
tag: string;
|
|
7
|
+
attrs: {
|
|
8
|
+
v: string;
|
|
9
|
+
};
|
|
10
|
+
content: any;
|
|
11
|
+
}[];
|
|
12
|
+
} | null>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export function tokenizeCode(code: any, language?: string): {
|
|
2
|
+
highlightType: any;
|
|
3
|
+
codeContent: string;
|
|
4
|
+
}[];
|
|
5
|
+
export function toUnified(submessages: any, uuid: any): {
|
|
6
|
+
response_id: any;
|
|
7
|
+
sections: any;
|
|
8
|
+
};
|
|
9
|
+
export function prepareRichResponseMessage(content: any): {
|
|
10
|
+
messageContextInfo: {
|
|
11
|
+
botMetadata: {
|
|
12
|
+
verificationMetadata: {
|
|
13
|
+
proofs: {
|
|
14
|
+
certificateChain: Uint8Array<ArrayBuffer>[];
|
|
15
|
+
version: number;
|
|
16
|
+
useCase: number;
|
|
17
|
+
signature: Uint8Array<ArrayBuffer>;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
botForwardedMessage: {
|
|
23
|
+
message: {
|
|
24
|
+
richResponseMessage: any;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export function botMetadataSignature(): Uint8Array<ArrayBuffer>;
|
|
29
|
+
export function botMetadataCertificate(length?: number): Uint8Array<ArrayBuffer>;
|
|
30
|
+
export function wrapToBotForwardedMessage(richResponseMessage: any): {
|
|
31
|
+
messageContextInfo: {
|
|
32
|
+
botMetadata: {
|
|
33
|
+
verificationMetadata: {
|
|
34
|
+
proofs: {
|
|
35
|
+
certificateChain: Uint8Array<ArrayBuffer>[];
|
|
36
|
+
version: number;
|
|
37
|
+
useCase: number;
|
|
38
|
+
signature: Uint8Array<ArrayBuffer>;
|
|
39
|
+
}[];
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
botForwardedMessage: {
|
|
44
|
+
message: {
|
|
45
|
+
richResponseMessage: any;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
};
|