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