@neelegirl/baileys 1.5.3 → 1.5.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/LICENSE +21 -21
- package/README.md +195 -195
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +478 -1153
- package/WAProto/fix-imports.js +29 -0
- package/WAProto/index.d.ts +2645 -51971
- package/WAProto/index.js +48649 -154035
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +62 -78
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +115 -149
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/ciphertext-message.js.map +1 -0
- package/lib/Signal/{WASignalGroup → Group}/group-session-builder.d.ts +11 -13
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group-session-builder.js.map +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
- package/lib/Signal/{WASignalGroup → Group}/group_cipher.js +41 -70
- package/lib/Signal/Group/group_cipher.js.map +1 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.d.ts.map +1 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/index.js.map +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/keyhelper.js.map +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-chain-key.js.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-name.js.map +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-record.js.map +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-key-state.js.map +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
- package/lib/Signal/{WASignalGroup/sender_message_key.js → Group/sender-message-key.js} +26 -39
- package/lib/Signal/Group/sender-message-key.js.map +1 -0
- package/lib/Signal/libsignal.d.ts +5 -8
- package/lib/Signal/libsignal.d.ts.map +1 -0
- package/lib/Signal/libsignal.js +342 -391
- package/lib/Signal/libsignal.js.map +1 -0
- package/lib/Signal/lid-mapping.d.ts +23 -28
- package/lib/Signal/lid-mapping.d.ts.map +1 -0
- package/lib/Signal/lid-mapping.js +171 -184
- package/lib/Signal/lid-mapping.js.map +1 -0
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.d.ts.map +1 -0
- package/lib/Socket/Client/index.js +3 -22
- package/lib/Socket/Client/index.js.map +1 -0
- package/lib/Socket/Client/types.d.ts +15 -15
- package/lib/Socket/Client/types.d.ts.map +1 -0
- package/lib/Socket/Client/types.js +8 -15
- package/lib/Socket/Client/types.js.map +1 -0
- package/lib/Socket/Client/websocket.d.ts +12 -12
- package/lib/Socket/Client/websocket.d.ts.map +1 -0
- package/lib/Socket/Client/websocket.js +24 -36
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +178 -177
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +81 -120
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +93 -92
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +462 -618
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +244 -223
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +431 -433
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/groups.d.ts +118 -110
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +148 -181
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +222 -182
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +12 -18
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/messages-recv.d.ts +165 -166
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +753 -1031
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +161 -157
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +564 -1396
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +3 -2
- package/lib/Socket/mex.d.ts.map +1 -0
- package/lib/Socket/mex.js +42 -47
- package/lib/Socket/mex.js.map +1 -0
- package/lib/Socket/newsletter.d.ts +139 -137
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +181 -295
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +42 -36
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +487 -557
- package/lib/Socket/socket.js.map +1 -0
- package/lib/Types/Auth.d.ts +87 -97
- package/lib/Types/Auth.d.ts.map +1 -0
- package/lib/Types/Auth.js +2 -3
- package/lib/Types/Auth.js.map +1 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.d.ts.map +1 -0
- package/lib/Types/Bussines.js +2 -3
- package/lib/Types/Bussines.js.map +1 -0
- package/lib/Types/Call.d.ts +13 -13
- package/lib/Types/Call.d.ts.map +1 -0
- package/lib/Types/Call.js +2 -3
- package/lib/Types/Call.js.map +1 -0
- package/lib/Types/Chat.d.ts +77 -97
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +8 -9
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Contact.d.ts +10 -9
- package/lib/Types/Contact.d.ts.map +1 -0
- package/lib/Types/Contact.js +2 -3
- package/lib/Types/Contact.js.map +1 -0
- package/lib/Types/Events.d.ts +151 -175
- package/lib/Types/Events.d.ts.map +1 -0
- package/lib/Types/Events.js +2 -3
- package/lib/Types/Events.js.map +1 -0
- package/lib/Types/GroupMetadata.d.ts +49 -48
- package/lib/Types/GroupMetadata.d.ts.map +1 -0
- package/lib/Types/GroupMetadata.js +2 -3
- package/lib/Types/GroupMetadata.js.map +1 -0
- package/lib/Types/Label.d.ts +13 -14
- package/lib/Types/Label.d.ts.map +1 -0
- package/lib/Types/Label.js +24 -30
- package/lib/Types/Label.js.map +1 -0
- package/lib/Types/LabelAssociation.d.ts +15 -20
- package/lib/Types/LabelAssociation.d.ts.map +1 -0
- package/lib/Types/LabelAssociation.js +6 -12
- package/lib/Types/LabelAssociation.js.map +1 -0
- package/lib/Types/Message.d.ts +231 -412
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +11 -19
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Newsletter.d.ts +130 -104
- package/lib/Types/Newsletter.d.ts.map +1 -0
- package/lib/Types/Newsletter.js +31 -40
- package/lib/Types/Newsletter.js.map +1 -0
- package/lib/Types/Product.d.ts +58 -71
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +2 -3
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/Signal.d.ts +60 -82
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +2 -3
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +73 -81
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +3 -3
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +17 -19
- package/lib/Types/State.d.ts.map +1 -0
- package/lib/Types/State.js +13 -14
- package/lib/Types/State.js.map +1 -0
- package/lib/Types/USync.d.ts +8 -8
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +2 -3
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +47 -62
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +26 -50
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +19 -21
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +257 -528
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/baileys-event-stream.d.ts +17 -18
- package/lib/Utils/baileys-event-stream.d.ts.map +1 -0
- package/lib/Utils/baileys-event-stream.js +56 -70
- package/lib/Utils/baileys-event-stream.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/browser-utils.js.map +1 -0
- package/lib/Utils/business.d.ts +23 -29
- package/lib/Utils/business.d.ts.map +1 -0
- package/lib/Utils/business.js +231 -255
- package/lib/Utils/business.js.map +1 -0
- package/lib/Utils/chat-utils.d.ts +70 -82
- package/lib/Utils/chat-utils.d.ts.map +1 -0
- package/lib/Utils/chat-utils.js +763 -809
- package/lib/Utils/chat-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +41 -56
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +142 -189
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/decode-wa-message.d.ts +48 -53
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +279 -323
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +34 -39
- package/lib/Utils/event-buffer.d.ts.map +1 -0
- package/lib/Utils/event-buffer.js +548 -595
- package/lib/Utils/event-buffer.js.map +1 -0
- package/lib/Utils/generics.d.ts +90 -131
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +381 -630
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +19 -23
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +84 -104
- package/lib/Utils/history.js.map +1 -0
- package/lib/Utils/index.d.ts +20 -20
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +19 -40
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +21 -23
- package/lib/Utils/link-preview.d.ts.map +1 -0
- package/lib/Utils/link-preview.js +85 -120
- package/lib/Utils/link-preview.js.map +1 -0
- package/lib/Utils/logger.d.ts +12 -13
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +3 -7
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/lt-hash.d.ts +13 -14
- package/lib/Utils/lt-hash.d.ts.map +1 -0
- package/lib/Utils/lt-hash.js +48 -58
- package/lib/Utils/lt-hash.js.map +1 -0
- package/lib/Utils/make-mutex.d.ts +8 -9
- package/lib/Utils/make-mutex.d.ts.map +1 -0
- package/lib/Utils/make-mutex.js +40 -49
- package/lib/Utils/make-mutex.js.map +1 -0
- package/lib/Utils/message-retry-manager.d.ts +82 -88
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +149 -160
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +114 -135
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +663 -869
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +76 -105
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +820 -1745
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +20 -21
- package/lib/Utils/noise-handler.d.ts.map +1 -0
- package/lib/Utils/noise-handler.js +147 -165
- package/lib/Utils/noise-handler.js.map +1 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-message.d.ts +42 -49
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +413 -427
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/signal.d.ts +34 -42
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +159 -166
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -18
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +121 -238
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +11 -13
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +195 -220
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +28 -30
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +1301 -1316
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +7 -9
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +238 -288
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +216 -265
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/generic-utils.d.ts +15 -28
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +102 -142
- package/lib/WABinary/generic-utils.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -5
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +6 -25
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +48 -58
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +96 -104
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +19 -22
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +2 -3
- package/lib/WABinary/types.js.map +1 -0
- package/lib/WAM/BinaryInfo.d.ts +9 -16
- package/lib/WAM/BinaryInfo.d.ts.map +1 -0
- package/lib/WAM/BinaryInfo.js +10 -17
- package/lib/WAM/BinaryInfo.js.map +1 -0
- package/lib/WAM/constants.d.ts +40 -47
- package/lib/WAM/constants.d.ts.map +1 -0
- package/lib/WAM/constants.js +22853 -15371
- package/lib/WAM/constants.js.map +1 -0
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.d.ts.map +1 -0
- package/lib/WAM/encode.js +150 -164
- package/lib/WAM/encode.js.map +1 -0
- package/lib/WAM/index.d.ts +4 -3
- package/lib/WAM/index.d.ts.map +1 -0
- package/lib/WAM/index.js +4 -23
- package/lib/WAM/index.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +12 -19
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +19 -22
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +18 -26
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +11 -12
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -20
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +11 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +16 -24
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -6
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +5 -26
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -28
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +64 -62
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +11 -10
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +12 -19
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -3
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +4 -23
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +12 -13
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -33
- package/lib/index.js.map +1 -0
- package/package.json +99 -96
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/WASignalGroup/GroupProtocol.js +0 -1909
- package/lib/Signal/WASignalGroup/ciphertext-message.d.ts +0 -9
- package/lib/Signal/WASignalGroup/ciphertext-message.js +0 -19
- package/lib/Signal/WASignalGroup/ciphertext_message.js +0 -16
- package/lib/Signal/WASignalGroup/generate-proto.sh +0 -1
- package/lib/Signal/WASignalGroup/group-session-builder.js +0 -72
- package/lib/Signal/WASignalGroup/group.proto +0 -42
- package/lib/Signal/WASignalGroup/group_cipher.d.ts +0 -19
- package/lib/Signal/WASignalGroup/group_session_builder.js +0 -46
- package/lib/Signal/WASignalGroup/index.d.ts +0 -11
- package/lib/Signal/WASignalGroup/index.js +0 -61
- package/lib/Signal/WASignalGroup/keyhelper.d.ts +0 -16
- package/lib/Signal/WASignalGroup/keyhelper.js +0 -66
- package/lib/Signal/WASignalGroup/protobufs.js +0 -3
- package/lib/Signal/WASignalGroup/queue_job.js +0 -69
- package/lib/Signal/WASignalGroup/readme.md +0 -6
- package/lib/Signal/WASignalGroup/sender-chain-key.d.ts +0 -14
- package/lib/Signal/WASignalGroup/sender-chain-key.js +0 -47
- package/lib/Signal/WASignalGroup/sender-key-distribution-message.d.ts +0 -17
- package/lib/Signal/WASignalGroup/sender-key-distribution-message.js +0 -71
- package/lib/Signal/WASignalGroup/sender-key-message.d.ts +0 -19
- package/lib/Signal/WASignalGroup/sender-key-message.js +0 -73
- package/lib/Signal/WASignalGroup/sender-key-name.d.ts +0 -19
- package/lib/Signal/WASignalGroup/sender-key-name.js +0 -59
- package/lib/Signal/WASignalGroup/sender-key-record.d.ts +0 -32
- package/lib/Signal/WASignalGroup/sender-key-record.js +0 -58
- package/lib/Signal/WASignalGroup/sender-key-state.d.ts +0 -44
- package/lib/Signal/WASignalGroup/sender-key-state.js +0 -147
- package/lib/Signal/WASignalGroup/sender-message-key.d.ts +0 -11
- package/lib/Signal/WASignalGroup/sender-message-key.js +0 -33
- package/lib/Signal/WASignalGroup/sender_chain_key.js +0 -50
- package/lib/Signal/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/lib/Signal/WASignalGroup/sender_key_message.js +0 -92
- package/lib/Signal/WASignalGroup/sender_key_name.js +0 -70
- package/lib/Signal/WASignalGroup/sender_key_record.js +0 -56
- package/lib/Signal/WASignalGroup/sender_key_state.js +0 -129
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -15
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Socket/usync.js +0 -83
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/index.js +0 -24
- package/lib/Store/make-cache-manager-store.d.ts +0 -14
- package/lib/Store/make-cache-manager-store.js +0 -90
- package/lib/Store/make-in-memory-store.d.ts +0 -123
- package/lib/Store/make-in-memory-store.js +0 -429
- package/lib/Store/make-ordered-dictionary.d.ts +0 -12
- package/lib/Store/make-ordered-dictionary.js +0 -86
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Store/object-repository.js +0 -31
- package/lib/Types/Bussiness.d.ts +0 -28
- package/lib/Types/MexUpdates.d.ts +0 -9
- package/lib/Types/MexUpdates.js +0 -18
- package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-mongo-file-auth-state.js +0 -84
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.js +0 -80
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -69
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -38
package/lib/Socket/chats.js
CHANGED
|
@@ -1,80 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const makeChatsSocket = (config) => {
|
|
22
|
-
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage, } = config
|
|
23
|
-
const baron = socket_1.makeSocket(config)
|
|
24
|
-
const { ev, ws, authState, generateMessageTag, sendNode, query, signalRepository, onUnexpectedError, groupFetchAllParticipating } = baron
|
|
25
|
-
|
|
26
|
-
let privacySettings
|
|
27
|
-
let syncState = Types_1.SyncState.Connecting
|
|
28
|
-
|
|
1
|
+
import NodeCache from '@cacheable/node-cache';
|
|
2
|
+
import { Boom } from '@hapi/boom';
|
|
3
|
+
import { proto } from '../../WAProto/index.js';
|
|
4
|
+
import { DEFAULT_CACHE_TTLS, PROCESSABLE_HISTORY_TYPES } from '../Defaults/index.js';
|
|
5
|
+
import { ALL_WA_PATCH_NAMES } from '../Types/index.js';
|
|
6
|
+
import { SyncState } from '../Types/State.js';
|
|
7
|
+
import { chatModificationToAppPatch, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, extractSyncdPatches, generateProfilePicture, getHistoryMsg, newLTHashState, processSyncAction } from '../Utils/index.js';
|
|
8
|
+
import { makeMutex } from '../Utils/make-mutex.js';
|
|
9
|
+
import processMessage from '../Utils/process-message.js';
|
|
10
|
+
import { getBinaryNodeChild, getBinaryNodeChildren, jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
11
|
+
import { USyncQuery, USyncUser } from '../WAUSync/index.js';
|
|
12
|
+
import { makeSocket } from './socket.js';
|
|
13
|
+
const MAX_SYNC_ATTEMPTS = 2;
|
|
14
|
+
export const makeChatsSocket = (config) => {
|
|
15
|
+
const { logger, markOnlineOnConnect, fireInitQueries, appStateMacVerification, shouldIgnoreJid, shouldSyncHistoryMessage } = config;
|
|
16
|
+
const sock = makeSocket(config);
|
|
17
|
+
const { ev, ws, authState, generateMessageTag, sendNode, query, signalRepository, onUnexpectedError } = sock;
|
|
18
|
+
let privacySettings;
|
|
19
|
+
let syncState = SyncState.Connecting;
|
|
29
20
|
/** this mutex ensures that the notifications (receipts, messages etc.) are processed in order */
|
|
30
|
-
const processingMutex =
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})
|
|
39
|
-
|
|
21
|
+
const processingMutex = makeMutex();
|
|
22
|
+
// Timeout for AwaitingInitialSync state
|
|
23
|
+
let awaitingSyncTimeout;
|
|
24
|
+
const placeholderResendCache = config.placeholderResendCache ||
|
|
25
|
+
new NodeCache({
|
|
26
|
+
stdTTL: DEFAULT_CACHE_TTLS.MSG_RETRY, // 1 hour
|
|
27
|
+
useClones: false
|
|
28
|
+
});
|
|
40
29
|
if (!config.placeholderResendCache) {
|
|
41
|
-
config.placeholderResendCache = placeholderResendCache
|
|
30
|
+
config.placeholderResendCache = placeholderResendCache;
|
|
42
31
|
}
|
|
43
|
-
|
|
44
32
|
/** helper function to fetch the given app state sync key */
|
|
45
33
|
const getAppStateSyncKey = async (keyId) => {
|
|
46
|
-
const { [keyId]: key } = await authState.keys.get('app-state-sync-key', [keyId])
|
|
47
|
-
return key
|
|
48
|
-
}
|
|
49
|
-
|
|
34
|
+
const { [keyId]: key } = await authState.keys.get('app-state-sync-key', [keyId]);
|
|
35
|
+
return key;
|
|
36
|
+
};
|
|
50
37
|
const fetchPrivacySettings = async (force = false) => {
|
|
51
38
|
if (!privacySettings || force) {
|
|
52
39
|
const { content } = await query({
|
|
53
40
|
tag: 'iq',
|
|
54
41
|
attrs: {
|
|
55
42
|
xmlns: 'privacy',
|
|
56
|
-
to:
|
|
43
|
+
to: S_WHATSAPP_NET,
|
|
57
44
|
type: 'get'
|
|
58
45
|
},
|
|
59
|
-
content: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
})
|
|
63
|
-
privacySettings = WABinary_1.reduceBinaryNodeToDictionary(content?.[0], 'category')
|
|
46
|
+
content: [{ tag: 'privacy', attrs: {} }]
|
|
47
|
+
});
|
|
48
|
+
privacySettings = reduceBinaryNodeToDictionary(content?.[0], 'category');
|
|
64
49
|
}
|
|
65
|
-
return privacySettings
|
|
66
|
-
}
|
|
67
|
-
|
|
50
|
+
return privacySettings;
|
|
51
|
+
};
|
|
68
52
|
/** helper function to run a privacy IQ query */
|
|
69
53
|
const privacyQuery = async (name, value) => {
|
|
70
54
|
await query({
|
|
71
55
|
tag: 'iq',
|
|
72
56
|
attrs: {
|
|
73
57
|
xmlns: 'privacy',
|
|
74
|
-
to:
|
|
58
|
+
to: S_WHATSAPP_NET,
|
|
75
59
|
type: 'set'
|
|
76
60
|
},
|
|
77
|
-
content: [
|
|
61
|
+
content: [
|
|
62
|
+
{
|
|
78
63
|
tag: 'privacy',
|
|
79
64
|
attrs: {},
|
|
80
65
|
content: [
|
|
@@ -83,172 +68,123 @@ const makeChatsSocket = (config) => {
|
|
|
83
68
|
attrs: { name, value }
|
|
84
69
|
}
|
|
85
70
|
]
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
};
|
|
90
75
|
const updateMessagesPrivacy = async (value) => {
|
|
91
|
-
await privacyQuery('messages', value)
|
|
92
|
-
}
|
|
93
|
-
|
|
76
|
+
await privacyQuery('messages', value);
|
|
77
|
+
};
|
|
94
78
|
const updateCallPrivacy = async (value) => {
|
|
95
|
-
await privacyQuery('calladd', value)
|
|
96
|
-
}
|
|
97
|
-
|
|
79
|
+
await privacyQuery('calladd', value);
|
|
80
|
+
};
|
|
98
81
|
const updateLastSeenPrivacy = async (value) => {
|
|
99
|
-
await privacyQuery('last', value)
|
|
100
|
-
}
|
|
101
|
-
|
|
82
|
+
await privacyQuery('last', value);
|
|
83
|
+
};
|
|
102
84
|
const updateOnlinePrivacy = async (value) => {
|
|
103
|
-
await privacyQuery('online', value)
|
|
104
|
-
}
|
|
105
|
-
|
|
85
|
+
await privacyQuery('online', value);
|
|
86
|
+
};
|
|
106
87
|
const updateProfilePicturePrivacy = async (value) => {
|
|
107
|
-
await privacyQuery('profile', value)
|
|
108
|
-
}
|
|
109
|
-
|
|
88
|
+
await privacyQuery('profile', value);
|
|
89
|
+
};
|
|
110
90
|
const updateStatusPrivacy = async (value) => {
|
|
111
|
-
await privacyQuery('status', value)
|
|
112
|
-
}
|
|
113
|
-
|
|
91
|
+
await privacyQuery('status', value);
|
|
92
|
+
};
|
|
114
93
|
const updateReadReceiptsPrivacy = async (value) => {
|
|
115
|
-
await privacyQuery('readreceipts', value)
|
|
116
|
-
}
|
|
117
|
-
|
|
94
|
+
await privacyQuery('readreceipts', value);
|
|
95
|
+
};
|
|
118
96
|
const updateGroupsAddPrivacy = async (value) => {
|
|
119
|
-
await privacyQuery('groupadd', value)
|
|
120
|
-
}
|
|
121
|
-
|
|
97
|
+
await privacyQuery('groupadd', value);
|
|
98
|
+
};
|
|
122
99
|
const updateDefaultDisappearingMode = async (duration) => {
|
|
123
100
|
await query({
|
|
124
101
|
tag: 'iq',
|
|
125
102
|
attrs: {
|
|
126
103
|
xmlns: 'disappearing_mode',
|
|
127
|
-
to:
|
|
104
|
+
to: S_WHATSAPP_NET,
|
|
128
105
|
type: 'set'
|
|
129
106
|
},
|
|
130
|
-
content: [
|
|
107
|
+
content: [
|
|
108
|
+
{
|
|
131
109
|
tag: 'disappearing_mode',
|
|
132
110
|
attrs: {
|
|
133
111
|
duration: duration.toString()
|
|
134
112
|
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
});
|
|
116
|
+
};
|
|
139
117
|
const getBotListV2 = async () => {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
return botList
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
const getLidUser = async (jid) => {
|
|
173
|
-
if (!jid) {
|
|
174
|
-
throw new boom_1.Boom('Please input a jid user')
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
if (!WABinary_1.isJidUser(jid)) {
|
|
178
|
-
throw new boom_1.Boom('Invalid JID: Not a user JID!')
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
const targetJid = WABinary_1.jidNormalizedUser(jid)
|
|
182
|
-
|
|
183
|
-
const usyncQuery = new WAUSync_1.USyncQuery()
|
|
184
|
-
usyncQuery.protocols.push({
|
|
185
|
-
name: 'lid',
|
|
186
|
-
getQueryElement: () => ({
|
|
187
|
-
tag: 'lid',
|
|
188
|
-
attrs: {},
|
|
189
|
-
content: undefined
|
|
190
|
-
}),
|
|
191
|
-
getUserElement: () => null,
|
|
192
|
-
parser: (node) => node.attrs.val
|
|
193
|
-
})
|
|
194
|
-
usyncQuery.users.push({
|
|
195
|
-
id: targetJid
|
|
196
|
-
})
|
|
197
|
-
|
|
198
|
-
const result = await baron.executeUSyncQuery(usyncQuery)
|
|
199
|
-
|
|
200
|
-
if (result) {
|
|
201
|
-
return result.list
|
|
118
|
+
const resp = await query({
|
|
119
|
+
tag: 'iq',
|
|
120
|
+
attrs: {
|
|
121
|
+
xmlns: 'bot',
|
|
122
|
+
to: S_WHATSAPP_NET,
|
|
123
|
+
type: 'get'
|
|
124
|
+
},
|
|
125
|
+
content: [
|
|
126
|
+
{
|
|
127
|
+
tag: 'bot',
|
|
128
|
+
attrs: {
|
|
129
|
+
v: '2'
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
const botNode = getBinaryNodeChild(resp, 'bot');
|
|
135
|
+
const botList = [];
|
|
136
|
+
for (const section of getBinaryNodeChildren(botNode, 'section')) {
|
|
137
|
+
if (section.attrs.type === 'all') {
|
|
138
|
+
for (const bot of getBinaryNodeChildren(section, 'bot')) {
|
|
139
|
+
botList.push({
|
|
140
|
+
jid: bot.attrs.jid,
|
|
141
|
+
personaId: bot.attrs['persona_id']
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
}
|
|
202
145
|
}
|
|
203
|
-
|
|
204
|
-
|
|
146
|
+
return botList;
|
|
147
|
+
};
|
|
205
148
|
const fetchStatus = async (...jids) => {
|
|
206
|
-
const usyncQuery = new
|
|
207
|
-
|
|
149
|
+
const usyncQuery = new USyncQuery().withStatusProtocol();
|
|
208
150
|
for (const jid of jids) {
|
|
209
|
-
usyncQuery.withUser(new
|
|
151
|
+
usyncQuery.withUser(new USyncUser().withId(jid));
|
|
210
152
|
}
|
|
211
|
-
|
|
212
|
-
const result = await baron.executeUSyncQuery(usyncQuery)
|
|
213
|
-
|
|
153
|
+
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
214
154
|
if (result) {
|
|
215
|
-
return result.list
|
|
155
|
+
return result.list;
|
|
216
156
|
}
|
|
217
|
-
}
|
|
218
|
-
const fetchDisappearingDuration = async (...jids) => {
|
|
219
|
-
const usyncQuery = new
|
|
220
|
-
|
|
157
|
+
};
|
|
158
|
+
const fetchDisappearingDuration = async (...jids) => {
|
|
159
|
+
const usyncQuery = new USyncQuery().withDisappearingModeProtocol();
|
|
221
160
|
for (const jid of jids) {
|
|
222
|
-
usyncQuery.withUser(new
|
|
161
|
+
usyncQuery.withUser(new USyncUser().withId(jid));
|
|
223
162
|
}
|
|
224
|
-
|
|
225
|
-
const result = await baron.executeUSyncQuery(usyncQuery)
|
|
163
|
+
const result = await sock.executeUSyncQuery(usyncQuery);
|
|
226
164
|
if (result) {
|
|
227
|
-
return result.list
|
|
165
|
+
return result.list;
|
|
228
166
|
}
|
|
229
|
-
}
|
|
230
|
-
|
|
167
|
+
};
|
|
231
168
|
/** update the profile picture for yourself or a group */
|
|
232
|
-
const updateProfilePicture = async (jid, content) => {
|
|
233
|
-
let targetJid
|
|
234
|
-
|
|
169
|
+
const updateProfilePicture = async (jid, content, dimensions) => {
|
|
170
|
+
let targetJid;
|
|
235
171
|
if (!jid) {
|
|
236
|
-
throw new
|
|
172
|
+
throw new Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
173
|
+
}
|
|
174
|
+
if (jidNormalizedUser(jid) !== jidNormalizedUser(authState.creds.me.id)) {
|
|
175
|
+
targetJid = jidNormalizedUser(jid); // in case it is someone other than us
|
|
237
176
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
targetJid = WABinary_1.jidNormalizedUser(jid) // in case it is someone other than us
|
|
177
|
+
else {
|
|
178
|
+
targetJid = undefined;
|
|
241
179
|
}
|
|
242
|
-
|
|
243
|
-
const { img } = await Utils_1.generateProfilePicture(content)
|
|
244
|
-
|
|
180
|
+
const { img } = await generateProfilePicture(content, dimensions);
|
|
245
181
|
await query({
|
|
246
182
|
tag: 'iq',
|
|
247
183
|
attrs: {
|
|
248
|
-
|
|
249
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
184
|
+
to: S_WHATSAPP_NET,
|
|
250
185
|
type: 'set',
|
|
251
|
-
xmlns: 'w:profile:picture'
|
|
186
|
+
xmlns: 'w:profile:picture',
|
|
187
|
+
...(targetJid ? { target: targetJid } : {})
|
|
252
188
|
},
|
|
253
189
|
content: [
|
|
254
190
|
{
|
|
@@ -257,38 +193,36 @@ const makeChatsSocket = (config) => {
|
|
|
257
193
|
content: img
|
|
258
194
|
}
|
|
259
195
|
]
|
|
260
|
-
})
|
|
261
|
-
}
|
|
262
|
-
|
|
196
|
+
});
|
|
197
|
+
};
|
|
263
198
|
/** remove the profile picture for yourself or a group */
|
|
264
199
|
const removeProfilePicture = async (jid) => {
|
|
265
|
-
let targetJid
|
|
266
|
-
|
|
200
|
+
let targetJid;
|
|
267
201
|
if (!jid) {
|
|
268
|
-
throw new
|
|
202
|
+
throw new Boom('Illegal no-jid profile update. Please specify either your ID or the ID of the chat you wish to update');
|
|
269
203
|
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
204
|
+
if (jidNormalizedUser(jid) !== jidNormalizedUser(authState.creds.me.id)) {
|
|
205
|
+
targetJid = jidNormalizedUser(jid); // in case it is someone other than us
|
|
206
|
+
}
|
|
207
|
+
else {
|
|
208
|
+
targetJid = undefined;
|
|
273
209
|
}
|
|
274
|
-
|
|
275
210
|
await query({
|
|
276
211
|
tag: 'iq',
|
|
277
212
|
attrs: {
|
|
278
|
-
|
|
279
|
-
to: WABinary_1.S_WHATSAPP_NET,
|
|
213
|
+
to: S_WHATSAPP_NET,
|
|
280
214
|
type: 'set',
|
|
281
|
-
xmlns: 'w:profile:picture'
|
|
215
|
+
xmlns: 'w:profile:picture',
|
|
216
|
+
...(targetJid ? { target: targetJid } : {})
|
|
282
217
|
}
|
|
283
|
-
})
|
|
284
|
-
}
|
|
285
|
-
|
|
218
|
+
});
|
|
219
|
+
};
|
|
286
220
|
/** update the profile status for yourself */
|
|
287
221
|
const updateProfileStatus = async (status) => {
|
|
288
222
|
await query({
|
|
289
223
|
tag: 'iq',
|
|
290
224
|
attrs: {
|
|
291
|
-
to:
|
|
225
|
+
to: S_WHATSAPP_NET,
|
|
292
226
|
type: 'set',
|
|
293
227
|
xmlns: 'status'
|
|
294
228
|
},
|
|
@@ -299,34 +233,29 @@ const makeChatsSocket = (config) => {
|
|
|
299
233
|
content: Buffer.from(status, 'utf-8')
|
|
300
234
|
}
|
|
301
235
|
]
|
|
302
|
-
})
|
|
303
|
-
}
|
|
304
|
-
|
|
236
|
+
});
|
|
237
|
+
};
|
|
305
238
|
const updateProfileName = async (name) => {
|
|
306
|
-
await chatModify({ pushNameSetting: name }, '')
|
|
307
|
-
}
|
|
308
|
-
|
|
239
|
+
await chatModify({ pushNameSetting: name }, '');
|
|
240
|
+
};
|
|
309
241
|
const fetchBlocklist = async () => {
|
|
310
242
|
const result = await query({
|
|
311
243
|
tag: 'iq',
|
|
312
244
|
attrs: {
|
|
313
245
|
xmlns: 'blocklist',
|
|
314
|
-
to:
|
|
246
|
+
to: S_WHATSAPP_NET,
|
|
315
247
|
type: 'get'
|
|
316
248
|
}
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
return WABinary_1.getBinaryNodeChildren(listNode, 'item').map((n) => n.attrs.jid)
|
|
322
|
-
}
|
|
323
|
-
|
|
249
|
+
});
|
|
250
|
+
const listNode = getBinaryNodeChild(result, 'list');
|
|
251
|
+
return getBinaryNodeChildren(listNode, 'item').map(n => n.attrs.jid);
|
|
252
|
+
};
|
|
324
253
|
const updateBlockStatus = async (jid, action) => {
|
|
325
254
|
await query({
|
|
326
255
|
tag: 'iq',
|
|
327
256
|
attrs: {
|
|
328
257
|
xmlns: 'blocklist',
|
|
329
|
-
to:
|
|
258
|
+
to: S_WHATSAPP_NET,
|
|
330
259
|
type: 'set'
|
|
331
260
|
},
|
|
332
261
|
content: [
|
|
@@ -338,9 +267,8 @@ const makeChatsSocket = (config) => {
|
|
|
338
267
|
}
|
|
339
268
|
}
|
|
340
269
|
]
|
|
341
|
-
})
|
|
342
|
-
}
|
|
343
|
-
|
|
270
|
+
});
|
|
271
|
+
};
|
|
344
272
|
const getBusinessProfile = async (jid) => {
|
|
345
273
|
const results = await query({
|
|
346
274
|
tag: 'iq',
|
|
@@ -349,121 +277,116 @@ const makeChatsSocket = (config) => {
|
|
|
349
277
|
xmlns: 'w:biz',
|
|
350
278
|
type: 'get'
|
|
351
279
|
},
|
|
352
|
-
content: [
|
|
280
|
+
content: [
|
|
281
|
+
{
|
|
353
282
|
tag: 'business_profile',
|
|
354
283
|
attrs: { v: '244' },
|
|
355
|
-
content: [
|
|
284
|
+
content: [
|
|
285
|
+
{
|
|
356
286
|
tag: 'profile',
|
|
357
287
|
attrs: { jid }
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
const profiles =
|
|
365
|
-
|
|
288
|
+
}
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
});
|
|
293
|
+
const profileNode = getBinaryNodeChild(results, 'business_profile');
|
|
294
|
+
const profiles = getBinaryNodeChild(profileNode, 'profile');
|
|
366
295
|
if (profiles) {
|
|
367
|
-
const address =
|
|
368
|
-
const description =
|
|
369
|
-
const website =
|
|
370
|
-
const email =
|
|
371
|
-
const category =
|
|
372
|
-
const businessHours =
|
|
296
|
+
const address = getBinaryNodeChild(profiles, 'address');
|
|
297
|
+
const description = getBinaryNodeChild(profiles, 'description');
|
|
298
|
+
const website = getBinaryNodeChild(profiles, 'website');
|
|
299
|
+
const email = getBinaryNodeChild(profiles, 'email');
|
|
300
|
+
const category = getBinaryNodeChild(getBinaryNodeChild(profiles, 'categories'), 'category');
|
|
301
|
+
const businessHours = getBinaryNodeChild(profiles, 'business_hours');
|
|
373
302
|
const businessHoursConfig = businessHours
|
|
374
|
-
?
|
|
375
|
-
: undefined
|
|
376
|
-
const websiteStr = website?.content?.toString()
|
|
377
|
-
|
|
303
|
+
? getBinaryNodeChildren(businessHours, 'business_hours_config')
|
|
304
|
+
: undefined;
|
|
305
|
+
const websiteStr = website?.content?.toString();
|
|
378
306
|
return {
|
|
379
|
-
wid: profiles
|
|
307
|
+
wid: profiles.attrs?.jid,
|
|
380
308
|
address: address?.content?.toString(),
|
|
381
309
|
description: description?.content?.toString() || '',
|
|
382
310
|
website: websiteStr ? [websiteStr] : [],
|
|
383
311
|
email: email?.content?.toString(),
|
|
384
312
|
category: category?.content?.toString(),
|
|
385
|
-
|
|
313
|
+
business_hours: {
|
|
386
314
|
timezone: businessHours?.attrs?.timezone,
|
|
387
|
-
|
|
315
|
+
business_config: businessHoursConfig?.map(({ attrs }) => attrs)
|
|
388
316
|
}
|
|
389
|
-
}
|
|
317
|
+
};
|
|
390
318
|
}
|
|
391
|
-
}
|
|
392
|
-
|
|
319
|
+
};
|
|
393
320
|
const cleanDirtyBits = async (type, fromTimestamp) => {
|
|
394
|
-
logger.info({ fromTimestamp }, 'clean dirty bits ' + type)
|
|
321
|
+
logger.info({ fromTimestamp }, 'clean dirty bits ' + type);
|
|
395
322
|
await sendNode({
|
|
396
323
|
tag: 'iq',
|
|
397
324
|
attrs: {
|
|
398
|
-
to:
|
|
325
|
+
to: S_WHATSAPP_NET,
|
|
399
326
|
type: 'set',
|
|
400
327
|
xmlns: 'urn:xmpp:whatsapp:dirty',
|
|
401
|
-
id: generateMessageTag()
|
|
328
|
+
id: generateMessageTag()
|
|
402
329
|
},
|
|
403
330
|
content: [
|
|
404
331
|
{
|
|
405
332
|
tag: 'clean',
|
|
406
333
|
attrs: {
|
|
407
334
|
type,
|
|
408
|
-
...(fromTimestamp ? { timestamp: fromTimestamp.toString() } : null)
|
|
335
|
+
...(fromTimestamp ? { timestamp: fromTimestamp.toString() } : null)
|
|
409
336
|
}
|
|
410
337
|
}
|
|
411
338
|
]
|
|
412
|
-
})
|
|
413
|
-
}
|
|
414
|
-
|
|
339
|
+
});
|
|
340
|
+
};
|
|
415
341
|
const newAppStateChunkHandler = (isInitialSync) => {
|
|
416
342
|
return {
|
|
417
343
|
onMutation(mutation) {
|
|
418
|
-
|
|
344
|
+
processSyncAction(mutation, ev, authState.creds.me, isInitialSync ? { accountSettings: authState.creds.accountSettings } : undefined, logger);
|
|
419
345
|
}
|
|
420
|
-
}
|
|
421
|
-
}
|
|
422
|
-
|
|
346
|
+
};
|
|
347
|
+
};
|
|
423
348
|
const resyncAppState = ev.createBufferedFunction(async (collections, isInitialSync) => {
|
|
424
349
|
// we use this to determine which events to fire
|
|
425
350
|
// otherwise when we resync from scratch -- all notifications will fire
|
|
426
|
-
const initialVersionMap = {}
|
|
427
|
-
const globalMutationMap = {}
|
|
351
|
+
const initialVersionMap = {};
|
|
352
|
+
const globalMutationMap = {};
|
|
428
353
|
await authState.keys.transaction(async () => {
|
|
429
|
-
const collectionsToHandle = new Set(collections)
|
|
354
|
+
const collectionsToHandle = new Set(collections);
|
|
430
355
|
// in case something goes wrong -- ensure we don't enter a loop that cannot be exited from
|
|
431
|
-
const attemptsMap = {}
|
|
356
|
+
const attemptsMap = {};
|
|
432
357
|
// keep executing till all collections are done
|
|
433
358
|
// sometimes a single patch request will not return all the patches (God knows why)
|
|
434
359
|
// so we fetch till they're all done (this is determined by the "has_more_patches" flag)
|
|
435
360
|
while (collectionsToHandle.size) {
|
|
436
|
-
const states = {}
|
|
437
|
-
const nodes = []
|
|
438
|
-
|
|
361
|
+
const states = {};
|
|
362
|
+
const nodes = [];
|
|
439
363
|
for (const name of collectionsToHandle) {
|
|
440
|
-
const result = await authState.keys.get('app-state-sync-version', [name])
|
|
441
|
-
let state = result[name]
|
|
364
|
+
const result = await authState.keys.get('app-state-sync-version', [name]);
|
|
365
|
+
let state = result[name];
|
|
442
366
|
if (state) {
|
|
443
367
|
if (typeof initialVersionMap[name] === 'undefined') {
|
|
444
|
-
initialVersionMap[name] = state.version
|
|
368
|
+
initialVersionMap[name] = state.version;
|
|
445
369
|
}
|
|
446
370
|
}
|
|
447
371
|
else {
|
|
448
|
-
state =
|
|
372
|
+
state = newLTHashState();
|
|
449
373
|
}
|
|
450
|
-
states[name] = state
|
|
451
|
-
logger.info(`resyncing ${name} from v${state.version}`)
|
|
374
|
+
states[name] = state;
|
|
375
|
+
logger.info(`resyncing ${name} from v${state.version}`);
|
|
452
376
|
nodes.push({
|
|
453
377
|
tag: 'collection',
|
|
454
378
|
attrs: {
|
|
455
379
|
name,
|
|
456
380
|
version: state.version.toString(),
|
|
457
381
|
// return snapshot if being synced from scratch
|
|
458
|
-
|
|
382
|
+
return_snapshot: (!state.version).toString()
|
|
459
383
|
}
|
|
460
|
-
})
|
|
384
|
+
});
|
|
461
385
|
}
|
|
462
|
-
|
|
463
386
|
const result = await query({
|
|
464
387
|
tag: 'iq',
|
|
465
388
|
attrs: {
|
|
466
|
-
to:
|
|
389
|
+
to: S_WHATSAPP_NET,
|
|
467
390
|
xmlns: 'w:sync:app:state',
|
|
468
391
|
type: 'set'
|
|
469
392
|
},
|
|
@@ -474,125 +397,121 @@ const makeChatsSocket = (config) => {
|
|
|
474
397
|
content: nodes
|
|
475
398
|
}
|
|
476
399
|
]
|
|
477
|
-
})
|
|
478
|
-
|
|
400
|
+
});
|
|
479
401
|
// extract from binary node
|
|
480
|
-
const decoded = await
|
|
481
|
-
|
|
402
|
+
const decoded = await extractSyncdPatches(result, config?.options);
|
|
482
403
|
for (const key in decoded) {
|
|
483
|
-
const name = key
|
|
484
|
-
const { patches, hasMorePatches, snapshot } = decoded[name]
|
|
404
|
+
const name = key;
|
|
405
|
+
const { patches, hasMorePatches, snapshot } = decoded[name];
|
|
485
406
|
try {
|
|
486
407
|
if (snapshot) {
|
|
487
|
-
const { state: newState, mutationMap } = await
|
|
488
|
-
states[name] = newState
|
|
489
|
-
Object.assign(globalMutationMap, mutationMap)
|
|
490
|
-
logger.info(`restored state of ${name} from snapshot to v${newState.version} with mutations`)
|
|
491
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } })
|
|
408
|
+
const { state: newState, mutationMap } = await decodeSyncdSnapshot(name, snapshot, getAppStateSyncKey, initialVersionMap[name], appStateMacVerification.snapshot);
|
|
409
|
+
states[name] = newState;
|
|
410
|
+
Object.assign(globalMutationMap, mutationMap);
|
|
411
|
+
logger.info(`restored state of ${name} from snapshot to v${newState.version} with mutations`);
|
|
412
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } });
|
|
492
413
|
}
|
|
493
|
-
|
|
494
414
|
// only process if there are syncd patches
|
|
495
415
|
if (patches.length) {
|
|
496
|
-
const { state: newState, mutationMap } = await
|
|
497
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } })
|
|
498
|
-
logger.info(`synced ${name} to v${newState.version}`)
|
|
499
|
-
initialVersionMap[name] = newState.version
|
|
500
|
-
Object.assign(globalMutationMap, mutationMap)
|
|
416
|
+
const { state: newState, mutationMap } = await decodePatches(name, patches, states[name], getAppStateSyncKey, config.options, initialVersionMap[name], logger, appStateMacVerification.patch);
|
|
417
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: newState } });
|
|
418
|
+
logger.info(`synced ${name} to v${newState.version}`);
|
|
419
|
+
initialVersionMap[name] = newState.version;
|
|
420
|
+
Object.assign(globalMutationMap, mutationMap);
|
|
501
421
|
}
|
|
502
|
-
|
|
503
422
|
if (hasMorePatches) {
|
|
504
|
-
logger.info(`${name} has more patches...`)
|
|
505
|
-
}
|
|
506
|
-
else { // collection is done with sync
|
|
507
|
-
collectionsToHandle.delete(name)
|
|
423
|
+
logger.info(`${name} has more patches...`);
|
|
508
424
|
}
|
|
509
|
-
|
|
425
|
+
else {
|
|
426
|
+
// collection is done with sync
|
|
427
|
+
collectionsToHandle.delete(name);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
510
430
|
catch (error) {
|
|
511
431
|
// if retry attempts overshoot
|
|
512
432
|
// or key not found
|
|
513
|
-
const isIrrecoverableError = attemptsMap[name] >= MAX_SYNC_ATTEMPTS
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`)
|
|
517
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: null } })
|
|
433
|
+
const isIrrecoverableError = attemptsMap[name] >= MAX_SYNC_ATTEMPTS ||
|
|
434
|
+
error.output?.statusCode === 404 ||
|
|
435
|
+
error.name === 'TypeError';
|
|
436
|
+
logger.info({ name, error: error.stack }, `failed to sync state from version${isIrrecoverableError ? '' : ', removing and trying from scratch'}`);
|
|
437
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: null } });
|
|
518
438
|
// increment number of retries
|
|
519
|
-
attemptsMap[name] = (attemptsMap[name] || 0) + 1
|
|
520
|
-
|
|
439
|
+
attemptsMap[name] = (attemptsMap[name] || 0) + 1;
|
|
521
440
|
if (isIrrecoverableError) {
|
|
522
441
|
// stop retrying
|
|
523
|
-
collectionsToHandle.delete(name)
|
|
442
|
+
collectionsToHandle.delete(name);
|
|
524
443
|
}
|
|
525
444
|
}
|
|
526
445
|
}
|
|
527
446
|
}
|
|
528
|
-
}, authState?.creds?.me?.id || 'resync-app-state')
|
|
529
|
-
|
|
530
|
-
const { onMutation } = newAppStateChunkHandler(isInitialSync)
|
|
531
|
-
|
|
447
|
+
}, authState?.creds?.me?.id || 'resync-app-state');
|
|
448
|
+
const { onMutation } = newAppStateChunkHandler(isInitialSync);
|
|
532
449
|
for (const key in globalMutationMap) {
|
|
533
|
-
onMutation(globalMutationMap[key])
|
|
450
|
+
onMutation(globalMutationMap[key]);
|
|
534
451
|
}
|
|
535
|
-
})
|
|
536
|
-
|
|
537
|
-
|
|
452
|
+
});
|
|
453
|
+
/**
|
|
454
|
+
* fetch the profile picture of a user/group
|
|
455
|
+
* type = "preview" for a low res picture
|
|
456
|
+
* type = "image for the high res picture"
|
|
457
|
+
*/
|
|
458
|
+
const profilePictureUrl = async (jid, type = 'preview', timeoutMs) => {
|
|
459
|
+
// TOOD: Add support for tctoken, existingID, and newsletter + group options
|
|
460
|
+
jid = jidNormalizedUser(jid);
|
|
461
|
+
const result = await query({
|
|
462
|
+
tag: 'iq',
|
|
463
|
+
attrs: {
|
|
464
|
+
target: jid,
|
|
465
|
+
to: S_WHATSAPP_NET,
|
|
466
|
+
type: 'get',
|
|
467
|
+
xmlns: 'w:profile:picture'
|
|
468
|
+
},
|
|
469
|
+
content: [{ tag: 'picture', attrs: { type, query: 'url' } }]
|
|
470
|
+
}, timeoutMs);
|
|
471
|
+
const child = getBinaryNodeChild(result, 'picture');
|
|
472
|
+
return child?.attrs?.url;
|
|
473
|
+
};
|
|
538
474
|
const createCallLink = async (type, event, timeoutMs) => {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
content: event ? [{
|
|
557
|
-
tag: 'event',
|
|
558
|
-
attrs: {
|
|
559
|
-
start_time: String(event)
|
|
560
|
-
}
|
|
561
|
-
}] : undefined
|
|
562
|
-
}]
|
|
563
|
-
}, timeoutMs)
|
|
564
|
-
|
|
565
|
-
const child = WABinary_1.getBinaryNodeChild(result, 'link_create')
|
|
566
|
-
const token = child?.attrs?.token
|
|
567
|
-
|
|
568
|
-
return type === 'audio' ? Defaults_1.CALL_AUDIO_PREFIX + token : Defaults_1.CALL_VIDEO_PREFIX + token
|
|
569
|
-
}
|
|
570
|
-
|
|
475
|
+
const result = await query({
|
|
476
|
+
tag: 'call',
|
|
477
|
+
attrs: {
|
|
478
|
+
id: generateMessageTag(),
|
|
479
|
+
to: '@call'
|
|
480
|
+
},
|
|
481
|
+
content: [
|
|
482
|
+
{
|
|
483
|
+
tag: 'link_create',
|
|
484
|
+
attrs: { media: type },
|
|
485
|
+
content: event ? [{ tag: 'event', attrs: { start_time: String(event.startTime) } }] : undefined
|
|
486
|
+
}
|
|
487
|
+
]
|
|
488
|
+
}, timeoutMs);
|
|
489
|
+
const child = getBinaryNodeChild(result, 'link_create');
|
|
490
|
+
return child?.attrs?.token;
|
|
491
|
+
};
|
|
571
492
|
const sendPresenceUpdate = async (type, toJid) => {
|
|
572
|
-
const me = authState.creds.me
|
|
573
|
-
|
|
493
|
+
const me = authState.creds.me;
|
|
574
494
|
if (type === 'available' || type === 'unavailable') {
|
|
575
495
|
if (!me.name) {
|
|
576
|
-
logger.warn('no name present, ignoring presence update request...')
|
|
577
|
-
return
|
|
496
|
+
logger.warn('no name present, ignoring presence update request...');
|
|
497
|
+
return;
|
|
578
498
|
}
|
|
579
|
-
|
|
580
|
-
ev.emit('connection.update', { isOnline: type === 'available' })
|
|
499
|
+
ev.emit('connection.update', { isOnline: type === 'available' });
|
|
581
500
|
await sendNode({
|
|
582
501
|
tag: 'presence',
|
|
583
502
|
attrs: {
|
|
584
503
|
name: me.name.replace(/@/g, ''),
|
|
585
504
|
type
|
|
586
505
|
}
|
|
587
|
-
})
|
|
506
|
+
});
|
|
588
507
|
}
|
|
589
508
|
else {
|
|
590
|
-
|
|
591
|
-
|
|
509
|
+
const { server } = jidDecode(toJid);
|
|
510
|
+
const isLid = server === 'lid';
|
|
592
511
|
await sendNode({
|
|
593
512
|
tag: 'chatstate',
|
|
594
513
|
attrs: {
|
|
595
|
-
from:
|
|
514
|
+
from: isLid ? me.lid : me.id,
|
|
596
515
|
to: toJid
|
|
597
516
|
},
|
|
598
517
|
content: [
|
|
@@ -601,15 +520,14 @@ const makeChatsSocket = (config) => {
|
|
|
601
520
|
attrs: type === 'recording' ? { media: 'audio' } : {}
|
|
602
521
|
}
|
|
603
522
|
]
|
|
604
|
-
})
|
|
523
|
+
});
|
|
605
524
|
}
|
|
606
|
-
}
|
|
607
|
-
|
|
525
|
+
};
|
|
608
526
|
/**
|
|
609
527
|
* @param toJid the jid to subscribe to
|
|
610
528
|
* @param tcToken token for subscription, use if present
|
|
611
529
|
*/
|
|
612
|
-
const presenceSubscribe = (toJid, tcToken) =>
|
|
530
|
+
const presenceSubscribe = (toJid, tcToken) => sendNode({
|
|
613
531
|
tag: 'presence',
|
|
614
532
|
attrs: {
|
|
615
533
|
to: toJid,
|
|
@@ -625,72 +543,58 @@ const makeChatsSocket = (config) => {
|
|
|
625
543
|
}
|
|
626
544
|
]
|
|
627
545
|
: undefined
|
|
628
|
-
})
|
|
629
|
-
|
|
546
|
+
});
|
|
630
547
|
const handlePresenceUpdate = ({ tag, attrs, content }) => {
|
|
631
|
-
let presence
|
|
632
|
-
const jid = attrs.from
|
|
633
|
-
const participant = attrs.participant || attrs.from
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
return
|
|
548
|
+
let presence;
|
|
549
|
+
const jid = attrs.from;
|
|
550
|
+
const participant = attrs.participant || attrs.from;
|
|
551
|
+
if (shouldIgnoreJid(jid) && jid !== S_WHATSAPP_NET) {
|
|
552
|
+
return;
|
|
637
553
|
}
|
|
638
|
-
|
|
639
554
|
if (tag === 'presence') {
|
|
640
555
|
presence = {
|
|
641
556
|
lastKnownPresence: attrs.type === 'unavailable' ? 'unavailable' : 'available',
|
|
642
557
|
lastSeen: attrs.last && attrs.last !== 'deny' ? +attrs.last : undefined
|
|
643
|
-
}
|
|
558
|
+
};
|
|
644
559
|
}
|
|
645
|
-
|
|
646
560
|
else if (Array.isArray(content)) {
|
|
647
|
-
const [firstChild] = content
|
|
648
|
-
let type = firstChild.tag
|
|
649
|
-
|
|
561
|
+
const [firstChild] = content;
|
|
562
|
+
let type = firstChild.tag;
|
|
650
563
|
if (type === 'paused') {
|
|
651
|
-
type = 'available'
|
|
564
|
+
type = 'available';
|
|
652
565
|
}
|
|
653
|
-
|
|
654
566
|
if (firstChild.attrs?.media === 'audio') {
|
|
655
|
-
type = 'recording'
|
|
567
|
+
type = 'recording';
|
|
656
568
|
}
|
|
657
|
-
|
|
658
|
-
presence = { lastKnownPresence: type }
|
|
569
|
+
presence = { lastKnownPresence: type };
|
|
659
570
|
}
|
|
660
|
-
|
|
661
571
|
else {
|
|
662
|
-
logger.error({ tag, attrs, content }, 'recv invalid presence node')
|
|
572
|
+
logger.error({ tag, attrs, content }, 'recv invalid presence node');
|
|
663
573
|
}
|
|
664
|
-
|
|
665
574
|
if (presence) {
|
|
666
|
-
ev.emit('presence.update', { id: jid, presences: { [participant]: presence } })
|
|
575
|
+
ev.emit('presence.update', { id: jid, presences: { [participant]: presence } });
|
|
667
576
|
}
|
|
668
|
-
}
|
|
669
|
-
|
|
577
|
+
};
|
|
670
578
|
const appPatch = async (patchCreate) => {
|
|
671
|
-
const name = patchCreate.type
|
|
672
|
-
const myAppStateKeyId = authState.creds.myAppStateKeyId
|
|
673
|
-
|
|
579
|
+
const name = patchCreate.type;
|
|
580
|
+
const myAppStateKeyId = authState.creds.myAppStateKeyId;
|
|
674
581
|
if (!myAppStateKeyId) {
|
|
675
|
-
throw new
|
|
582
|
+
throw new Boom('App state key not present!', { statusCode: 400 });
|
|
676
583
|
}
|
|
677
|
-
|
|
678
|
-
let
|
|
679
|
-
let encodeResult
|
|
680
|
-
|
|
584
|
+
let initial;
|
|
585
|
+
let encodeResult;
|
|
681
586
|
await processingMutex.mutex(async () => {
|
|
682
587
|
await authState.keys.transaction(async () => {
|
|
683
|
-
logger.debug({ patch: patchCreate }, 'applying app patch')
|
|
684
|
-
await resyncAppState([name], false)
|
|
685
|
-
const { [name]: currentSyncVersion } = await authState.keys.get('app-state-sync-version', [name])
|
|
686
|
-
initial = currentSyncVersion ||
|
|
687
|
-
encodeResult = await
|
|
688
|
-
const { patch, state } = encodeResult
|
|
689
|
-
|
|
588
|
+
logger.debug({ patch: patchCreate }, 'applying app patch');
|
|
589
|
+
await resyncAppState([name], false);
|
|
590
|
+
const { [name]: currentSyncVersion } = await authState.keys.get('app-state-sync-version', [name]);
|
|
591
|
+
initial = currentSyncVersion || newLTHashState();
|
|
592
|
+
encodeResult = await encodeSyncdPatch(patchCreate, myAppStateKeyId, initial, getAppStateSyncKey);
|
|
593
|
+
const { patch, state } = encodeResult;
|
|
690
594
|
const node = {
|
|
691
595
|
tag: 'iq',
|
|
692
596
|
attrs: {
|
|
693
|
-
to:
|
|
597
|
+
to: S_WHATSAPP_NET,
|
|
694
598
|
type: 'set',
|
|
695
599
|
xmlns: 'w:sync:app:state'
|
|
696
600
|
},
|
|
@@ -704,88 +608,82 @@ const makeChatsSocket = (config) => {
|
|
|
704
608
|
attrs: {
|
|
705
609
|
name,
|
|
706
610
|
version: (state.version - 1).toString(),
|
|
707
|
-
|
|
611
|
+
return_snapshot: 'false'
|
|
708
612
|
},
|
|
709
613
|
content: [
|
|
710
614
|
{
|
|
711
615
|
tag: 'patch',
|
|
712
616
|
attrs: {},
|
|
713
|
-
content:
|
|
617
|
+
content: proto.SyncdPatch.encode(patch).finish()
|
|
714
618
|
}
|
|
715
619
|
]
|
|
716
620
|
}
|
|
717
621
|
]
|
|
718
622
|
}
|
|
719
623
|
]
|
|
720
|
-
}
|
|
721
|
-
await query(node)
|
|
722
|
-
await authState.keys.set({ 'app-state-sync-version': { [name]: state } })
|
|
723
|
-
}, authState?.creds?.me?.id || 'app-patch')
|
|
724
|
-
})
|
|
725
|
-
|
|
624
|
+
};
|
|
625
|
+
await query(node);
|
|
626
|
+
await authState.keys.set({ 'app-state-sync-version': { [name]: state } });
|
|
627
|
+
}, authState?.creds?.me?.id || 'app-patch');
|
|
628
|
+
});
|
|
726
629
|
if (config.emitOwnEvents) {
|
|
727
|
-
const { onMutation } = newAppStateChunkHandler(false)
|
|
728
|
-
const { mutationMap } = await
|
|
729
|
-
|
|
630
|
+
const { onMutation } = newAppStateChunkHandler(false);
|
|
631
|
+
const { mutationMap } = await decodePatches(name, [{ ...encodeResult.patch, version: { version: encodeResult.state.version } }], initial, getAppStateSyncKey, config.options, undefined, logger);
|
|
730
632
|
for (const key in mutationMap) {
|
|
731
|
-
onMutation(mutationMap[key])
|
|
633
|
+
onMutation(mutationMap[key]);
|
|
732
634
|
}
|
|
733
635
|
}
|
|
734
|
-
}
|
|
735
|
-
|
|
636
|
+
};
|
|
736
637
|
/** sending non-abt props may fix QR scan fail if server expects */
|
|
737
638
|
const fetchProps = async () => {
|
|
639
|
+
//TODO: implement both protocol 1 and protocol 2 prop fetching, specially for abKey for WM
|
|
738
640
|
const resultNode = await query({
|
|
739
641
|
tag: 'iq',
|
|
740
642
|
attrs: {
|
|
741
|
-
to:
|
|
643
|
+
to: S_WHATSAPP_NET,
|
|
742
644
|
xmlns: 'w',
|
|
743
|
-
type: 'get'
|
|
645
|
+
type: 'get'
|
|
744
646
|
},
|
|
745
647
|
content: [
|
|
746
|
-
{
|
|
648
|
+
{
|
|
649
|
+
tag: 'props',
|
|
650
|
+
attrs: {
|
|
747
651
|
protocol: '2',
|
|
748
652
|
hash: authState?.creds?.lastPropHash || ''
|
|
749
|
-
}
|
|
653
|
+
}
|
|
654
|
+
}
|
|
750
655
|
]
|
|
751
|
-
})
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
let props = {}
|
|
755
|
-
|
|
656
|
+
});
|
|
657
|
+
const propsNode = getBinaryNodeChild(resultNode, 'props');
|
|
658
|
+
let props = {};
|
|
756
659
|
if (propsNode) {
|
|
757
|
-
if (propsNode.attrs?.hash) {
|
|
758
|
-
|
|
759
|
-
|
|
660
|
+
if (propsNode.attrs?.hash) {
|
|
661
|
+
// on some clients, the hash is returning as undefined
|
|
662
|
+
authState.creds.lastPropHash = propsNode?.attrs?.hash;
|
|
663
|
+
ev.emit('creds.update', authState.creds);
|
|
760
664
|
}
|
|
761
|
-
|
|
762
|
-
props = WABinary_1.reduceBinaryNodeToDictionary(propsNode, 'prop')
|
|
665
|
+
props = reduceBinaryNodeToDictionary(propsNode, 'prop');
|
|
763
666
|
}
|
|
764
|
-
logger.debug('fetched props')
|
|
765
|
-
return props
|
|
766
|
-
}
|
|
767
|
-
|
|
667
|
+
logger.debug('fetched props');
|
|
668
|
+
return props;
|
|
669
|
+
};
|
|
768
670
|
/**
|
|
769
671
|
* modify a chat -- mark unread, read etc.
|
|
770
672
|
* lastMessages must be sorted in reverse chronologically
|
|
771
|
-
* requires the last messages till the last message received required for archive & unread
|
|
772
|
-
|
|
673
|
+
* requires the last messages till the last message received; required for archive & unread
|
|
674
|
+
*/
|
|
773
675
|
const chatModify = (mod, jid) => {
|
|
774
|
-
const patch =
|
|
775
|
-
return appPatch(patch)
|
|
776
|
-
}
|
|
777
|
-
|
|
676
|
+
const patch = chatModificationToAppPatch(mod, jid);
|
|
677
|
+
return appPatch(patch);
|
|
678
|
+
};
|
|
778
679
|
/**
|
|
779
680
|
* Enable/Disable link preview privacy, not related to baileys link preview generation
|
|
780
681
|
*/
|
|
781
682
|
const updateDisableLinkPreviewsPrivacy = (isPreviewsDisabled) => {
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
}, '')
|
|
787
|
-
}
|
|
788
|
-
|
|
683
|
+
return chatModify({
|
|
684
|
+
disableLinkPreviews: { isPreviewsDisabled }
|
|
685
|
+
}, '');
|
|
686
|
+
};
|
|
789
687
|
/**
|
|
790
688
|
* Star or Unstar a message
|
|
791
689
|
*/
|
|
@@ -795,27 +693,24 @@ const makeChatsSocket = (config) => {
|
|
|
795
693
|
messages,
|
|
796
694
|
star
|
|
797
695
|
}
|
|
798
|
-
}, jid)
|
|
799
|
-
}
|
|
800
|
-
|
|
696
|
+
}, jid);
|
|
697
|
+
};
|
|
801
698
|
/**
|
|
802
|
-
* Add
|
|
699
|
+
* Add or Edit Contact
|
|
803
700
|
*/
|
|
804
701
|
const addOrEditContact = (jid, contact) => {
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
}, jid)
|
|
808
|
-
}
|
|
809
|
-
|
|
702
|
+
return chatModify({
|
|
703
|
+
contact
|
|
704
|
+
}, jid);
|
|
705
|
+
};
|
|
810
706
|
/**
|
|
811
707
|
* Remove Contact
|
|
812
708
|
*/
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
709
|
+
const removeContact = (jid) => {
|
|
710
|
+
return chatModify({
|
|
711
|
+
contact: null
|
|
712
|
+
}, jid);
|
|
713
|
+
};
|
|
819
714
|
/**
|
|
820
715
|
* Adds label
|
|
821
716
|
*/
|
|
@@ -824,9 +719,8 @@ const makeChatsSocket = (config) => {
|
|
|
824
719
|
addLabel: {
|
|
825
720
|
...labels
|
|
826
721
|
}
|
|
827
|
-
}, jid)
|
|
828
|
-
}
|
|
829
|
-
|
|
722
|
+
}, jid);
|
|
723
|
+
};
|
|
830
724
|
/**
|
|
831
725
|
* Adds label for the chats
|
|
832
726
|
*/
|
|
@@ -835,9 +729,8 @@ const makeChatsSocket = (config) => {
|
|
|
835
729
|
addChatLabel: {
|
|
836
730
|
labelId
|
|
837
731
|
}
|
|
838
|
-
}, jid)
|
|
839
|
-
}
|
|
840
|
-
|
|
732
|
+
}, jid);
|
|
733
|
+
};
|
|
841
734
|
/**
|
|
842
735
|
* Removes label for the chat
|
|
843
736
|
*/
|
|
@@ -846,9 +739,8 @@ const makeChatsSocket = (config) => {
|
|
|
846
739
|
removeChatLabel: {
|
|
847
740
|
labelId
|
|
848
741
|
}
|
|
849
|
-
}, jid)
|
|
850
|
-
}
|
|
851
|
-
|
|
742
|
+
}, jid);
|
|
743
|
+
};
|
|
852
744
|
/**
|
|
853
745
|
* Adds label for the message
|
|
854
746
|
*/
|
|
@@ -858,9 +750,8 @@ const makeChatsSocket = (config) => {
|
|
|
858
750
|
messageId,
|
|
859
751
|
labelId
|
|
860
752
|
}
|
|
861
|
-
}, jid)
|
|
862
|
-
}
|
|
863
|
-
|
|
753
|
+
}, jid);
|
|
754
|
+
};
|
|
864
755
|
/**
|
|
865
756
|
* Removes label for the message
|
|
866
757
|
*/
|
|
@@ -870,216 +761,170 @@ const makeChatsSocket = (config) => {
|
|
|
870
761
|
messageId,
|
|
871
762
|
labelId
|
|
872
763
|
}
|
|
873
|
-
}, jid)
|
|
874
|
-
}
|
|
875
|
-
|
|
764
|
+
}, jid);
|
|
765
|
+
};
|
|
876
766
|
/**
|
|
877
|
-
* Removes Chats
|
|
878
|
-
*/
|
|
879
|
-
const clearMessage = (jid, key, timeStamp) => {
|
|
880
|
-
return chatModify({
|
|
881
|
-
delete: true,
|
|
882
|
-
lastMessages: [{
|
|
883
|
-
key: key,
|
|
884
|
-
messageTimestamp: timeStamp
|
|
885
|
-
}],
|
|
886
|
-
}, jid)
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
/**
|
|
890
767
|
* Add or Edit Quick Reply
|
|
891
768
|
*/
|
|
892
769
|
const addOrEditQuickReply = (quickReply) => {
|
|
893
770
|
return chatModify({
|
|
894
771
|
quickReply
|
|
895
|
-
}, '')
|
|
896
|
-
}
|
|
897
|
-
|
|
772
|
+
}, '');
|
|
773
|
+
};
|
|
898
774
|
/**
|
|
899
775
|
* Remove Quick Reply
|
|
900
776
|
*/
|
|
901
777
|
const removeQuickReply = (timestamp) => {
|
|
902
778
|
return chatModify({
|
|
903
779
|
quickReply: { timestamp, deleted: true }
|
|
904
|
-
}, '')
|
|
905
|
-
}
|
|
906
|
-
|
|
780
|
+
}, '');
|
|
781
|
+
};
|
|
907
782
|
/**
|
|
908
783
|
* queries need to be fired on connection open
|
|
909
784
|
* help ensure parity with WA Web
|
|
910
785
|
* */
|
|
911
786
|
const executeInitQueries = async () => {
|
|
912
|
-
await Promise.all([
|
|
913
|
-
|
|
914
|
-
fetchBlocklist(),
|
|
915
|
-
fetchPrivacySettings(),
|
|
916
|
-
])
|
|
917
|
-
}
|
|
918
|
-
|
|
787
|
+
await Promise.all([fetchProps(), fetchBlocklist(), fetchPrivacySettings()]);
|
|
788
|
+
};
|
|
919
789
|
const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
|
|
920
|
-
ev.emit('messages.upsert', { messages: [msg], type })
|
|
790
|
+
ev.emit('messages.upsert', { messages: [msg], type });
|
|
921
791
|
if (!!msg.pushName) {
|
|
922
|
-
let jid = msg.key.fromMe ? authState.creds.me.id :
|
|
923
|
-
jid =
|
|
924
|
-
|
|
792
|
+
let jid = msg.key.fromMe ? authState.creds.me.id : msg.key.participant || msg.key.remoteJid;
|
|
793
|
+
jid = jidNormalizedUser(jid);
|
|
925
794
|
if (!msg.key.fromMe) {
|
|
926
|
-
ev.emit('contacts.update', [{ id: jid, notify: msg.pushName, verifiedName: msg.verifiedBizName }])
|
|
795
|
+
ev.emit('contacts.update', [{ id: jid, notify: msg.pushName, verifiedName: msg.verifiedBizName }]);
|
|
927
796
|
}
|
|
928
|
-
|
|
929
797
|
// update our pushname too
|
|
930
798
|
if (msg.key.fromMe && msg.pushName && authState.creds.me?.name !== msg.pushName) {
|
|
931
|
-
ev.emit('creds.update', { me: { ...authState.creds.me, name: msg.pushName } })
|
|
799
|
+
ev.emit('creds.update', { me: { ...authState.creds.me, name: msg.pushName } });
|
|
932
800
|
}
|
|
933
801
|
}
|
|
934
|
-
|
|
935
|
-
const historyMsg = Utils_1.getHistoryMsg(msg.message)
|
|
802
|
+
const historyMsg = getHistoryMsg(msg.message);
|
|
936
803
|
const shouldProcessHistoryMsg = historyMsg
|
|
937
|
-
?
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
if (historyMsg && syncState === Types_1.SyncState.AwaitingInitialSync) {
|
|
804
|
+
? shouldSyncHistoryMessage(historyMsg) && PROCESSABLE_HISTORY_TYPES.includes(historyMsg.syncType)
|
|
805
|
+
: false;
|
|
806
|
+
// State machine: decide on sync and flush
|
|
807
|
+
if (historyMsg && syncState === SyncState.AwaitingInitialSync) {
|
|
942
808
|
if (awaitingSyncTimeout) {
|
|
943
|
-
|
|
944
|
-
|
|
809
|
+
clearTimeout(awaitingSyncTimeout);
|
|
810
|
+
awaitingSyncTimeout = undefined;
|
|
945
811
|
}
|
|
946
|
-
|
|
947
812
|
if (shouldProcessHistoryMsg) {
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
}
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
813
|
+
syncState = SyncState.Syncing;
|
|
814
|
+
logger.info('Transitioned to Syncing state');
|
|
815
|
+
// Let doAppStateSync handle the final flush after it's done
|
|
816
|
+
}
|
|
817
|
+
else {
|
|
818
|
+
syncState = SyncState.Online;
|
|
819
|
+
logger.info('History sync skipped, transitioning to Online state and flushing buffer');
|
|
820
|
+
ev.flush();
|
|
955
821
|
}
|
|
956
822
|
}
|
|
957
|
-
|
|
958
823
|
const doAppStateSync = async () => {
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
|
|
824
|
+
if (syncState === SyncState.Syncing) {
|
|
825
|
+
logger.info('Doing app state sync');
|
|
826
|
+
await resyncAppState(ALL_WA_PATCH_NAMES, true);
|
|
827
|
+
// Sync is complete, go online and flush everything
|
|
828
|
+
syncState = SyncState.Online;
|
|
829
|
+
logger.info('App state sync complete, transitioning to Online state and flushing buffer');
|
|
830
|
+
ev.flush();
|
|
831
|
+
const accountSyncCounter = (authState.creds.accountSyncCounter || 0) + 1;
|
|
832
|
+
ev.emit('creds.update', { accountSyncCounter });
|
|
833
|
+
}
|
|
834
|
+
};
|
|
973
835
|
await Promise.all([
|
|
974
836
|
(async () => {
|
|
975
837
|
if (shouldProcessHistoryMsg) {
|
|
976
|
-
await doAppStateSync()
|
|
838
|
+
await doAppStateSync();
|
|
977
839
|
}
|
|
978
840
|
})(),
|
|
979
|
-
|
|
980
|
-
|
|
841
|
+
processMessage(msg, {
|
|
842
|
+
signalRepository,
|
|
981
843
|
shouldProcessHistoryMsg,
|
|
982
844
|
placeholderResendCache,
|
|
983
845
|
ev,
|
|
984
846
|
creds: authState.creds,
|
|
985
847
|
keyStore: authState.keys,
|
|
986
848
|
logger,
|
|
987
|
-
options: config.options
|
|
988
|
-
getMessage: config.getMessage,
|
|
849
|
+
options: config.options
|
|
989
850
|
})
|
|
990
|
-
])
|
|
991
|
-
|
|
992
|
-
if (msg.message?.protocolMessage?.appStateSyncKeyShare && syncState ===
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
}
|
|
996
|
-
})
|
|
997
|
-
|
|
998
|
-
ws.on('CB:
|
|
999
|
-
ws.on('CB:chatstate', handlePresenceUpdate)
|
|
851
|
+
]);
|
|
852
|
+
// If the app state key arrives and we are waiting to sync, trigger the sync now.
|
|
853
|
+
if (msg.message?.protocolMessage?.appStateSyncKeyShare && syncState === SyncState.Syncing) {
|
|
854
|
+
logger.info('App state sync key arrived, triggering app state sync');
|
|
855
|
+
await doAppStateSync();
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
ws.on('CB:presence', handlePresenceUpdate);
|
|
859
|
+
ws.on('CB:chatstate', handlePresenceUpdate);
|
|
1000
860
|
ws.on('CB:ib,,dirty', async (node) => {
|
|
1001
|
-
const { attrs } =
|
|
1002
|
-
const type = attrs.type
|
|
1003
|
-
|
|
861
|
+
const { attrs } = getBinaryNodeChild(node, 'dirty');
|
|
862
|
+
const type = attrs.type;
|
|
1004
863
|
switch (type) {
|
|
1005
864
|
case 'account_sync':
|
|
1006
865
|
if (attrs.timestamp) {
|
|
1007
|
-
let { lastAccountSyncTimestamp } = authState.creds
|
|
866
|
+
let { lastAccountSyncTimestamp } = authState.creds;
|
|
1008
867
|
if (lastAccountSyncTimestamp) {
|
|
1009
|
-
await cleanDirtyBits('account_sync', lastAccountSyncTimestamp)
|
|
868
|
+
await cleanDirtyBits('account_sync', lastAccountSyncTimestamp);
|
|
1010
869
|
}
|
|
1011
|
-
lastAccountSyncTimestamp = +attrs.timestamp
|
|
1012
|
-
ev.emit('creds.update', { lastAccountSyncTimestamp })
|
|
870
|
+
lastAccountSyncTimestamp = +attrs.timestamp;
|
|
871
|
+
ev.emit('creds.update', { lastAccountSyncTimestamp });
|
|
1013
872
|
}
|
|
1014
|
-
break
|
|
873
|
+
break;
|
|
1015
874
|
case 'groups':
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
break
|
|
875
|
+
// handled in groups.ts
|
|
876
|
+
break;
|
|
1019
877
|
default:
|
|
1020
|
-
logger.info({ node }, 'received unknown sync')
|
|
1021
|
-
break
|
|
878
|
+
logger.info({ node }, 'received unknown sync');
|
|
879
|
+
break;
|
|
1022
880
|
}
|
|
1023
|
-
})
|
|
1024
|
-
|
|
881
|
+
});
|
|
1025
882
|
ev.on('connection.update', ({ connection, receivedPendingNotifications }) => {
|
|
1026
883
|
if (connection === 'open') {
|
|
1027
884
|
if (fireInitQueries) {
|
|
1028
|
-
executeInitQueries()
|
|
1029
|
-
.catch(error => onUnexpectedError(error, 'init queries'))
|
|
885
|
+
executeInitQueries().catch(error => onUnexpectedError(error, 'init queries'));
|
|
1030
886
|
}
|
|
1031
|
-
sendPresenceUpdate(markOnlineOnConnect ? 'available' : 'unavailable')
|
|
1032
|
-
.catch(error => onUnexpectedError(error, 'presence update requests'))
|
|
887
|
+
sendPresenceUpdate(markOnlineOnConnect ? 'available' : 'unavailable').catch(error => onUnexpectedError(error, 'presence update requests'));
|
|
1033
888
|
}
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
return
|
|
889
|
+
if (!receivedPendingNotifications || syncState !== SyncState.Connecting) {
|
|
890
|
+
return;
|
|
1037
891
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
syncType: WAProto_1.proto.HistorySync.HistorySyncType.RECENT
|
|
1045
|
-
}))
|
|
1046
|
-
|
|
892
|
+
syncState = SyncState.AwaitingInitialSync;
|
|
893
|
+
logger.info('Connection is now AwaitingInitialSync, buffering events');
|
|
894
|
+
ev.buffer();
|
|
895
|
+
const willSyncHistory = shouldSyncHistoryMessage(proto.Message.HistorySyncNotification.create({
|
|
896
|
+
syncType: proto.HistorySync.HistorySyncType.RECENT
|
|
897
|
+
}));
|
|
1047
898
|
if (!willSyncHistory) {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
899
|
+
logger.info('History sync is disabled by config, not waiting for notification. Transitioning to Online.');
|
|
900
|
+
syncState = SyncState.Online;
|
|
901
|
+
setTimeout(() => ev.flush(), 0);
|
|
902
|
+
return;
|
|
1052
903
|
}
|
|
1053
|
-
|
|
1054
|
-
logger.info('History sync is enabled, awaiting notification with a 20s timeout.')
|
|
1055
|
-
|
|
904
|
+
logger.info('History sync is enabled, awaiting notification with a 20s timeout.');
|
|
1056
905
|
if (awaitingSyncTimeout) {
|
|
1057
|
-
|
|
906
|
+
clearTimeout(awaitingSyncTimeout);
|
|
1058
907
|
}
|
|
1059
|
-
|
|
1060
908
|
awaitingSyncTimeout = setTimeout(() => {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
909
|
+
if (syncState === SyncState.AwaitingInitialSync) {
|
|
910
|
+
// TODO: investigate
|
|
911
|
+
logger.warn('Timeout in AwaitingInitialSync, forcing state to Online and flushing buffer');
|
|
912
|
+
syncState = SyncState.Online;
|
|
913
|
+
ev.flush();
|
|
914
|
+
}
|
|
915
|
+
}, 20000);
|
|
916
|
+
});
|
|
1069
917
|
return {
|
|
1070
|
-
...
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
removeContact,
|
|
918
|
+
...sock,
|
|
919
|
+
createCallLink,
|
|
920
|
+
getBotListV2,
|
|
1074
921
|
processingMutex,
|
|
1075
922
|
fetchPrivacySettings,
|
|
1076
923
|
upsertMessage,
|
|
1077
924
|
appPatch,
|
|
1078
|
-
createCallLink,
|
|
1079
925
|
sendPresenceUpdate,
|
|
1080
|
-
presenceSubscribe,
|
|
1081
|
-
|
|
1082
|
-
getLidUser,
|
|
926
|
+
presenceSubscribe,
|
|
927
|
+
profilePictureUrl,
|
|
1083
928
|
fetchBlocklist,
|
|
1084
929
|
fetchStatus,
|
|
1085
930
|
fetchDisappearingDuration,
|
|
@@ -1088,8 +933,9 @@ const makeChatsSocket = (config) => {
|
|
|
1088
933
|
updateProfileStatus,
|
|
1089
934
|
updateProfileName,
|
|
1090
935
|
updateBlockStatus,
|
|
936
|
+
updateDisableLinkPreviewsPrivacy,
|
|
1091
937
|
updateCallPrivacy,
|
|
1092
|
-
updateMessagesPrivacy,
|
|
938
|
+
updateMessagesPrivacy,
|
|
1093
939
|
updateLastSeenPrivacy,
|
|
1094
940
|
updateOnlinePrivacy,
|
|
1095
941
|
updateProfilePicturePrivacy,
|
|
@@ -1097,22 +943,20 @@ const makeChatsSocket = (config) => {
|
|
|
1097
943
|
updateReadReceiptsPrivacy,
|
|
1098
944
|
updateGroupsAddPrivacy,
|
|
1099
945
|
updateDefaultDisappearingMode,
|
|
1100
|
-
updateDisableLinkPreviewsPrivacy,
|
|
1101
946
|
getBusinessProfile,
|
|
1102
947
|
resyncAppState,
|
|
1103
948
|
chatModify,
|
|
1104
949
|
cleanDirtyBits,
|
|
950
|
+
addOrEditContact,
|
|
951
|
+
removeContact,
|
|
1105
952
|
addLabel,
|
|
1106
953
|
addChatLabel,
|
|
1107
954
|
removeChatLabel,
|
|
1108
955
|
addMessageLabel,
|
|
1109
956
|
removeMessageLabel,
|
|
1110
|
-
|
|
957
|
+
star,
|
|
1111
958
|
addOrEditQuickReply,
|
|
1112
959
|
removeQuickReply
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
module.exports = {
|
|
1117
|
-
makeChatsSocket
|
|
1118
|
-
}
|
|
960
|
+
};
|
|
961
|
+
};
|
|
962
|
+
//# sourceMappingURL=chats.js.map
|