@baileysmod-ubed/baileys 0.3.17
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 +22 -0
- package/README.md +79 -0
- package/WAProto/index.d.ts +15871 -0
- package/WAProto/index.js +115447 -0
- package/engine-requirements.js +13 -0
- package/lib/Defaults/index.d.ts +145 -0
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +152 -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 +8 -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 +11 -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 +7 -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 +12 -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 +13 -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 +17 -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 +55 -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 +21 -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 +6 -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 +395 -0
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +380 -0
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +137 -0
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +1214 -0
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +562 -0
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +432 -0
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/groups.d.ts +286 -0
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +348 -0
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +530 -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 +334 -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 +330 -0
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +1368 -0
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +2 -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 +283 -0
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +226 -0
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +61 -0
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +967 -0
- package/lib/Socket/socket.js.map +1 -0
- package/lib/Store/index.d.ts +4 -0
- package/lib/Store/index.d.ts.map +1 -0
- package/lib/Store/index.js +4 -0
- package/lib/Store/index.js.map +1 -0
- package/lib/Store/make-in-memory-store.d.ts +63 -0
- package/lib/Store/make-in-memory-store.d.ts.map +1 -0
- package/lib/Store/make-in-memory-store.js +421 -0
- package/lib/Store/make-in-memory-store.js.map +1 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.d.ts.map +1 -0
- package/lib/Store/make-ordered-dictionary.js +79 -0
- package/lib/Store/make-ordered-dictionary.js.map +1 -0
- package/lib/Store/object-repository.d.ts +11 -0
- package/lib/Store/object-repository.d.ts.map +1 -0
- package/lib/Store/object-repository.js +24 -0
- package/lib/Store/object-repository.js.map +1 -0
- package/lib/Types/Auth.d.ts +2 -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 +2 -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 +2 -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 +2 -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 +2 -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 +2 -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 +2 -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 +3 -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 +3 -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 +12 -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 +3 -0
- package/lib/Types/Mex.d.ts.map +1 -0
- package/lib/Types/Mex.js +39 -0
- package/lib/Types/Mex.js.map +1 -0
- package/lib/Types/Product.d.ts +2 -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/RichType.d.ts +3 -0
- package/lib/Types/RichType.d.ts.map +1 -0
- package/lib/Types/RichType.js +23 -0
- package/lib/Types/RichType.js.map +1 -0
- package/lib/Types/Signal.d.ts +2 -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 +2 -0
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +2 -0
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +6 -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 +2 -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 +14 -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/auth-utils.d.ts +58 -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/browser-utils.d.ts +9 -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 +50 -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-utils.d.ts +409 -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 +5 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +40 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +40 -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 +84 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +317 -0
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +13 -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 +64 -0
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +395 -0
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +76 -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 +14 -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 +25 -0
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +25 -0
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +13 -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 +3 -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 +7 -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 +7 -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-retry-manager.d.ts +80 -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/messages-media.d.ts +137 -0
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +843 -0
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +46 -0
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +1863 -0
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +21 -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 +10 -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 +26 -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 +84 -0
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +749 -0
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/reporting-utils.d.ts +13 -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/rich-message-utils.d.ts +49 -0
- package/lib/Utils/rich-message-utils.d.ts.map +1 -0
- package/lib/Utils/rich-message-utils.js +370 -0
- package/lib/Utils/rich-message-utils.js.map +1 -0
- package/lib/Utils/signal.d.ts +83 -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 +17 -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/sync-action-utils.d.ts +3 -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 +30 -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/use-multi-file-auth-state.d.ts +11 -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 +11 -0
- package/lib/Utils/use-single-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-single-file-auth-state.js +109 -0
- package/lib/Utils/use-single-file-auth-state.js.map +1 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-sqlite-auth-state.js +109 -0
- package/lib/Utils/use-sqlite-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +44 -0
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +203 -0
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +62 -0
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +1467 -0
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +10 -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 +77 -0
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +226 -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 +29 -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 +2 -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 +8 -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 +34927 -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 +2 -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 +37 -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 +39 -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 +15 -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 +6 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +6 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +21 -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/index.d.ts +12 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +12 -0
- package/lib/index.js.map +1 -0
- package/package.json +108 -0
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
import { Boom } from '@hapi/boom';
|
|
2
|
+
import { proto } from '../../WAProto/index.js';
|
|
3
|
+
import { WAMessageStubType } from '../Types/index.js';
|
|
4
|
+
import { getContentType, normalizeMessageContent } from '../Utils/messages.js';
|
|
5
|
+
import { areJidsSameUser, isHostedLidUser, isHostedPnUser, isJidBroadcast, isJidStatusBroadcast, isLidUser, jidDecode, jidEncode, jidNormalizedUser } from '../WABinary/index.js';
|
|
6
|
+
import { aesDecryptGCM, hmacSign } from './crypto.js';
|
|
7
|
+
import { getKeyAuthor, toNumber } from './generics.js';
|
|
8
|
+
import { downloadAndProcessHistorySyncNotification } from './history.js';
|
|
9
|
+
import { buildMergedTcTokenIndexWrite, resolveTcTokenJid } from './tc-token-utils.js';
|
|
10
|
+
const REAL_MSG_STUB_TYPES = new Set([
|
|
11
|
+
WAMessageStubType.CALL_MISSED_GROUP_VIDEO,
|
|
12
|
+
WAMessageStubType.CALL_MISSED_GROUP_VOICE,
|
|
13
|
+
WAMessageStubType.CALL_MISSED_VIDEO,
|
|
14
|
+
WAMessageStubType.CALL_MISSED_VOICE
|
|
15
|
+
]);
|
|
16
|
+
const REAL_MSG_REQ_ME_STUB_TYPES = new Set([WAMessageStubType.GROUP_PARTICIPANT_ADD]);
|
|
17
|
+
async function storeTcTokensFromHistorySync(chats, signalRepository, keyStore, logger) {
|
|
18
|
+
const getLIDForPN = signalRepository.lidMapping.getLIDForPN.bind(signalRepository.lidMapping);
|
|
19
|
+
const candidates = [];
|
|
20
|
+
for (const chat of chats) {
|
|
21
|
+
const ts = chat.tcTokenTimestamp ? toNumber(chat.tcTokenTimestamp) : 0;
|
|
22
|
+
if (chat.tcToken?.length && ts > 0) {
|
|
23
|
+
const jid = jidNormalizedUser(chat.id);
|
|
24
|
+
const storageJid = await resolveTcTokenJid(jid, getLIDForPN);
|
|
25
|
+
candidates.push({
|
|
26
|
+
storageJid,
|
|
27
|
+
token: Buffer.from(chat.tcToken),
|
|
28
|
+
ts,
|
|
29
|
+
senderTs: chat.tcTokenSenderTimestamp ? toNumber(chat.tcTokenSenderTimestamp) : undefined
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (!candidates.length) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const jids = candidates.map(c => c.storageJid);
|
|
37
|
+
const existing = await keyStore.get('tctoken', jids);
|
|
38
|
+
const entries = {};
|
|
39
|
+
for (const c of candidates) {
|
|
40
|
+
const existingEntry = existing[c.storageJid];
|
|
41
|
+
const existingTs = existingEntry?.timestamp ? Number(existingEntry.timestamp) : 0;
|
|
42
|
+
if (existingTs > 0 && existingTs >= c.ts) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
entries[c.storageJid] = {
|
|
46
|
+
...existingEntry,
|
|
47
|
+
token: c.token,
|
|
48
|
+
timestamp: String(c.ts),
|
|
49
|
+
...(c.senderTs !== undefined ? { senderTimestamp: c.senderTs } : {})
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (Object.keys(entries).length) {
|
|
53
|
+
logger?.debug({ count: Object.keys(entries).length }, 'storing tctokens from history sync');
|
|
54
|
+
try {
|
|
55
|
+
// Include updated __index so cross-session pruning picks these JIDs up.
|
|
56
|
+
const indexWrite = await buildMergedTcTokenIndexWrite(keyStore, Object.keys(entries));
|
|
57
|
+
await keyStore.set({ tctoken: { ...entries, ...indexWrite } });
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
logger?.warn({ err }, 'failed to store tctokens from history sync');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Cleans a received message to further processing */
|
|
65
|
+
export const cleanMessage = (message, meId, meLid) => {
|
|
66
|
+
// ensure remoteJid and participant doesn't have device or agent in it
|
|
67
|
+
if (isHostedPnUser(message.key.remoteJid) || isHostedLidUser(message.key.remoteJid)) {
|
|
68
|
+
message.key.remoteJid = jidEncode(jidDecode(message.key?.remoteJid)?.user, isHostedPnUser(message.key.remoteJid) ? 's.whatsapp.net' : 'lid');
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
message.key.remoteJid = jidNormalizedUser(message.key.remoteJid);
|
|
72
|
+
}
|
|
73
|
+
if (isHostedPnUser(message.key.participant) || isHostedLidUser(message.key.participant)) {
|
|
74
|
+
message.key.participant = jidEncode(jidDecode(message.key.participant)?.user, isHostedPnUser(message.key.participant) ? 's.whatsapp.net' : 'lid');
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
message.key.participant = jidNormalizedUser(message.key.participant);
|
|
78
|
+
}
|
|
79
|
+
const content = normalizeMessageContent(message.message);
|
|
80
|
+
// if the message has a reaction, ensure fromMe & remoteJid are from our perspective
|
|
81
|
+
if (content?.reactionMessage) {
|
|
82
|
+
normaliseKey(content.reactionMessage.key);
|
|
83
|
+
}
|
|
84
|
+
if (content?.pollUpdateMessage) {
|
|
85
|
+
normaliseKey(content.pollUpdateMessage.pollCreationMessageKey);
|
|
86
|
+
}
|
|
87
|
+
function normaliseKey(msgKey) {
|
|
88
|
+
// if the reaction is from another user
|
|
89
|
+
// we've to correctly map the key to this user's perspective
|
|
90
|
+
if (!message.key.fromMe) {
|
|
91
|
+
// if the sender believed the message being reacted to is not from them
|
|
92
|
+
// we've to correct the key to be from them, or some other participant
|
|
93
|
+
msgKey.fromMe = !msgKey.fromMe
|
|
94
|
+
? areJidsSameUser(msgKey.participant || msgKey.remoteJid, meId) ||
|
|
95
|
+
areJidsSameUser(msgKey.participant || msgKey.remoteJid, meLid)
|
|
96
|
+
: // if the message being reacted to, was from them
|
|
97
|
+
// fromMe automatically becomes false
|
|
98
|
+
false;
|
|
99
|
+
// set the remoteJid to being the same as the chat the message came from
|
|
100
|
+
// TODO: investigate inconsistencies
|
|
101
|
+
msgKey.remoteJid = message.key.remoteJid;
|
|
102
|
+
// set participant of the message
|
|
103
|
+
msgKey.participant = msgKey.participant || message.key.participant;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
// TODO: target:audit AUDIT THIS FUNCTION AGAIN
|
|
108
|
+
export const isRealMessage = (message) => {
|
|
109
|
+
const normalizedContent = normalizeMessageContent(message.message);
|
|
110
|
+
const hasSomeContent = !!getContentType(normalizedContent);
|
|
111
|
+
return ((!!normalizedContent ||
|
|
112
|
+
REAL_MSG_STUB_TYPES.has(message.messageStubType) ||
|
|
113
|
+
REAL_MSG_REQ_ME_STUB_TYPES.has(message.messageStubType)) &&
|
|
114
|
+
hasSomeContent &&
|
|
115
|
+
!normalizedContent?.protocolMessage &&
|
|
116
|
+
!normalizedContent?.reactionMessage &&
|
|
117
|
+
!normalizedContent?.pollUpdateMessage);
|
|
118
|
+
};
|
|
119
|
+
export const shouldIncrementChatUnread = (message) => !message.key.fromMe && !message.messageStubType;
|
|
120
|
+
/**
|
|
121
|
+
* Get the ID of the chat from the given key.
|
|
122
|
+
* Typically -- that'll be the remoteJid, but for broadcasts, it'll be the participant
|
|
123
|
+
*/
|
|
124
|
+
export const getChatId = ({ remoteJid, participant, fromMe }) => {
|
|
125
|
+
if (!remoteJid) {
|
|
126
|
+
throw new Boom('Cannot derive chat id: message key is missing remoteJid', {
|
|
127
|
+
data: { remoteJid, participant, fromMe }
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (isJidBroadcast(remoteJid) && !isJidStatusBroadcast(remoteJid) && !fromMe) {
|
|
131
|
+
if (!participant) {
|
|
132
|
+
throw new Boom('Cannot derive chat id: broadcast message key is missing participant', {
|
|
133
|
+
data: { remoteJid, fromMe }
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return participant;
|
|
137
|
+
}
|
|
138
|
+
return remoteJid;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Decrypt a poll vote
|
|
142
|
+
* @param vote encrypted vote
|
|
143
|
+
* @param ctx additional info about the poll required for decryption
|
|
144
|
+
* @returns list of SHA256 options
|
|
145
|
+
*/
|
|
146
|
+
export function decryptPollVote({ encPayload, encIv }, { pollCreatorJid, pollMsgId, pollEncKey, voterJid }) {
|
|
147
|
+
const sign = Buffer.concat([
|
|
148
|
+
toBinary(pollMsgId),
|
|
149
|
+
toBinary(pollCreatorJid),
|
|
150
|
+
toBinary(voterJid),
|
|
151
|
+
toBinary('Poll Vote'),
|
|
152
|
+
new Uint8Array([1])
|
|
153
|
+
]);
|
|
154
|
+
const key0 = hmacSign(pollEncKey, new Uint8Array(32), 'sha256');
|
|
155
|
+
const decKey = hmacSign(sign, key0, 'sha256');
|
|
156
|
+
const aad = toBinary(`${pollMsgId}\u0000${voterJid}`);
|
|
157
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, aad);
|
|
158
|
+
return proto.Message.PollVoteMessage.decode(decrypted);
|
|
159
|
+
function toBinary(txt) {
|
|
160
|
+
return Buffer.from(txt);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Decrypt an event response
|
|
165
|
+
* @param response encrypted event response
|
|
166
|
+
* @param ctx additional info about the event required for decryption
|
|
167
|
+
* @returns event response message
|
|
168
|
+
*/
|
|
169
|
+
export function decryptEventResponse({ encPayload, encIv }, { eventCreatorJid, eventMsgId, eventEncKey, responderJid }) {
|
|
170
|
+
const sign = Buffer.concat([
|
|
171
|
+
toBinary(eventMsgId),
|
|
172
|
+
toBinary(eventCreatorJid),
|
|
173
|
+
toBinary(responderJid),
|
|
174
|
+
toBinary('Event Response'),
|
|
175
|
+
new Uint8Array([1])
|
|
176
|
+
]);
|
|
177
|
+
const key0 = hmacSign(eventEncKey, new Uint8Array(32), 'sha256');
|
|
178
|
+
const decKey = hmacSign(sign, key0, 'sha256');
|
|
179
|
+
const aad = toBinary(`${eventMsgId}\u0000${responderJid}`);
|
|
180
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, aad);
|
|
181
|
+
return proto.Message.EventResponseMessage.decode(decrypted);
|
|
182
|
+
function toBinary(txt) {
|
|
183
|
+
return Buffer.from(txt);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Decrypt a `secretEncryptedMessage` carrying a `MESSAGE_EDIT` payload.
|
|
188
|
+
*
|
|
189
|
+
* WhatsApp started wrapping message edits in an E2EE envelope (May 2026).
|
|
190
|
+
* The new content is encrypted with a key derived from the original
|
|
191
|
+
* message's `messageContextInfo.messageSecret` using HKDF-SHA256
|
|
192
|
+
* + AES-256-GCM, same family as polls and event responses but with
|
|
193
|
+
* different constants (validated against live WhatsApp Android traffic):
|
|
194
|
+
*
|
|
195
|
+
* info = msgId || origSenderJid || editorJid || "Message Edit"
|
|
196
|
+
* aad = (empty) <-- differs from Poll Vote / Event Response
|
|
197
|
+
* key = HKDF-SHA256(salt=zeros, ikm=messageSecret, info, L=32)
|
|
198
|
+
*
|
|
199
|
+
* The decrypted plaintext is a regular `proto.Message` whose
|
|
200
|
+
* `protocolMessage.editedMessage` field holds the new content — same
|
|
201
|
+
* shape as the legacy `protocolMessage.editedMessage` edit path, so
|
|
202
|
+
* consumers can treat the result identically.
|
|
203
|
+
*
|
|
204
|
+
* @param edit encrypted edit payload (encPayload + encIv from SecretEncryptedMessage)
|
|
205
|
+
* @param ctx info about the original message required for decryption
|
|
206
|
+
* @returns decoded outer `Message` whose `protocolMessage.editedMessage`
|
|
207
|
+
* carries the new content (extendedTextMessage / conversation / etc.)
|
|
208
|
+
*/
|
|
209
|
+
export function decryptMessageEdit({ encPayload, encIv }, { originalSenderJid, originalMsgId, editEncKey, editorJid }) {
|
|
210
|
+
const sign = Buffer.concat([
|
|
211
|
+
toBinary(originalMsgId),
|
|
212
|
+
toBinary(originalSenderJid),
|
|
213
|
+
toBinary(editorJid),
|
|
214
|
+
toBinary('Message Edit'),
|
|
215
|
+
new Uint8Array([1])
|
|
216
|
+
]);
|
|
217
|
+
const key0 = hmacSign(editEncKey, new Uint8Array(32), 'sha256');
|
|
218
|
+
const decKey = hmacSign(sign, key0, 'sha256');
|
|
219
|
+
// AAD is intentionally empty for MESSAGE_EDIT — unlike Poll Vote and
|
|
220
|
+
// Event Response, WA does not include `${msgId}\0${editor}` in the AAD here.
|
|
221
|
+
const aad = Buffer.alloc(0);
|
|
222
|
+
const decrypted = aesDecryptGCM(encPayload, decKey, encIv, aad);
|
|
223
|
+
return proto.Message.decode(decrypted);
|
|
224
|
+
function toBinary(txt) {
|
|
225
|
+
return Buffer.from(txt);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const buildEditUpdate = (args) => {
|
|
229
|
+
const editedInner = decryptMessageEdit({ encPayload: args.encPayload, encIv: args.encIv }, {
|
|
230
|
+
editEncKey: args.editEncKey,
|
|
231
|
+
originalSenderJid: args.originalSenderJid,
|
|
232
|
+
originalMsgId: args.originalMsgId,
|
|
233
|
+
editorJid: args.editorJid
|
|
234
|
+
});
|
|
235
|
+
const editProtocol = editedInner.protocolMessage;
|
|
236
|
+
const innerEdited = editProtocol?.editedMessage;
|
|
237
|
+
if (!innerEdited) {
|
|
238
|
+
args.logger?.warn({ targetKey: args.targetKey }, 'decrypted MESSAGE_EDIT plaintext had no protocolMessage.editedMessage — skipping update');
|
|
239
|
+
return null;
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
key: { ...args.messageKey, id: args.targetKeyId },
|
|
243
|
+
update: {
|
|
244
|
+
message: {
|
|
245
|
+
editedMessage: {
|
|
246
|
+
message: innerEdited
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
messageTimestamp: editProtocol?.timestampMs
|
|
250
|
+
? Math.floor(toNumber(editProtocol.timestampMs) / 1000)
|
|
251
|
+
: args.fallbackTimestamp
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
};
|
|
255
|
+
const processMessage = async (message, { shouldProcessHistoryMsg, placeholderResendCache, ev, creds, signalRepository, keyStore, logger, options, getMessage }) => {
|
|
256
|
+
const meId = creds.me.id;
|
|
257
|
+
const { accountSettings } = creds;
|
|
258
|
+
const chat = { id: jidNormalizedUser(getChatId(message.key)) };
|
|
259
|
+
const isRealMsg = isRealMessage(message);
|
|
260
|
+
if (isRealMsg) {
|
|
261
|
+
chat.messages = [{ message }];
|
|
262
|
+
chat.conversationTimestamp = toNumber(message.messageTimestamp);
|
|
263
|
+
// only increment unread count if not CIPHERTEXT and from another person
|
|
264
|
+
if (shouldIncrementChatUnread(message)) {
|
|
265
|
+
chat.unreadCount = (chat.unreadCount || 0) + 1;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
const content = normalizeMessageContent(message.message);
|
|
269
|
+
// unarchive chat if it's a real message, or someone reacted to our message
|
|
270
|
+
// and we've the unarchive chats setting on
|
|
271
|
+
if ((isRealMsg || content?.reactionMessage?.key?.fromMe) && accountSettings?.unarchiveChats) {
|
|
272
|
+
chat.archived = false;
|
|
273
|
+
chat.readOnly = false;
|
|
274
|
+
}
|
|
275
|
+
const protocolMsg = content?.protocolMessage;
|
|
276
|
+
if (protocolMsg) {
|
|
277
|
+
// Mirror whatsmeow's `handleProtocolMessage` guard, but applied only to
|
|
278
|
+
// the protocol message types that originate from our own device — an
|
|
279
|
+
// attacker could otherwise spoof any of these to manipulate local state.
|
|
280
|
+
//
|
|
281
|
+
// Self-only types (drop if `!fromMe`):
|
|
282
|
+
// - HISTORY_SYNC_NOTIFICATION (our phone driving history sync)
|
|
283
|
+
// - APP_STATE_SYNC_KEY_SHARE (key share between our devices)
|
|
284
|
+
// - LID_MIGRATION_MAPPING_SYNC (server-initiated via our phone)
|
|
285
|
+
// - PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE (response from our phone to our PDO request)
|
|
286
|
+
//
|
|
287
|
+
// Cross-user types (must NOT be dropped — legitimately arrive from others):
|
|
288
|
+
// - REVOKE
|
|
289
|
+
// - MESSAGE_EDIT
|
|
290
|
+
// - EPHEMERAL_SETTING
|
|
291
|
+
// - GROUP_MEMBER_LABEL_CHANGE
|
|
292
|
+
//
|
|
293
|
+
// See https://github.com/tulir/whatsmeow/blob/8d3700152a/message.go#L842-L845
|
|
294
|
+
// for the reference architecture — whatsmeow's `handleProtocolMessage`
|
|
295
|
+
// only contains self-only types because edits are unwrapped from
|
|
296
|
+
// `EditedMessage` BEFORE this dispatch and revokes aren't routed here.
|
|
297
|
+
const SELF_ONLY_TYPES = new Set([
|
|
298
|
+
proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION,
|
|
299
|
+
proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE,
|
|
300
|
+
proto.Message.ProtocolMessage.Type.LID_MIGRATION_MAPPING_SYNC,
|
|
301
|
+
proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE
|
|
302
|
+
]);
|
|
303
|
+
if (protocolMsg.type !== null &&
|
|
304
|
+
protocolMsg.type !== undefined &&
|
|
305
|
+
SELF_ONLY_TYPES.has(protocolMsg.type) &&
|
|
306
|
+
!message.key.fromMe) {
|
|
307
|
+
logger?.warn({ msgId: message.key.id, type: protocolMsg.type, from: message.key.participant || message.key.remoteJid }, 'dropping spoofed self-only protocolMessage from non-self origin');
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
switch (protocolMsg.type) {
|
|
311
|
+
case proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION:
|
|
312
|
+
const histNotification = protocolMsg.historySyncNotification;
|
|
313
|
+
const process = shouldProcessHistoryMsg;
|
|
314
|
+
const isLatest = !creds.processedHistoryMessages?.length;
|
|
315
|
+
logger?.info({
|
|
316
|
+
histNotification,
|
|
317
|
+
process,
|
|
318
|
+
id: message.key.id,
|
|
319
|
+
isLatest
|
|
320
|
+
}, 'got history notification');
|
|
321
|
+
if (process) {
|
|
322
|
+
// TODO: investigate
|
|
323
|
+
if (histNotification.syncType !== proto.HistorySync.HistorySyncType.ON_DEMAND) {
|
|
324
|
+
ev.emit('creds.update', {
|
|
325
|
+
processedHistoryMessages: [
|
|
326
|
+
...(creds.processedHistoryMessages || []),
|
|
327
|
+
{ key: message.key, messageTimestamp: message.messageTimestamp }
|
|
328
|
+
]
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
const data = await downloadAndProcessHistorySyncNotification(histNotification, options, logger);
|
|
332
|
+
if (data.lidPnMappings?.length) {
|
|
333
|
+
logger?.debug({ count: data.lidPnMappings.length }, 'processing LID-PN mappings from history sync');
|
|
334
|
+
await signalRepository.lidMapping
|
|
335
|
+
.storeLIDPNMappings(data.lidPnMappings)
|
|
336
|
+
.catch(err => logger?.warn({ err }, 'failed to store LID-PN mappings from history sync'));
|
|
337
|
+
}
|
|
338
|
+
await storeTcTokensFromHistorySync(data.chats, signalRepository, keyStore, logger);
|
|
339
|
+
ev.emit('messaging-history.set', {
|
|
340
|
+
...data,
|
|
341
|
+
isLatest: histNotification.syncType !== proto.HistorySync.HistorySyncType.ON_DEMAND ? isLatest : undefined,
|
|
342
|
+
chunkOrder: histNotification.chunkOrder,
|
|
343
|
+
peerDataRequestSessionId: histNotification.peerDataRequestSessionId
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
break;
|
|
347
|
+
case proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE:
|
|
348
|
+
const keys = protocolMsg.appStateSyncKeyShare.keys;
|
|
349
|
+
if (keys?.length) {
|
|
350
|
+
let newAppStateSyncKeyId = '';
|
|
351
|
+
await keyStore.transaction(async () => {
|
|
352
|
+
const newKeys = [];
|
|
353
|
+
for (const { keyData, keyId } of keys) {
|
|
354
|
+
const strKeyId = Buffer.from(keyId.keyId).toString('base64');
|
|
355
|
+
newKeys.push(strKeyId);
|
|
356
|
+
await keyStore.set({ 'app-state-sync-key': { [strKeyId]: keyData } });
|
|
357
|
+
newAppStateSyncKeyId = strKeyId;
|
|
358
|
+
}
|
|
359
|
+
logger?.info({ newAppStateSyncKeyId, newKeys }, 'injecting new app state sync keys');
|
|
360
|
+
}, meId);
|
|
361
|
+
ev.emit('creds.update', { myAppStateKeyId: newAppStateSyncKeyId });
|
|
362
|
+
}
|
|
363
|
+
else {
|
|
364
|
+
logger?.info({ protocolMsg }, 'recv app state sync with 0 keys');
|
|
365
|
+
}
|
|
366
|
+
break;
|
|
367
|
+
case proto.Message.ProtocolMessage.Type.REVOKE:
|
|
368
|
+
ev.emit('messages.update', [
|
|
369
|
+
{
|
|
370
|
+
key: {
|
|
371
|
+
...message.key,
|
|
372
|
+
id: protocolMsg.key.id
|
|
373
|
+
},
|
|
374
|
+
update: { message: null, messageStubType: WAMessageStubType.REVOKE, key: message.key }
|
|
375
|
+
}
|
|
376
|
+
]);
|
|
377
|
+
break;
|
|
378
|
+
case proto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING:
|
|
379
|
+
Object.assign(chat, {
|
|
380
|
+
ephemeralSettingTimestamp: toNumber(message.messageTimestamp),
|
|
381
|
+
ephemeralExpiration: protocolMsg.ephemeralExpiration || null
|
|
382
|
+
});
|
|
383
|
+
break;
|
|
384
|
+
case proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE:
|
|
385
|
+
const response = protocolMsg.peerDataOperationRequestResponseMessage;
|
|
386
|
+
if (response) {
|
|
387
|
+
// TODO: IMPLEMENT HISTORY SYNC ETC (sticker uploads etc.).
|
|
388
|
+
const peerDataOperationResult = response.peerDataOperationResult || [];
|
|
389
|
+
for (const result of peerDataOperationResult) {
|
|
390
|
+
const retryResponse = result?.placeholderMessageResendResponse;
|
|
391
|
+
//eslint-disable-next-line max-depth
|
|
392
|
+
if (!retryResponse?.webMessageInfoBytes) {
|
|
393
|
+
continue;
|
|
394
|
+
}
|
|
395
|
+
//eslint-disable-next-line max-depth
|
|
396
|
+
try {
|
|
397
|
+
const webMessageInfo = proto.WebMessageInfo.decode(retryResponse.webMessageInfoBytes);
|
|
398
|
+
const msgId = webMessageInfo.key?.id;
|
|
399
|
+
// Retrieve cached original message data (preserves LID details,
|
|
400
|
+
// timestamps, etc. that the phone may omit in its PDO response)
|
|
401
|
+
const cachedData = msgId ? await placeholderResendCache?.get(msgId) : undefined;
|
|
402
|
+
//eslint-disable-next-line max-depth
|
|
403
|
+
if (msgId) {
|
|
404
|
+
await placeholderResendCache?.del(msgId);
|
|
405
|
+
}
|
|
406
|
+
let finalMsg;
|
|
407
|
+
//eslint-disable-next-line max-depth
|
|
408
|
+
if (cachedData && typeof cachedData === 'object') {
|
|
409
|
+
// Apply decoded message content onto cached metadata (preserves LID etc.)
|
|
410
|
+
cachedData.message = webMessageInfo.message;
|
|
411
|
+
//eslint-disable-next-line max-depth
|
|
412
|
+
if (webMessageInfo.messageTimestamp) {
|
|
413
|
+
cachedData.messageTimestamp = webMessageInfo.messageTimestamp;
|
|
414
|
+
}
|
|
415
|
+
finalMsg = cachedData;
|
|
416
|
+
}
|
|
417
|
+
else {
|
|
418
|
+
finalMsg = webMessageInfo;
|
|
419
|
+
}
|
|
420
|
+
logger?.debug({ msgId, requestId: response.stanzaId }, 'received placeholder resend');
|
|
421
|
+
ev.emit('messages.upsert', {
|
|
422
|
+
messages: [finalMsg],
|
|
423
|
+
type: 'notify',
|
|
424
|
+
requestId: response.stanzaId
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
catch (err) {
|
|
428
|
+
logger?.warn({ err, stanzaId: response.stanzaId }, 'failed to decode placeholder resend response');
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
break;
|
|
433
|
+
case proto.Message.ProtocolMessage.Type.MESSAGE_EDIT:
|
|
434
|
+
ev.emit('messages.update', [
|
|
435
|
+
{
|
|
436
|
+
// flip the sender / fromMe properties because they're in the perspective of the sender
|
|
437
|
+
key: { ...message.key, id: protocolMsg.key?.id },
|
|
438
|
+
update: {
|
|
439
|
+
message: {
|
|
440
|
+
editedMessage: {
|
|
441
|
+
message: protocolMsg.editedMessage
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
messageTimestamp: protocolMsg.timestampMs
|
|
445
|
+
? Math.floor(toNumber(protocolMsg.timestampMs) / 1000)
|
|
446
|
+
: message.messageTimestamp
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
]);
|
|
450
|
+
break;
|
|
451
|
+
case proto.Message.ProtocolMessage.Type.GROUP_MEMBER_LABEL_CHANGE:
|
|
452
|
+
const labelAssociationMsg = protocolMsg.memberLabel;
|
|
453
|
+
if (labelAssociationMsg?.label) {
|
|
454
|
+
ev.emit('group.member-tag.update', {
|
|
455
|
+
groupId: chat.id,
|
|
456
|
+
label: labelAssociationMsg.label,
|
|
457
|
+
participant: message.key.participant,
|
|
458
|
+
participantAlt: message.key.participantAlt,
|
|
459
|
+
messageTimestamp: Number(message.messageTimestamp)
|
|
460
|
+
});
|
|
461
|
+
}
|
|
462
|
+
break;
|
|
463
|
+
case proto.Message.ProtocolMessage.Type.LID_MIGRATION_MAPPING_SYNC:
|
|
464
|
+
const encodedPayload = protocolMsg.lidMigrationMappingSyncMessage?.encodedMappingPayload;
|
|
465
|
+
const { pnToLidMappings, chatDbMigrationTimestamp } = proto.LIDMigrationMappingSyncPayload.decode(encodedPayload);
|
|
466
|
+
logger?.debug({ pnToLidMappings, chatDbMigrationTimestamp }, 'got lid mappings and chat db migration timestamp');
|
|
467
|
+
const pairs = [];
|
|
468
|
+
for (const { pn, latestLid, assignedLid } of pnToLidMappings) {
|
|
469
|
+
const lid = latestLid || assignedLid;
|
|
470
|
+
pairs.push({ lid: `${lid}@lid`, pn: `${pn}@s.whatsapp.net` });
|
|
471
|
+
}
|
|
472
|
+
await signalRepository.lidMapping.storeLIDPNMappings(pairs);
|
|
473
|
+
if (pairs.length) {
|
|
474
|
+
for (const { pn, lid } of pairs) {
|
|
475
|
+
await signalRepository.migrateSession(pn, lid);
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
else if (content?.reactionMessage) {
|
|
481
|
+
const reaction = {
|
|
482
|
+
...content.reactionMessage,
|
|
483
|
+
key: message.key
|
|
484
|
+
};
|
|
485
|
+
ev.emit('messages.reaction', [
|
|
486
|
+
{
|
|
487
|
+
reaction,
|
|
488
|
+
key: content.reactionMessage?.key
|
|
489
|
+
}
|
|
490
|
+
]);
|
|
491
|
+
}
|
|
492
|
+
else if (content?.encEventResponseMessage) {
|
|
493
|
+
const encEventResponse = content.encEventResponseMessage;
|
|
494
|
+
const creationMsgKey = encEventResponse.eventCreationMessageKey;
|
|
495
|
+
// we need to fetch the event creation message to get the event enc key
|
|
496
|
+
const eventMsg = await getMessage(creationMsgKey);
|
|
497
|
+
if (eventMsg) {
|
|
498
|
+
try {
|
|
499
|
+
const meIdNormalised = jidNormalizedUser(meId);
|
|
500
|
+
// all jids need to be PN
|
|
501
|
+
const eventCreatorKey = creationMsgKey.participant || creationMsgKey.remoteJid;
|
|
502
|
+
const eventCreatorPn = isLidUser(eventCreatorKey)
|
|
503
|
+
? await signalRepository.lidMapping.getPNForLID(eventCreatorKey)
|
|
504
|
+
: eventCreatorKey;
|
|
505
|
+
const eventCreatorJid = getKeyAuthor({ remoteJid: jidNormalizedUser(eventCreatorPn), fromMe: meIdNormalised === eventCreatorPn }, meIdNormalised);
|
|
506
|
+
const responderJid = getKeyAuthor(message.key, meIdNormalised);
|
|
507
|
+
const eventEncKey = eventMsg?.messageContextInfo?.messageSecret;
|
|
508
|
+
if (!eventEncKey) {
|
|
509
|
+
logger?.warn({ creationMsgKey }, 'event response: missing messageSecret for decryption');
|
|
510
|
+
}
|
|
511
|
+
else {
|
|
512
|
+
const responseMsg = decryptEventResponse(encEventResponse, {
|
|
513
|
+
eventEncKey,
|
|
514
|
+
eventCreatorJid,
|
|
515
|
+
eventMsgId: creationMsgKey.id,
|
|
516
|
+
responderJid
|
|
517
|
+
});
|
|
518
|
+
const eventResponse = {
|
|
519
|
+
eventResponseMessageKey: message.key,
|
|
520
|
+
senderTimestampMs: responseMsg.timestampMs,
|
|
521
|
+
response: responseMsg
|
|
522
|
+
};
|
|
523
|
+
ev.emit('messages.update', [
|
|
524
|
+
{
|
|
525
|
+
key: creationMsgKey,
|
|
526
|
+
update: {
|
|
527
|
+
eventResponses: [eventResponse]
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
]);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
catch (err) {
|
|
534
|
+
logger?.warn({ err, creationMsgKey }, 'failed to decrypt event response');
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
logger?.warn({ creationMsgKey }, 'event creation message not found, cannot decrypt response');
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
else if (content?.secretEncryptedMessage &&
|
|
542
|
+
content.secretEncryptedMessage.secretEncType === proto.Message.SecretEncryptedMessage.SecretEncType.MESSAGE_EDIT) {
|
|
543
|
+
// E2EE message edit envelope (new in 2026-05). Replaces the older
|
|
544
|
+
// `protocolMessage.editedMessage` path for direct text edits.
|
|
545
|
+
// We fetch the target message to obtain its `messageSecret`, derive the
|
|
546
|
+
// decryption key, and surface the decoded inner Message via the same
|
|
547
|
+
// `messages.update` event used by the legacy edit path so consumers do
|
|
548
|
+
// not need a new event type.
|
|
549
|
+
const secEnc = content.secretEncryptedMessage;
|
|
550
|
+
const targetKey = secEnc.targetMessageKey;
|
|
551
|
+
const targetMsg = await getMessage(targetKey);
|
|
552
|
+
if (targetMsg) {
|
|
553
|
+
try {
|
|
554
|
+
const meIdNormalised = jidNormalizedUser(meId);
|
|
555
|
+
const origSenderRaw = targetKey.participant || targetKey.remoteJid;
|
|
556
|
+
const origSenderPn = isLidUser(origSenderRaw)
|
|
557
|
+
? await signalRepository.lidMapping.getPNForLID(origSenderRaw)
|
|
558
|
+
: origSenderRaw;
|
|
559
|
+
const originalSenderJid = getKeyAuthor({ remoteJid: jidNormalizedUser(origSenderPn), fromMe: meIdNormalised === origSenderPn }, meIdNormalised);
|
|
560
|
+
const editorJid = getKeyAuthor(message.key, meIdNormalised);
|
|
561
|
+
const editEncKey = targetMsg?.messageContextInfo?.messageSecret;
|
|
562
|
+
if (!editEncKey) {
|
|
563
|
+
logger?.warn({ targetKey }, 'message edit: missing messageSecret on original message — cannot decrypt');
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const update = buildEditUpdate({
|
|
567
|
+
editEncKey,
|
|
568
|
+
encPayload: secEnc.encPayload,
|
|
569
|
+
encIv: secEnc.encIv,
|
|
570
|
+
originalSenderJid,
|
|
571
|
+
originalMsgId: targetKey.id,
|
|
572
|
+
editorJid,
|
|
573
|
+
messageKey: message.key,
|
|
574
|
+
targetKeyId: targetKey.id,
|
|
575
|
+
fallbackTimestamp: toNumber(message.messageTimestamp),
|
|
576
|
+
logger,
|
|
577
|
+
targetKey
|
|
578
|
+
});
|
|
579
|
+
if (update) {
|
|
580
|
+
ev.emit('messages.update', [update]);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
catch (err) {
|
|
584
|
+
logger?.warn({ err, targetKey }, 'failed to decrypt secretEncryptedMessage MESSAGE_EDIT');
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
else {
|
|
588
|
+
logger?.warn({ targetKey }, 'original message not found in store, cannot decrypt secretEncryptedMessage edit');
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
else if (message.messageStubType) {
|
|
592
|
+
const jid = message.key?.remoteJid;
|
|
593
|
+
//let actor = whatsappID (message.participant)
|
|
594
|
+
let participants;
|
|
595
|
+
const emitParticipantsUpdate = (action) => ev.emit('group-participants.update', {
|
|
596
|
+
id: jid,
|
|
597
|
+
author: message.key.participant,
|
|
598
|
+
authorPn: message.key.participantAlt,
|
|
599
|
+
authorUsername: message.key.participantUsername,
|
|
600
|
+
participants,
|
|
601
|
+
action
|
|
602
|
+
});
|
|
603
|
+
const emitGroupUpdate = (update) => {
|
|
604
|
+
ev.emit('groups.update', [
|
|
605
|
+
{
|
|
606
|
+
id: jid,
|
|
607
|
+
...update,
|
|
608
|
+
author: message.key.participant ?? undefined,
|
|
609
|
+
authorPn: message.key.participantAlt,
|
|
610
|
+
authorUsername: message.key.participantUsername
|
|
611
|
+
}
|
|
612
|
+
]);
|
|
613
|
+
};
|
|
614
|
+
const emitGroupRequestJoin = (participant, action, method) => {
|
|
615
|
+
ev.emit('group.join-request', {
|
|
616
|
+
id: jid,
|
|
617
|
+
author: message.key.participant,
|
|
618
|
+
authorPn: message.key.participantAlt,
|
|
619
|
+
authorUsername: message.key.participantUsername,
|
|
620
|
+
participant: participant.lid,
|
|
621
|
+
participantPn: participant.pn,
|
|
622
|
+
action,
|
|
623
|
+
method: method
|
|
624
|
+
});
|
|
625
|
+
};
|
|
626
|
+
const participantsIncludesMe = () => participants.find(jid => areJidsSameUser(meId, jid.phoneNumber)); // ADD SUPPORT FOR LID
|
|
627
|
+
switch (message.messageStubType) {
|
|
628
|
+
case WAMessageStubType.GROUP_PARTICIPANT_CHANGE_NUMBER:
|
|
629
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
630
|
+
emitParticipantsUpdate('modify');
|
|
631
|
+
break;
|
|
632
|
+
case WAMessageStubType.GROUP_PARTICIPANT_LEAVE:
|
|
633
|
+
case WAMessageStubType.GROUP_PARTICIPANT_REMOVE:
|
|
634
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
635
|
+
emitParticipantsUpdate('remove');
|
|
636
|
+
// mark the chat read only if you left the group
|
|
637
|
+
if (participantsIncludesMe()) {
|
|
638
|
+
chat.readOnly = true;
|
|
639
|
+
}
|
|
640
|
+
break;
|
|
641
|
+
case WAMessageStubType.GROUP_PARTICIPANT_ADD:
|
|
642
|
+
case WAMessageStubType.GROUP_PARTICIPANT_INVITE:
|
|
643
|
+
case WAMessageStubType.GROUP_PARTICIPANT_ADD_REQUEST_JOIN:
|
|
644
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
645
|
+
if (participantsIncludesMe()) {
|
|
646
|
+
chat.readOnly = false;
|
|
647
|
+
}
|
|
648
|
+
emitParticipantsUpdate('add');
|
|
649
|
+
break;
|
|
650
|
+
case WAMessageStubType.GROUP_PARTICIPANT_DEMOTE:
|
|
651
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
652
|
+
emitParticipantsUpdate('demote');
|
|
653
|
+
break;
|
|
654
|
+
case WAMessageStubType.GROUP_PARTICIPANT_PROMOTE:
|
|
655
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
656
|
+
emitParticipantsUpdate('promote');
|
|
657
|
+
break;
|
|
658
|
+
case WAMessageStubType.GROUP_CHANGE_ANNOUNCE:
|
|
659
|
+
const announceValue = message.messageStubParameters?.[0];
|
|
660
|
+
emitGroupUpdate({ announce: announceValue === 'true' || announceValue === 'on' });
|
|
661
|
+
break;
|
|
662
|
+
case WAMessageStubType.GROUP_CHANGE_RESTRICT:
|
|
663
|
+
const restrictValue = message.messageStubParameters?.[0];
|
|
664
|
+
emitGroupUpdate({ restrict: restrictValue === 'true' || restrictValue === 'on' });
|
|
665
|
+
break;
|
|
666
|
+
case WAMessageStubType.GROUP_CHANGE_SUBJECT:
|
|
667
|
+
const name = message.messageStubParameters?.[0];
|
|
668
|
+
chat.name = name;
|
|
669
|
+
emitGroupUpdate({ subject: name });
|
|
670
|
+
break;
|
|
671
|
+
case WAMessageStubType.GROUP_CHANGE_DESCRIPTION:
|
|
672
|
+
const description = message.messageStubParameters?.[0];
|
|
673
|
+
chat.description = description;
|
|
674
|
+
emitGroupUpdate({ desc: description });
|
|
675
|
+
break;
|
|
676
|
+
case WAMessageStubType.GROUP_CHANGE_INVITE_LINK:
|
|
677
|
+
const code = message.messageStubParameters?.[0];
|
|
678
|
+
emitGroupUpdate({ inviteCode: code });
|
|
679
|
+
break;
|
|
680
|
+
case WAMessageStubType.GROUP_MEMBER_ADD_MODE:
|
|
681
|
+
const memberAddValue = message.messageStubParameters?.[0];
|
|
682
|
+
emitGroupUpdate({ memberAddMode: memberAddValue === 'all_member_add' });
|
|
683
|
+
break;
|
|
684
|
+
case WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE:
|
|
685
|
+
const approvalMode = message.messageStubParameters?.[0];
|
|
686
|
+
emitGroupUpdate({ joinApprovalMode: approvalMode === 'on' });
|
|
687
|
+
break;
|
|
688
|
+
case WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD: // TODO: Add other events
|
|
689
|
+
const participant = JSON.parse(message.messageStubParameters?.[0]);
|
|
690
|
+
const action = message.messageStubParameters?.[1];
|
|
691
|
+
const method = message.messageStubParameters?.[2];
|
|
692
|
+
emitGroupRequestJoin(participant, action, method);
|
|
693
|
+
break;
|
|
694
|
+
}
|
|
695
|
+
} /* else if(content?.pollUpdateMessage) {
|
|
696
|
+
const creationMsgKey = content.pollUpdateMessage.pollCreationMessageKey!
|
|
697
|
+
// we need to fetch the poll creation message to get the poll enc key
|
|
698
|
+
// TODO: make standalone, remove getMessage reference
|
|
699
|
+
// TODO: Remove entirely
|
|
700
|
+
const pollMsg = await getMessage(creationMsgKey)
|
|
701
|
+
if(pollMsg) {
|
|
702
|
+
const meIdNormalised = jidNormalizedUser(meId)
|
|
703
|
+
const pollCreatorJid = getKeyAuthor(creationMsgKey, meIdNormalised)
|
|
704
|
+
const voterJid = getKeyAuthor(message.key, meIdNormalised)
|
|
705
|
+
const pollEncKey = pollMsg.messageContextInfo?.messageSecret!
|
|
706
|
+
|
|
707
|
+
try {
|
|
708
|
+
const voteMsg = decryptPollVote(
|
|
709
|
+
content.pollUpdateMessage.vote!,
|
|
710
|
+
{
|
|
711
|
+
pollEncKey,
|
|
712
|
+
pollCreatorJid,
|
|
713
|
+
pollMsgId: creationMsgKey.id!,
|
|
714
|
+
voterJid,
|
|
715
|
+
}
|
|
716
|
+
)
|
|
717
|
+
ev.emit('messages.update', [
|
|
718
|
+
{
|
|
719
|
+
key: creationMsgKey,
|
|
720
|
+
update: {
|
|
721
|
+
pollUpdates: [
|
|
722
|
+
{
|
|
723
|
+
pollUpdateMessageKey: message.key,
|
|
724
|
+
vote: voteMsg,
|
|
725
|
+
senderTimestampMs: (content.pollUpdateMessage.senderTimestampMs! as Long).toNumber(),
|
|
726
|
+
}
|
|
727
|
+
]
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
])
|
|
731
|
+
} catch(err) {
|
|
732
|
+
logger?.warn(
|
|
733
|
+
{ err, creationMsgKey },
|
|
734
|
+
'failed to decrypt poll vote'
|
|
735
|
+
)
|
|
736
|
+
}
|
|
737
|
+
} else {
|
|
738
|
+
logger?.warn(
|
|
739
|
+
{ creationMsgKey },
|
|
740
|
+
'poll creation message not found, cannot decrypt update'
|
|
741
|
+
)
|
|
742
|
+
}
|
|
743
|
+
} */
|
|
744
|
+
if (Object.keys(chat).length > 1) {
|
|
745
|
+
ev.emit('chats.update', [chat]);
|
|
746
|
+
}
|
|
747
|
+
};
|
|
748
|
+
export default processMessage;
|
|
749
|
+
//# sourceMappingURL=process-message.js.map
|