@fer2809fl/baileys 7.0.1 → 7.0.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 +322 -578
- package/WAProto/WAProto.proto +916 -360
- package/WAProto/fix-imports.js +18 -22
- package/WAProto/index.d.ts +15471 -8638
- package/WAProto/index.js +80576 -45941
- package/lib/Defaults/index.d.ts +14 -18
- package/lib/Defaults/index.js +111 -115
- package/lib/Signal/libsignal.js +22 -31
- package/lib/Signal/lid-mapping.d.ts +0 -4
- package/lib/Signal/lid-mapping.js +0 -6
- package/lib/Socket/business.d.ts +8 -75
- package/lib/Socket/business.js +1 -0
- package/lib/Socket/chats.d.ts +0 -6
- package/lib/Socket/chats.js +3 -67
- package/lib/Socket/communities.d.ts +641 -336
- package/lib/Socket/communities.js +3 -6
- package/lib/Socket/dugong.d.ts +130 -0
- package/lib/Socket/dugong.js +772 -0
- package/lib/Socket/groups.d.ts +18 -23
- package/lib/Socket/groups.js +88 -168
- package/lib/Socket/index.d.ts +631 -322
- package/lib/Socket/index.js +12 -9
- package/lib/Socket/messages-recv.d.ts +52 -84
- package/lib/Socket/messages-recv.js +193 -677
- package/lib/Socket/messages-send.d.ts +643 -262
- package/lib/Socket/messages-send.js +1559 -1359
- package/lib/Socket/mex.d.ts +0 -1
- package/lib/Socket/mex.js +8 -22
- package/lib/Socket/native-buttons.js +231 -0
- package/lib/Socket/newsletter.d.ts +27 -42
- package/lib/Socket/newsletter.js +439 -402
- package/lib/Socket/socket.d.ts +2 -6
- package/lib/Socket/socket.js +47 -39
- package/lib/Types/Auth.d.ts +0 -1
- package/lib/Types/Bussines.d.ts +34 -22
- package/lib/Types/Call.d.ts +1 -1
- package/lib/Types/Chat.d.ts +0 -1
- package/lib/Types/Contact.d.ts +0 -2
- package/lib/Types/Events.d.ts +1 -20
- package/lib/Types/GroupMetadata.d.ts +1 -4
- package/lib/Types/Message.d.ts +348 -354
- package/lib/Types/Message.js +0 -4
- package/lib/Types/{Mex.d.ts → Newsletter.d.ts} +7 -17
- package/lib/Types/{Mex.js → Newsletter.js} +5 -3
- package/lib/Types/Signal.d.ts +1 -12
- package/lib/Types/Socket.d.ts +148 -135
- package/lib/Types/State.d.ts +0 -65
- package/lib/Types/State.js +0 -43
- package/lib/Types/index.d.ts +52 -52
- package/lib/Types/index.js +30 -23
- package/lib/Utils/auth-utils.d.ts +0 -5
- package/lib/Utils/auth-utils.js +0 -12
- package/lib/Utils/browser-utils.js +0 -1
- package/lib/Utils/crypto.d.ts +12 -12
- package/lib/Utils/decode-wa-message.d.ts +0 -18
- package/lib/Utils/decode-wa-message.js +0 -34
- package/lib/Utils/event-buffer.d.ts +0 -2
- package/lib/Utils/generics.d.ts +2 -3
- package/lib/Utils/generics.js +1 -10
- package/lib/Utils/history.d.ts +0 -2
- package/lib/Utils/history.js +9 -12
- package/lib/Utils/identity-change-handler.d.ts +0 -7
- package/lib/Utils/identity-change-handler.js +0 -1
- package/lib/Utils/index.d.ts +23 -30
- package/lib/Utils/index.js +3 -9
- package/lib/Utils/link-preview.js +2 -2
- package/lib/Utils/message-retry-manager.d.ts +0 -5
- package/lib/Utils/message-retry-manager.js +11 -11
- package/lib/Utils/messages-media.d.ts +13 -45
- package/lib/Utils/messages-media.js +98 -293
- package/lib/Utils/messages.d.ts +3 -16
- package/lib/Utils/messages.js +1123 -1219
- package/lib/Utils/noise-handler.d.ts +1 -1
- package/lib/Utils/process-message.js +1 -103
- package/lib/Utils/rich-messages.d.ts +277 -0
- package/lib/Utils/rich-messages.js +1144 -0
- package/lib/Utils/signal.d.ts +0 -13
- package/lib/Utils/signal.js +0 -42
- package/lib/Utils/sticker-pack.d.ts +10 -0
- package/lib/Utils/sticker-pack.js +111 -0
- package/lib/Utils/sync-action-utils.js +0 -1
- package/lib/Utils/tc-token-utils.d.ts +1 -26
- package/lib/Utils/tc-token-utils.js +5 -151
- package/lib/Utils/validate-connection.d.ts +0 -1
- package/lib/Utils/validate-connection.js +3 -13
- package/lib/WABinary/decode.d.ts +1 -1
- package/lib/WABinary/generic-utils.d.ts +3 -1
- package/lib/WABinary/generic-utils.js +78 -0
- package/lib/WABinary/jid-utils.d.ts +0 -11
- package/lib/WABinary/jid-utils.js +0 -33
- package/lib/WAM/encode.d.ts +1 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +3 -26
- package/lib/WAUSync/Protocols/index.d.ts +0 -1
- package/lib/WAUSync/USyncQuery.d.ts +0 -1
- package/lib/WAUSync/USyncQuery.js +1 -1
- package/lib/WAUSync/USyncUser.d.ts +0 -4
- package/lib/WAUSync/USyncUser.js +0 -8
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -4
- package/package.json +27 -31
- package/LICENSE +0 -21
- package/engine-requirements.js +0 -10
- package/lib/Defaults/index.d.ts.map +0 -1
- package/lib/Defaults/index.js.map +0 -1
- package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-message-key.js.map +0 -1
- package/lib/Signal/libsignal.d.ts.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Signal/lid-mapping.d.ts.map +0 -1
- package/lib/Signal/lid-mapping.js.map +0 -1
- package/lib/Socket/Client/index.d.ts.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- package/lib/Socket/messages-recv.d.ts.map +0 -1
- package/lib/Socket/messages-recv.js.map +0 -1
- package/lib/Socket/messages-send.d.ts.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/smgss.d.ts +0 -119
- package/lib/Socket/smgss.d.ts.map +0 -1
- package/lib/Socket/smgss.js +0 -453
- package/lib/Socket/smgss.js.map +0 -1
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/index.d.ts.map +0 -1
- package/lib/Store/index.js +0 -4
- package/lib/Store/index.js.map +0 -1
- package/lib/Store/make-in-memory-store.d.ts +0 -132
- package/lib/Store/make-in-memory-store.d.ts.map +0 -1
- package/lib/Store/make-in-memory-store.js +0 -450
- package/lib/Store/make-in-memory-store.js.map +0 -1
- package/lib/Store/make-ordered-dictionary.d.ts +0 -14
- package/lib/Store/make-ordered-dictionary.d.ts.map +0 -1
- package/lib/Store/make-ordered-dictionary.js +0 -80
- package/lib/Store/make-ordered-dictionary.js.map +0 -1
- package/lib/Store/object-repository.d.ts +0 -13
- package/lib/Store/object-repository.d.ts.map +0 -1
- package/lib/Store/object-repository.js +0 -24
- package/lib/Store/object-repository.js.map +0 -1
- package/lib/Types/Auth.d.ts.map +0 -1
- package/lib/Types/Auth.js.map +0 -1
- package/lib/Types/Bussines.d.ts.map +0 -1
- package/lib/Types/Bussines.js.map +0 -1
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Message.js.map +0 -1
- package/lib/Types/Mex.d.ts.map +0 -1
- package/lib/Types/Mex.js.map +0 -1
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- package/lib/Utils/auth-utils.d.ts.map +0 -1
- package/lib/Utils/auth-utils.js.map +0 -1
- package/lib/Utils/browser-utils.d.ts.map +0 -1
- package/lib/Utils/browser-utils.js.map +0 -1
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- package/lib/Utils/button-handler.d.ts +0 -28
- package/lib/Utils/button-handler.d.ts.map +0 -1
- package/lib/Utils/button-handler.js +0 -140
- package/lib/Utils/button-handler.js.map +0 -1
- package/lib/Utils/chat-utils.d.ts.map +0 -1
- package/lib/Utils/chat-utils.js.map +0 -1
- package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
- package/lib/Utils/companion-reg-client-utils.js.map +0 -1
- package/lib/Utils/crypto.d.ts.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- package/lib/Utils/decode-wa-message.d.ts.map +0 -1
- package/lib/Utils/decode-wa-message.js.map +0 -1
- package/lib/Utils/event-buffer.d.ts.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/identity-change-handler.d.ts.map +0 -1
- package/lib/Utils/identity-change-handler.js.map +0 -1
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- package/lib/Utils/interactive.d.ts +0 -60
- package/lib/Utils/interactive.d.ts.map +0 -1
- package/lib/Utils/interactive.js +0 -224
- package/lib/Utils/interactive.js.map +0 -1
- package/lib/Utils/link-preview.d.ts.map +0 -1
- package/lib/Utils/link-preview.js.map +0 -1
- package/lib/Utils/logger.d.ts.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- package/lib/Utils/lt-hash.d.ts.map +0 -1
- package/lib/Utils/lt-hash.js.map +0 -1
- package/lib/Utils/make-mutex.d.ts.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- package/lib/Utils/message-composer.d.ts +0 -93
- package/lib/Utils/message-composer.d.ts.map +0 -1
- package/lib/Utils/message-composer.js +0 -311
- package/lib/Utils/message-composer.js.map +0 -1
- package/lib/Utils/message-retry-manager.d.ts.map +0 -1
- package/lib/Utils/message-retry-manager.js.map +0 -1
- package/lib/Utils/messages-media.d.ts.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages-newsletter.d.ts +0 -74
- package/lib/Utils/messages-newsletter.d.ts.map +0 -1
- package/lib/Utils/messages-newsletter.js +0 -128
- package/lib/Utils/messages-newsletter.js.map +0 -1
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/offline-node-processor.d.ts.map +0 -1
- package/lib/Utils/offline-node-processor.js.map +0 -1
- package/lib/Utils/pre-key-manager.d.ts.map +0 -1
- package/lib/Utils/pre-key-manager.js.map +0 -1
- package/lib/Utils/process-message.d.ts.map +0 -1
- package/lib/Utils/process-message.js.map +0 -1
- package/lib/Utils/reporting-utils.d.ts.map +0 -1
- package/lib/Utils/reporting-utils.js.map +0 -1
- package/lib/Utils/shortcake-crypto.d.ts +0 -36
- package/lib/Utils/shortcake-crypto.d.ts.map +0 -1
- package/lib/Utils/shortcake-crypto.js +0 -71
- package/lib/Utils/shortcake-crypto.js.map +0 -1
- package/lib/Utils/shortcake.d.ts +0 -36
- package/lib/Utils/shortcake.d.ts.map +0 -1
- package/lib/Utils/shortcake.js +0 -162
- package/lib/Utils/shortcake.js.map +0 -1
- package/lib/Utils/signal.d.ts.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- package/lib/Utils/stanza-ack.d.ts.map +0 -1
- package/lib/Utils/stanza-ack.js.map +0 -1
- package/lib/Utils/sync-action-utils.d.ts.map +0 -1
- package/lib/Utils/sync-action-utils.js.map +0 -1
- package/lib/Utils/tc-token-utils.d.ts.map +0 -1
- package/lib/Utils/tc-token-utils.js.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-single-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-single-file-auth-state.js +0 -111
- package/lib/Utils/use-single-file-auth-state.js.map +0 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts +0 -14
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-sqlite-auth-state.js +0 -107
- package/lib/Utils/use-sqlite-auth-state.js.map +0 -1
- package/lib/Utils/validate-connection.d.ts.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- package/lib/WABinary/generic-utils.d.ts.map +0 -1
- package/lib/WABinary/generic-utils.js.map +0 -1
- package/lib/WABinary/index.d.ts.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- package/lib/WABinary/jid-utils.d.ts.map +0 -1
- package/lib/WABinary/jid-utils.js.map +0 -1
- package/lib/WABinary/types.d.ts.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
package/lib/Types/index.d.ts
CHANGED
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
|
|
14
|
-
import type {
|
|
1
|
+
export * from "./Auth.js";
|
|
2
|
+
export * from "./GroupMetadata.js";
|
|
3
|
+
export * from "./Chat.js";
|
|
4
|
+
export * from "./Contact.js";
|
|
5
|
+
export * from "./State.js";
|
|
6
|
+
export * from "./Message.js";
|
|
7
|
+
export * from "./Socket.js";
|
|
8
|
+
export * from "./Events.js";
|
|
9
|
+
export * from "./Product.js";
|
|
10
|
+
export * from "./Call.js";
|
|
11
|
+
export * from "./Signal.js";
|
|
12
|
+
export * from "./Bussines.js";
|
|
13
|
+
export * from "./Newsletter.js";
|
|
14
|
+
import type { AuthenticationState } from "./Auth.js";
|
|
15
|
+
import type { SocketConfig } from "./Socket.js";
|
|
15
16
|
export type UserFacingSocketConfig = Partial<SocketConfig> & {
|
|
16
|
-
|
|
17
|
+
auth: AuthenticationState;
|
|
17
18
|
};
|
|
18
19
|
export type BrowsersMap = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
appropriate(browser: string): [string, string, string];
|
|
20
|
+
ubuntu(browser: string): [string, string, string];
|
|
21
|
+
macOS(browser: string): [string, string, string];
|
|
22
|
+
baileys(browser: string): [string, string, string];
|
|
23
|
+
windows(browser: string): [string, string, string];
|
|
24
|
+
appropriate(browser: string): [string, string, string];
|
|
25
25
|
};
|
|
26
26
|
export declare enum DisconnectReason {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
connectionClosed = 428,
|
|
28
|
+
connectionLost = 408,
|
|
29
|
+
connectionReplaced = 440,
|
|
30
|
+
timedOut = 408,
|
|
31
|
+
loggedOut = 401,
|
|
32
|
+
badSession = 500,
|
|
33
|
+
restartRequired = 515,
|
|
34
|
+
multideviceMismatch = 411,
|
|
35
|
+
forbidden = 403,
|
|
36
|
+
unavailableService = 503,
|
|
37
37
|
}
|
|
38
38
|
export type WAInitResponse = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
ref: string;
|
|
40
|
+
ttl: number;
|
|
41
|
+
status: 200;
|
|
42
42
|
};
|
|
43
43
|
export type WABusinessHoursConfig = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
day_of_week: string;
|
|
45
|
+
mode: string;
|
|
46
|
+
open_time?: number;
|
|
47
|
+
close_time?: number;
|
|
48
48
|
};
|
|
49
49
|
export type WABusinessProfile = {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
description: string;
|
|
51
|
+
email: string | undefined;
|
|
52
|
+
business_hours: {
|
|
53
|
+
timezone?: string;
|
|
54
|
+
config?: WABusinessHoursConfig[];
|
|
55
|
+
business_config?: WABusinessHoursConfig[];
|
|
56
|
+
};
|
|
57
|
+
website: string[];
|
|
58
|
+
category?: string;
|
|
59
|
+
wid?: string;
|
|
60
|
+
address?: string;
|
|
61
61
|
};
|
|
62
62
|
export type CurveKeyPair = {
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
private: Uint8Array;
|
|
64
|
+
public: Uint8Array;
|
|
65
65
|
};
|
|
66
|
-
//# sourceMappingURL=index.d.ts.map
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/Types/index.js
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
1
|
+
export * from "./Auth.js";
|
|
2
|
+
export * from "./GroupMetadata.js";
|
|
3
|
+
export * from "./Chat.js";
|
|
4
|
+
export * from "./Contact.js";
|
|
5
|
+
export * from "./State.js";
|
|
6
|
+
export * from "./Message.js";
|
|
7
|
+
export * from "./Socket.js";
|
|
8
|
+
export * from "./Events.js";
|
|
9
|
+
export * from "./Product.js";
|
|
10
|
+
export * from "./Call.js";
|
|
11
|
+
export * from "./Signal.js";
|
|
12
|
+
export * from "./Bussines.js";
|
|
13
|
+
export * from "./Newsletter.js";
|
|
13
14
|
export var DisconnectReason;
|
|
14
15
|
(function (DisconnectReason) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
DisconnectReason[(DisconnectReason["connectionClosed"] = 428)] =
|
|
17
|
+
"connectionClosed";
|
|
18
|
+
DisconnectReason[(DisconnectReason["connectionLost"] = 408)] =
|
|
19
|
+
"connectionLost";
|
|
20
|
+
DisconnectReason[(DisconnectReason["connectionReplaced"] = 440)] =
|
|
21
|
+
"connectionReplaced";
|
|
22
|
+
DisconnectReason[(DisconnectReason["timedOut"] = 408)] = "timedOut";
|
|
23
|
+
DisconnectReason[(DisconnectReason["loggedOut"] = 401)] = "loggedOut";
|
|
24
|
+
DisconnectReason[(DisconnectReason["badSession"] = 500)] = "badSession";
|
|
25
|
+
DisconnectReason[(DisconnectReason["restartRequired"] = 515)] =
|
|
26
|
+
"restartRequired";
|
|
27
|
+
DisconnectReason[(DisconnectReason["multideviceMismatch"] = 411)] =
|
|
28
|
+
"multideviceMismatch";
|
|
29
|
+
DisconnectReason[(DisconnectReason["forbidden"] = 403)] = "forbidden";
|
|
30
|
+
DisconnectReason[(DisconnectReason["unavailableService"] = 503)] =
|
|
31
|
+
"unavailableService";
|
|
25
32
|
})(DisconnectReason || (DisconnectReason = {}));
|
|
26
|
-
//# sourceMappingURL=index.js.map
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -15,10 +15,5 @@ export declare function makeCacheableSignalKeyStore(store: SignalKeyStore, logge
|
|
|
15
15
|
* @returns SignalKeyStore with transaction capability
|
|
16
16
|
*/
|
|
17
17
|
export declare const addTransactionCapability: (state: SignalKeyStore, logger: ILogger, { maxCommitRetries, delayBetweenTriesMs }: TransactionCapabilityOptions) => SignalKeyStoreWithTransaction;
|
|
18
|
-
/**
|
|
19
|
-
* Returns the authenticated user's JID, or throws a Boom-401 if creds are not yet authenticated.
|
|
20
|
-
* Use this anywhere we'd otherwise reach for `creds.me!.id` to fail fast with a descriptive error.
|
|
21
|
-
*/
|
|
22
|
-
export declare const assertMeId: (creds: AuthenticationCreds) => string;
|
|
23
18
|
export declare const initAuthCreds: () => AuthenticationCreds;
|
|
24
19
|
//# sourceMappingURL=auth-utils.d.ts.map
|
package/lib/Utils/auth-utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import NodeCache from '@cacheable/node-cache';
|
|
2
|
-
import { Boom } from '@hapi/boom';
|
|
3
2
|
import { AsyncLocalStorage } from 'async_hooks';
|
|
4
3
|
import { Mutex } from 'async-mutex';
|
|
5
4
|
import { randomBytes } from 'crypto';
|
|
@@ -265,17 +264,6 @@ export const addTransactionCapability = (state, logger, { maxCommitRetries, dela
|
|
|
265
264
|
}
|
|
266
265
|
};
|
|
267
266
|
};
|
|
268
|
-
/**
|
|
269
|
-
* Returns the authenticated user's JID, or throws a Boom-401 if creds are not yet authenticated.
|
|
270
|
-
* Use this anywhere we'd otherwise reach for `creds.me!.id` to fail fast with a descriptive error.
|
|
271
|
-
*/
|
|
272
|
-
export const assertMeId = (creds) => {
|
|
273
|
-
const id = creds.me?.id;
|
|
274
|
-
if (!id) {
|
|
275
|
-
throw new Boom('Cannot proceed: socket is not authenticated yet (creds.me.id is missing)', { statusCode: 401 });
|
|
276
|
-
}
|
|
277
|
-
return id;
|
|
278
|
-
};
|
|
279
267
|
export const initAuthCreds = () => {
|
|
280
268
|
const identityKey = Curve.generateKeyPair();
|
|
281
269
|
return {
|
|
@@ -18,7 +18,6 @@ export const Browsers = {
|
|
|
18
18
|
macOS: browser => ['Mac OS', browser, '14.4.1'],
|
|
19
19
|
baileys: browser => ['Baileys', browser, '6.5.0'],
|
|
20
20
|
windows: browser => ['Windows', browser, '10.0.22631'],
|
|
21
|
-
android: browser => [browser, 'Android', ''],
|
|
22
21
|
/** The appropriate browser based on your OS & release */
|
|
23
22
|
appropriate: browser => [PLATFORM_MAP[platform()] || 'Ubuntu', browser, release()]
|
|
24
23
|
};
|
package/lib/Utils/crypto.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { KeyPair } from '../Types/index.js';
|
|
2
2
|
export { md5, hkdf } from 'whatsapp-rust-bridge';
|
|
3
3
|
/** prefix version byte to the pub keys, required for some curve crypto functions */
|
|
4
|
-
export declare const generateSignalPubKey: (pubKey: Uint8Array | Buffer) => Uint8Array<ArrayBufferLike> | Buffer
|
|
4
|
+
export declare const generateSignalPubKey: (pubKey: Uint8Array | Buffer) => Uint8Array<ArrayBufferLike> | Buffer;
|
|
5
5
|
export declare const Curve: {
|
|
6
6
|
generateKeyPair: () => KeyPair;
|
|
7
|
-
sharedKey: (privateKey: Uint8Array, publicKey: Uint8Array) => Buffer
|
|
7
|
+
sharedKey: (privateKey: Uint8Array, publicKey: Uint8Array) => Buffer;
|
|
8
8
|
sign: (privateKey: Uint8Array, buf: Uint8Array) => Uint8Array<ArrayBufferLike>;
|
|
9
9
|
verify: (pubKey: Uint8Array, message: Uint8Array, signature: Uint8Array) => boolean;
|
|
10
10
|
};
|
|
@@ -17,21 +17,21 @@ export declare const signedKeyPair: (identityKeyPair: KeyPair, keyId: number) =>
|
|
|
17
17
|
* encrypt AES 256 GCM;
|
|
18
18
|
* where the tag tag is suffixed to the ciphertext
|
|
19
19
|
* */
|
|
20
|
-
export declare function aesEncryptGCM(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): Buffer
|
|
20
|
+
export declare function aesEncryptGCM(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): Buffer;
|
|
21
21
|
/**
|
|
22
22
|
* decrypt AES 256 GCM;
|
|
23
23
|
* where the auth tag is suffixed to the ciphertext
|
|
24
24
|
* */
|
|
25
|
-
export declare function aesDecryptGCM(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): Buffer
|
|
26
|
-
export declare function aesEncryptCTR(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array): Buffer
|
|
27
|
-
export declare function aesDecryptCTR(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array): Buffer
|
|
25
|
+
export declare function aesDecryptGCM(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array, additionalData: Uint8Array): Buffer;
|
|
26
|
+
export declare function aesEncryptCTR(plaintext: Uint8Array, key: Uint8Array, iv: Uint8Array): Buffer;
|
|
27
|
+
export declare function aesDecryptCTR(ciphertext: Uint8Array, key: Uint8Array, iv: Uint8Array): Buffer;
|
|
28
28
|
/** decrypt AES 256 CBC; where the IV is prefixed to the buffer */
|
|
29
|
-
export declare function aesDecrypt(buffer: Uint8Array, key: Uint8Array): Buffer
|
|
29
|
+
export declare function aesDecrypt(buffer: Uint8Array, key: Uint8Array): Buffer;
|
|
30
30
|
/** decrypt AES 256 CBC */
|
|
31
|
-
export declare function aesDecryptWithIV(buffer: Uint8Array, key: Uint8Array, IV: Uint8Array): Buffer
|
|
32
|
-
export declare function aesEncrypt(buffer: Uint8Array, key: Uint8Array): Buffer
|
|
33
|
-
export declare function aesEncrypWithIV(buffer: Buffer, key: Buffer, IV: Buffer): Buffer
|
|
34
|
-
export declare function hmacSign(buffer: Buffer | Uint8Array, key: Buffer | Uint8Array, variant?: 'sha256' | 'sha512'):
|
|
35
|
-
export declare function sha256(buffer: Buffer):
|
|
31
|
+
export declare function aesDecryptWithIV(buffer: Uint8Array, key: Uint8Array, IV: Uint8Array): Buffer;
|
|
32
|
+
export declare function aesEncrypt(buffer: Uint8Array, key: Uint8Array): Buffer;
|
|
33
|
+
export declare function aesEncrypWithIV(buffer: Buffer, key: Buffer, IV: Buffer): Buffer;
|
|
34
|
+
export declare function hmacSign(buffer: Buffer | Uint8Array, key: Buffer | Uint8Array, variant?: 'sha256' | 'sha512'): Buffer;
|
|
35
|
+
export declare function sha256(buffer: Buffer): Buffer;
|
|
36
36
|
export declare function derivePairingCodeKey(pairingCode: string, salt: Buffer): Promise<Buffer>;
|
|
37
37
|
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -5,15 +5,12 @@ import type { ILogger } from './logger.js';
|
|
|
5
5
|
export declare const getDecryptionJid: (sender: string, repository: SignalRepositoryWithLIDStore) => Promise<string>;
|
|
6
6
|
export declare const NO_MESSAGE_FOUND_ERROR_TEXT = "Message absent from node";
|
|
7
7
|
export declare const MISSING_KEYS_ERROR_TEXT = "Key used already or never filled";
|
|
8
|
-
export declare const ACCOUNT_RESTRICTED_TEXT = "Your account has been restricted";
|
|
9
8
|
export declare const DECRYPTION_RETRY_CONFIG: {
|
|
10
9
|
maxRetries: number;
|
|
11
10
|
baseDelayMs: number;
|
|
12
11
|
sessionRecordErrors: string[];
|
|
13
12
|
};
|
|
14
|
-
/** NACK reason codes we send to the server (client → server) */
|
|
15
13
|
export declare const NACK_REASONS: {
|
|
16
|
-
SenderReachoutTimelocked: number;
|
|
17
14
|
ParsingError: number;
|
|
18
15
|
UnrecognizedStanza: number;
|
|
19
16
|
UnrecognizedStanzaClass: number;
|
|
@@ -28,21 +25,6 @@ export declare const NACK_REASONS: {
|
|
|
28
25
|
UnsupportedLIDGroup: number;
|
|
29
26
|
DBOperationFailed: number;
|
|
30
27
|
};
|
|
31
|
-
/**
|
|
32
|
-
* Server-side error codes returned in ack stanzas (server → client) that we
|
|
33
|
-
* currently have dedicated handlers for. Extend as more handlers are added.
|
|
34
|
-
* Distinct from the client-side NackReason enum (WAWebCreateNackFromStanza).
|
|
35
|
-
*/
|
|
36
|
-
export declare const SERVER_ERROR_CODES: {
|
|
37
|
-
/**
|
|
38
|
-
* 1:1 message missing privacy token (tctoken). Usually means the account is
|
|
39
|
-
* restricted: WhatsApp blocks starting new chats but preserves existing ones,
|
|
40
|
-
* since established chats already carry a tctoken.
|
|
41
|
-
*/
|
|
42
|
-
readonly MessageAccountRestriction: "463";
|
|
43
|
-
/** Stanza validation failure (SMAX_INVALID) — likely stale device session */
|
|
44
|
-
readonly SmaxInvalid: "479";
|
|
45
|
-
};
|
|
46
28
|
export declare const extractAddressingContext: (stanza: BinaryNode) => {
|
|
47
29
|
addressingMode: string;
|
|
48
30
|
senderAlt: string | undefined;
|
|
@@ -27,16 +27,13 @@ const storeMappingFromEnvelope = async (stanza, sender, repository, decryptionJi
|
|
|
27
27
|
};
|
|
28
28
|
export const NO_MESSAGE_FOUND_ERROR_TEXT = 'Message absent from node';
|
|
29
29
|
export const MISSING_KEYS_ERROR_TEXT = 'Key used already or never filled';
|
|
30
|
-
export const ACCOUNT_RESTRICTED_TEXT = 'Your account has been restricted';
|
|
31
30
|
// Retry configuration for failed decryption
|
|
32
31
|
export const DECRYPTION_RETRY_CONFIG = {
|
|
33
32
|
maxRetries: 3,
|
|
34
33
|
baseDelayMs: 100,
|
|
35
34
|
sessionRecordErrors: ['No session record', 'SessionError: No session record']
|
|
36
35
|
};
|
|
37
|
-
/** NACK reason codes we send to the server (client → server) */
|
|
38
36
|
export const NACK_REASONS = {
|
|
39
|
-
SenderReachoutTimelocked: 463,
|
|
40
37
|
ParsingError: 487,
|
|
41
38
|
UnrecognizedStanza: 488,
|
|
42
39
|
UnrecognizedStanzaClass: 489,
|
|
@@ -51,21 +48,6 @@ export const NACK_REASONS = {
|
|
|
51
48
|
UnsupportedLIDGroup: 551,
|
|
52
49
|
DBOperationFailed: 552
|
|
53
50
|
};
|
|
54
|
-
/**
|
|
55
|
-
* Server-side error codes returned in ack stanzas (server → client) that we
|
|
56
|
-
* currently have dedicated handlers for. Extend as more handlers are added.
|
|
57
|
-
* Distinct from the client-side NackReason enum (WAWebCreateNackFromStanza).
|
|
58
|
-
*/
|
|
59
|
-
export const SERVER_ERROR_CODES = {
|
|
60
|
-
/**
|
|
61
|
-
* 1:1 message missing privacy token (tctoken). Usually means the account is
|
|
62
|
-
* restricted: WhatsApp blocks starting new chats but preserves existing ones,
|
|
63
|
-
* since established chats already carry a tctoken.
|
|
64
|
-
*/
|
|
65
|
-
MessageAccountRestriction: '463',
|
|
66
|
-
/** Stanza validation failure (SMAX_INVALID) — likely stale device session */
|
|
67
|
-
SmaxInvalid: '479'
|
|
68
|
-
};
|
|
69
51
|
export const extractAddressingContext = (stanza) => {
|
|
70
52
|
let senderAlt;
|
|
71
53
|
let recipientAlt;
|
|
@@ -106,12 +88,6 @@ export function decodeMessageNode(stanza, meId, meLid) {
|
|
|
106
88
|
const from = stanza.attrs.from;
|
|
107
89
|
const participant = stanza.attrs.participant;
|
|
108
90
|
const recipient = stanza.attrs.recipient;
|
|
109
|
-
if (!msgId) {
|
|
110
|
-
throw new Boom('Invalid message stanza: missing id attribute', { data: stanza });
|
|
111
|
-
}
|
|
112
|
-
if (!from) {
|
|
113
|
-
throw new Boom('Invalid message stanza: missing from attribute', { data: stanza });
|
|
114
|
-
}
|
|
115
91
|
const addressingContext = extractAddressingContext(stanza);
|
|
116
92
|
const isMe = (jid) => areJidsSameUser(jid, meId);
|
|
117
93
|
const isMeLid = (jid) => areJidsSameUser(jid, meLid);
|
|
@@ -126,12 +102,6 @@ export function decodeMessageNode(stanza, meId, meLid) {
|
|
|
126
102
|
chatId = recipient;
|
|
127
103
|
}
|
|
128
104
|
else {
|
|
129
|
-
// Peer-routed self stanzas (history sync, app-state sync, etc.) arrive
|
|
130
|
-
// with `from` set to our own device but no `recipient` attribute —
|
|
131
|
-
// still mark as fromMe so self-only protocolMessage handlers run.
|
|
132
|
-
if (isMe(from) || isMeLid(from)) {
|
|
133
|
-
fromMe = true;
|
|
134
|
-
}
|
|
135
105
|
chatId = from;
|
|
136
106
|
}
|
|
137
107
|
msgType = 'chat';
|
|
@@ -178,14 +148,10 @@ export function decodeMessageNode(stanza, meId, meLid) {
|
|
|
178
148
|
const key = {
|
|
179
149
|
remoteJid: chatId,
|
|
180
150
|
remoteJidAlt: !isJidGroup(chatId) ? addressingContext.senderAlt : undefined,
|
|
181
|
-
remoteJidUsername: !isJidGroup(chatId)
|
|
182
|
-
? stanza.attrs.peer_recipient_username || stanza.attrs.recipient_username
|
|
183
|
-
: undefined,
|
|
184
151
|
fromMe,
|
|
185
152
|
id: msgId,
|
|
186
153
|
participant,
|
|
187
154
|
participantAlt: isJidGroup(chatId) ? addressingContext.senderAlt : undefined,
|
|
188
|
-
participantUsername: stanza.attrs.participant ? stanza.attrs.participant_username : undefined,
|
|
189
155
|
addressingMode: addressingContext.addressingMode,
|
|
190
156
|
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
|
|
191
157
|
};
|
|
@@ -24,8 +24,6 @@ type BaileysBufferableEventEmitter = BaileysEventEmitter & {
|
|
|
24
24
|
flush(): boolean;
|
|
25
25
|
/** is there an ongoing buffer */
|
|
26
26
|
isBuffering(): boolean;
|
|
27
|
-
/** destroy the event buffer, clearing all resources */
|
|
28
|
-
destroy(): void;
|
|
29
27
|
};
|
|
30
28
|
/**
|
|
31
29
|
* The event buffer logically consolidates different events into a single event
|
package/lib/Utils/generics.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type Long from 'long';
|
|
2
1
|
import { proto } from '../../WAProto/index.js';
|
|
3
2
|
import type { BaileysEventEmitter, BaileysEventMap, ConnectionState, WACallUpdateType, WAMessageKey, WAVersion } from '../Types/index.js';
|
|
4
3
|
import { type BinaryNode } from '../WABinary/index.js';
|
|
@@ -8,10 +7,10 @@ export declare const BufferJSON: {
|
|
|
8
7
|
};
|
|
9
8
|
export declare const getKeyAuthor: (key: WAMessageKey | undefined | null, meId?: string) => string;
|
|
10
9
|
export declare const isStringNullOrEmpty: (value: string | null | undefined) => value is null | undefined | "";
|
|
11
|
-
export declare const writeRandomPadMax16: (msg: Uint8Array) => Buffer
|
|
10
|
+
export declare const writeRandomPadMax16: (msg: Uint8Array) => Buffer;
|
|
12
11
|
export declare const unpadRandomMax16: (e: Uint8Array | Buffer) => Uint8Array<ArrayBuffer>;
|
|
13
12
|
export declare const generateParticipantHashV2: (participants: string[]) => string;
|
|
14
|
-
export declare const encodeWAMessage: (message: proto.IMessage) => Buffer
|
|
13
|
+
export declare const encodeWAMessage: (message: proto.IMessage) => Buffer;
|
|
15
14
|
export declare const generateRegistrationId: () => number;
|
|
16
15
|
export declare const encodeBigEndian: (e: number, t?: number) => Uint8Array<ArrayBuffer>;
|
|
17
16
|
export declare const toNumber: (t: Long | number | null | undefined) => number;
|
package/lib/Utils/generics.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Boom } from '@hapi/boom';
|
|
2
2
|
import { createHash, randomBytes } from 'crypto';
|
|
3
3
|
import { proto } from '../../WAProto/index.js';
|
|
4
|
-
const baileysVersion = [2, 3000,
|
|
4
|
+
const baileysVersion = [2, 3000, 1035194821];
|
|
5
5
|
import { DisconnectReason } from '../Types/index.js';
|
|
6
6
|
import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
|
|
7
7
|
import { sha256 } from './crypto.js';
|
|
@@ -314,15 +314,6 @@ export const getCallStatusFromNode = ({ tag, attrs }) => {
|
|
|
314
314
|
status = 'terminate';
|
|
315
315
|
}
|
|
316
316
|
break;
|
|
317
|
-
case 'preaccept':
|
|
318
|
-
status = 'preaccept';
|
|
319
|
-
break;
|
|
320
|
-
case 'transport':
|
|
321
|
-
status = 'transport';
|
|
322
|
-
break;
|
|
323
|
-
case 'relaylatency':
|
|
324
|
-
status = 'relaylatency';
|
|
325
|
-
break;
|
|
326
317
|
case 'reject':
|
|
327
318
|
status = 'reject';
|
|
328
319
|
break;
|
package/lib/Utils/history.d.ts
CHANGED
|
@@ -7,7 +7,6 @@ export declare const processHistoryMessage: (item: proto.IHistorySync, logger?:
|
|
|
7
7
|
contacts: Contact[];
|
|
8
8
|
messages: WAMessage[];
|
|
9
9
|
lidPnMappings: LIDMapping[];
|
|
10
|
-
pastParticipants: proto.IPastParticipants[] | null | undefined;
|
|
11
10
|
syncType: proto.HistorySync.HistorySyncType | null | undefined;
|
|
12
11
|
progress: number | null | undefined;
|
|
13
12
|
};
|
|
@@ -16,7 +15,6 @@ export declare const downloadAndProcessHistorySyncNotification: (msg: proto.Mess
|
|
|
16
15
|
contacts: Contact[];
|
|
17
16
|
messages: WAMessage[];
|
|
18
17
|
lidPnMappings: LIDMapping[];
|
|
19
|
-
pastParticipants: proto.IPastParticipants[] | null | undefined;
|
|
20
18
|
syncType: proto.HistorySync.HistorySyncType | null | undefined;
|
|
21
19
|
progress: number | null | undefined;
|
|
22
20
|
}>;
|
package/lib/Utils/history.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { pipeline } from 'stream/promises';
|
|
2
1
|
import { promisify } from 'util';
|
|
3
|
-
import {
|
|
2
|
+
import { inflate } from 'zlib';
|
|
4
3
|
import { proto } from '../../WAProto/index.js';
|
|
5
4
|
import { WAMessageStubType } from '../Types/index.js';
|
|
6
5
|
import { isHostedLidUser, isHostedPnUser, isLidUser, isPnUser } from '../WABinary/index.js';
|
|
@@ -25,13 +24,13 @@ const extractPnFromMessages = (messages) => {
|
|
|
25
24
|
};
|
|
26
25
|
export const downloadHistory = async (msg, options) => {
|
|
27
26
|
const stream = await downloadContentFromMessage(msg, 'md-msg-hist', { options });
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
27
|
+
const bufferArray = [];
|
|
28
|
+
for await (const chunk of stream) {
|
|
29
|
+
bufferArray.push(chunk);
|
|
30
|
+
}
|
|
31
|
+
let buffer = Buffer.concat(bufferArray);
|
|
32
|
+
// decompress buffer
|
|
33
|
+
buffer = await inflatePromise(buffer);
|
|
35
34
|
const syncData = proto.HistorySync.decode(buffer);
|
|
36
35
|
return syncData;
|
|
37
36
|
};
|
|
@@ -56,7 +55,6 @@ export const processHistoryMessage = (item, logger) => {
|
|
|
56
55
|
contacts.push({
|
|
57
56
|
id: chat.id,
|
|
58
57
|
name: chat.displayName || chat.name || chat.username || undefined,
|
|
59
|
-
username: chat.username || undefined,
|
|
60
58
|
lid: chat.lidJid || chat.accountLid || undefined,
|
|
61
59
|
phoneNumber: chat.pnJid || undefined
|
|
62
60
|
});
|
|
@@ -97,7 +95,7 @@ export const processHistoryMessage = (item, logger) => {
|
|
|
97
95
|
});
|
|
98
96
|
}
|
|
99
97
|
}
|
|
100
|
-
chats.push(chat);
|
|
98
|
+
chats.push({ ...chat });
|
|
101
99
|
}
|
|
102
100
|
break;
|
|
103
101
|
case proto.HistorySync.HistorySyncType.PUSH_NAME:
|
|
@@ -111,7 +109,6 @@ export const processHistoryMessage = (item, logger) => {
|
|
|
111
109
|
contacts,
|
|
112
110
|
messages,
|
|
113
111
|
lidPnMappings,
|
|
114
|
-
pastParticipants: item.pastParticipants,
|
|
115
112
|
syncType: item.syncType,
|
|
116
113
|
progress: item.progress
|
|
117
114
|
};
|
|
@@ -32,13 +32,6 @@ export type IdentityChangeContext = {
|
|
|
32
32
|
assertSessions: (jids: string[], force?: boolean) => Promise<boolean>;
|
|
33
33
|
debounceCache: NodeCache<boolean>;
|
|
34
34
|
logger: ILogger;
|
|
35
|
-
/**
|
|
36
|
-
* Invoked right before `assertSessions` is called for an existing-session identity change.
|
|
37
|
-
* Used to kick off fire-and-forget side effects (e.g. tctoken re-issuance) in the same
|
|
38
|
-
* order WA Web does — i.e. before the E2E session is re-established.
|
|
39
|
-
* Must not throw; implementations are responsible for their own error handling.
|
|
40
|
-
*/
|
|
41
|
-
onBeforeSessionRefresh?: (jid: string) => void;
|
|
42
35
|
};
|
|
43
36
|
export declare function handleIdentityChange(node: BinaryNode, ctx: IdentityChangeContext): Promise<IdentityChangeResult>;
|
|
44
37
|
//# sourceMappingURL=identity-change-handler.d.ts.map
|
|
@@ -37,7 +37,6 @@ export async function handleIdentityChange(node, ctx) {
|
|
|
37
37
|
ctx.logger.debug({ jid: from }, 'skipping session refresh during offline processing');
|
|
38
38
|
return { action: 'skipped_offline' };
|
|
39
39
|
}
|
|
40
|
-
ctx.onBeforeSessionRefresh?.(from);
|
|
41
40
|
try {
|
|
42
41
|
await ctx.assertSessions([from], true);
|
|
43
42
|
return { action: 'session_refreshed' };
|
package/lib/Utils/index.d.ts
CHANGED
|
@@ -1,30 +1,23 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export * from
|
|
12
|
-
export * from
|
|
13
|
-
export * from
|
|
14
|
-
export * from
|
|
15
|
-
export * from
|
|
16
|
-
export * from
|
|
17
|
-
export * from
|
|
18
|
-
export * from
|
|
19
|
-
export * from
|
|
20
|
-
export * from
|
|
21
|
-
export * from
|
|
22
|
-
export * from
|
|
23
|
-
|
|
24
|
-
export * from './message-composer.js';
|
|
25
|
-
export * from './messages-newsletter.js';
|
|
26
|
-
export * from './shortcake-crypto.js';
|
|
27
|
-
export * from './shortcake.js';
|
|
28
|
-
export * from './interactive.js';
|
|
29
|
-
export * from './button-handler.js';
|
|
30
|
-
//# sourceMappingURL=index.d.ts.map
|
|
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 "./link-preview.js";
|
|
15
|
+
export * from "./event-buffer.js";
|
|
16
|
+
export * from "./process-message.js";
|
|
17
|
+
export * from "./message-retry-manager.js";
|
|
18
|
+
export * from "./browser-utils.js";
|
|
19
|
+
export * from "./identity-change-handler.js";
|
|
20
|
+
export * from "./stanza-ack.js";
|
|
21
|
+
export * from "./rich-messages.js";
|
|
22
|
+
export * from "./sticker-pack.js";
|
|
23
|
+
//# sourceMappingURL=index.d.ts.map
|
package/lib/Utils/index.js
CHANGED
|
@@ -11,20 +11,14 @@ export * from './chat-utils.js';
|
|
|
11
11
|
export * from './lt-hash.js';
|
|
12
12
|
export * from './auth-utils.js';
|
|
13
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
14
|
export * from './link-preview.js';
|
|
17
15
|
export * from './event-buffer.js';
|
|
18
16
|
export * from './process-message.js';
|
|
19
17
|
export * from './message-retry-manager.js';
|
|
20
18
|
export * from './browser-utils.js';
|
|
21
|
-
export * from './companion-reg-client-utils.js';
|
|
22
19
|
export * from './identity-change-handler.js';
|
|
23
20
|
export * from './stanza-ack.js';
|
|
24
|
-
export * from './
|
|
25
|
-
export * from './messages
|
|
26
|
-
export * from './
|
|
27
|
-
export * from './shortcake.js';
|
|
28
|
-
export * from './interactive.js';
|
|
29
|
-
export * from './button-handler.js';
|
|
21
|
+
export * from './companion-reg-client-utils.js';
|
|
22
|
+
export * from './rich-messages.js';
|
|
23
|
+
export * from './sticker-pack.js';
|
|
30
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -19,7 +19,7 @@ export const getUrlInfo = async (text, opts = {
|
|
|
19
19
|
}) => {
|
|
20
20
|
try {
|
|
21
21
|
// retries
|
|
22
|
-
|
|
22
|
+
const retries = 0;
|
|
23
23
|
const maxRetry = 5;
|
|
24
24
|
const { getLinkPreview } = await import('link-preview-js');
|
|
25
25
|
let previewLink = text;
|
|
@@ -38,7 +38,7 @@ export const getUrlInfo = async (text, opts = {
|
|
|
38
38
|
if (forwardedURLObj.hostname === urlObj.hostname ||
|
|
39
39
|
forwardedURLObj.hostname === 'www.' + urlObj.hostname ||
|
|
40
40
|
'www.' + forwardedURLObj.hostname === urlObj.hostname) {
|
|
41
|
-
retries
|
|
41
|
+
retries + 1;
|
|
42
42
|
return true;
|
|
43
43
|
}
|
|
44
44
|
else {
|