@eduh_dev021/baileys 0.0.0-stage → 1.1.0
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 +23 -0
- package/README.md +1843 -2
- package/WAProto/index.d.ts +22220 -0
- package/WAProto/index.js +5 -0
- package/cjs/WAProto/index.d.ts +22220 -0
- package/cjs/WAProto/index.js +60125 -0
- package/cjs/engine-requirements.js +12 -0
- package/cjs/lib/Addon/cache.js +179 -0
- package/cjs/lib/Addon/crc32.js +41 -0
- package/cjs/lib/Addon/file-type.js +217 -0
- package/cjs/lib/Addon/get-file.js +99 -0
- package/cjs/lib/Addon/http-error.d.ts +18 -0
- package/cjs/lib/Addon/http-error.js +66 -0
- package/cjs/lib/Addon/index.d.ts +96 -0
- package/cjs/lib/Addon/index.js +58 -0
- package/cjs/lib/Addon/keyed-db.d.ts +14 -0
- package/cjs/lib/Addon/keyed-db.js +264 -0
- package/cjs/lib/Addon/link-preview.d.ts +15 -0
- package/cjs/lib/Addon/link-preview.js +104 -0
- package/cjs/lib/Addon/media-info.js +98 -0
- package/cjs/lib/Addon/mutex.js +78 -0
- package/cjs/lib/Addon/qr.js +464 -0
- package/cjs/lib/Addon/queue.js +54 -0
- package/cjs/lib/Addon/waveform.js +130 -0
- package/cjs/lib/Addon/zip.js +136 -0
- package/cjs/lib/Defaults/index.d.ts +184 -0
- package/cjs/lib/Defaults/index.js +292 -0
- package/cjs/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/cjs/lib/Signal/Group/ciphertext-message.js +37 -0
- package/cjs/lib/Signal/Group/group-cipher.d.ts +10 -0
- package/cjs/lib/Signal/Group/group-cipher.js +105 -0
- package/cjs/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/cjs/lib/Signal/Group/group-session-builder.js +65 -0
- package/cjs/lib/Signal/Group/index.d.ts +11 -0
- package/cjs/lib/Signal/Group/index.js +67 -0
- package/cjs/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/cjs/lib/Signal/Group/keyhelper.js +47 -0
- package/cjs/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/cjs/lib/Signal/Group/sender-chain-key.js +51 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.js +80 -0
- package/cjs/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/cjs/lib/Signal/Group/sender-key-message.js +87 -0
- package/cjs/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/cjs/lib/Signal/Group/sender-key-name.js +73 -0
- package/cjs/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/cjs/lib/Signal/Group/sender-key-record.js +66 -0
- package/cjs/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/cjs/lib/Signal/Group/sender-key-state.js +106 -0
- package/cjs/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/cjs/lib/Signal/Group/sender-message-key.js +51 -0
- package/cjs/lib/Signal/libsignal.d.ts +54 -0
- package/cjs/lib/Signal/libsignal.js +421 -0
- package/cjs/lib/Signal/lid-mapping.d.ts +20 -0
- package/cjs/lib/Signal/lid-mapping.js +292 -0
- package/cjs/lib/Socket/Client/index.d.ts +2 -0
- package/cjs/lib/Socket/Client/index.js +23 -0
- package/cjs/lib/Socket/Client/types.d.ts +5 -0
- package/cjs/lib/Socket/Client/types.js +36 -0
- package/cjs/lib/Socket/Client/websocket.d.ts +12 -0
- package/cjs/lib/Socket/Client/websocket.js +143 -0
- package/cjs/lib/Socket/business.d.ts +387 -0
- package/cjs/lib/Socket/business.js +402 -0
- package/cjs/lib/Socket/chats.d.ts +144 -0
- package/cjs/lib/Socket/chats.js +1118 -0
- package/cjs/lib/Socket/communities.d.ts +554 -0
- package/cjs/lib/Socket/communities.js +456 -0
- package/cjs/lib/Socket/groups.d.ts +286 -0
- package/cjs/lib/Socket/groups.js +366 -0
- package/cjs/lib/Socket/index.d.ts +522 -0
- package/cjs/lib/Socket/index.js +32 -0
- package/cjs/lib/Socket/messages-recv.d.ts +326 -0
- package/cjs/lib/Socket/messages-recv.js +1670 -0
- package/cjs/lib/Socket/messages-send.d.ts +321 -0
- package/cjs/lib/Socket/messages-send.js +1252 -0
- package/cjs/lib/Socket/mex.d.ts +1 -0
- package/cjs/lib/Socket/mex.js +65 -0
- package/cjs/lib/Socket/newsletter.d.ts +283 -0
- package/cjs/lib/Socket/newsletter.js +243 -0
- package/cjs/lib/Socket/socket.d.ts +61 -0
- package/cjs/lib/Socket/socket.js +908 -0
- package/cjs/lib/Store/index.d.ts +3 -0
- package/cjs/lib/Store/index.js +25 -0
- package/cjs/lib/Store/make-in-memory-store.d.ts +63 -0
- package/cjs/lib/Store/make-in-memory-store.js +431 -0
- package/cjs/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/cjs/lib/Store/make-ordered-dictionary.js +101 -0
- package/cjs/lib/Store/object-repository.d.ts +10 -0
- package/cjs/lib/Store/object-repository.js +49 -0
- package/cjs/lib/Transport/crypto.d.ts +6 -0
- package/cjs/lib/Transport/crypto.js +107 -0
- package/cjs/lib/Transport/curve.d.ts +8 -0
- package/cjs/lib/Transport/curve.js +94 -0
- package/cjs/lib/Transport/index.d.ts +16 -0
- package/cjs/lib/Transport/index.js +67 -0
- package/cjs/lib/Transport/internals.d.ts +57 -0
- package/cjs/lib/Transport/internals.js +203 -0
- package/cjs/lib/Transport/session-builder.d.ts +40 -0
- package/cjs/lib/Transport/session-builder.js +169 -0
- package/cjs/lib/Transport/session-cipher.d.ts +26 -0
- package/cjs/lib/Transport/session-cipher.js +328 -0
- package/cjs/lib/Transport/session-record.d.ts +55 -0
- package/cjs/lib/Transport/session-record.js +289 -0
- package/cjs/lib/Types/Auth.d.ts +1 -0
- package/cjs/lib/Types/Auth.js +15 -0
- package/cjs/lib/Types/Bussines.d.ts +1 -0
- package/cjs/lib/Types/Bussines.js +15 -0
- package/cjs/lib/Types/Call.d.ts +1 -0
- package/cjs/lib/Types/Call.js +15 -0
- package/cjs/lib/Types/Chat.d.ts +1 -0
- package/cjs/lib/Types/Chat.js +33 -0
- package/cjs/lib/Types/Contact.d.ts +1 -0
- package/cjs/lib/Types/Contact.js +15 -0
- package/cjs/lib/Types/Events.d.ts +1 -0
- package/cjs/lib/Types/Events.js +1 -0
- package/cjs/lib/Types/GroupMetadata.d.ts +1 -0
- package/cjs/lib/Types/GroupMetadata.js +15 -0
- package/cjs/lib/Types/Label.d.ts +2 -0
- package/cjs/lib/Types/Label.js +49 -0
- package/cjs/lib/Types/LabelAssociation.d.ts +2 -0
- package/cjs/lib/Types/LabelAssociation.js +31 -0
- package/cjs/lib/Types/Message.d.ts +11 -0
- package/cjs/lib/Types/Message.js +58 -0
- package/cjs/lib/Types/Mex.d.ts +2 -0
- package/cjs/lib/Types/Mex.js +66 -0
- package/cjs/lib/Types/Product.d.ts +1 -0
- package/cjs/lib/Types/Product.js +15 -0
- package/cjs/lib/Types/RichType.d.ts +2 -0
- package/cjs/lib/Types/RichType.js +50 -0
- package/cjs/lib/Types/Signal.d.ts +1 -0
- package/cjs/lib/Types/Signal.js +1 -0
- package/cjs/lib/Types/Socket.d.ts +1 -0
- package/cjs/lib/Types/Socket.js +1 -0
- package/cjs/lib/Types/State.d.ts +5 -0
- package/cjs/lib/Types/State.js +83 -0
- package/cjs/lib/Types/USync.d.ts +1 -0
- package/cjs/lib/Types/USync.js +1 -0
- package/cjs/lib/Types/index.d.ts +13 -0
- package/cjs/lib/Types/index.js +64 -0
- package/cjs/lib/Utils/auth-utils.d.ts +58 -0
- package/cjs/lib/Utils/auth-utils.js +275 -0
- package/cjs/lib/Utils/browser-utils.d.ts +9 -0
- package/cjs/lib/Utils/browser-utils.js +56 -0
- package/cjs/lib/Utils/business.d.ts +49 -0
- package/cjs/lib/Utils/business.js +259 -0
- package/cjs/lib/Utils/chat-utils.d.ts +408 -0
- package/cjs/lib/Utils/chat-utils.js +821 -0
- package/cjs/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/cjs/lib/Utils/companion-reg-client-utils.js +71 -0
- package/cjs/lib/Utils/crypto.d.ts +39 -0
- package/cjs/lib/Utils/crypto.js +155 -0
- package/cjs/lib/Utils/decode-wa-message.d.ts +83 -0
- package/cjs/lib/Utils/decode-wa-message.js +316 -0
- package/cjs/lib/Utils/event-buffer.d.ts +12 -0
- package/cjs/lib/Utils/event-buffer.js +605 -0
- package/cjs/lib/Utils/generics.d.ts +63 -0
- package/cjs/lib/Utils/generics.js +440 -0
- package/cjs/lib/Utils/history.d.ts +75 -0
- package/cjs/lib/Utils/history.js +153 -0
- package/cjs/lib/Utils/identity-change-handler.d.ts +13 -0
- package/cjs/lib/Utils/identity-change-handler.js +73 -0
- package/cjs/lib/Utils/index.d.ts +24 -0
- package/cjs/lib/Utils/index.js +67 -0
- package/cjs/lib/Utils/link-preview.d.ts +13 -0
- package/cjs/lib/Utils/link-preview.js +87 -0
- package/cjs/lib/Utils/logger.d.ts +12 -0
- package/cjs/lib/Utils/logger.js +40 -0
- package/cjs/lib/Utils/lt-hash.d.ts +6 -0
- package/cjs/lib/Utils/lt-hash.js +28 -0
- package/cjs/lib/Utils/make-mutex.d.ts +6 -0
- package/cjs/lib/Utils/make-mutex.js +58 -0
- package/cjs/lib/Utils/message-retry-manager.d.ts +79 -0
- package/cjs/lib/Utils/message-retry-manager.js +274 -0
- package/cjs/lib/Utils/messages-media.d.ts +134 -0
- package/cjs/lib/Utils/messages-media.js +799 -0
- package/cjs/lib/Utils/messages.d.ts +47 -0
- package/cjs/lib/Utils/messages.js +1667 -0
- package/cjs/lib/Utils/noise-handler.d.ts +20 -0
- package/cjs/lib/Utils/noise-handler.js +223 -0
- package/cjs/lib/Utils/offline-node-processor.d.ts +10 -0
- package/cjs/lib/Utils/offline-node-processor.js +60 -0
- package/cjs/lib/Utils/pre-key-manager.d.ts +25 -0
- package/cjs/lib/Utils/pre-key-manager.js +116 -0
- package/cjs/lib/Utils/process-message.d.ts +83 -0
- package/cjs/lib/Utils/process-message.js +607 -0
- package/cjs/lib/Utils/reporting-utils.d.ts +12 -0
- package/cjs/lib/Utils/reporting-utils.js +282 -0
- package/cjs/lib/Utils/rich-message-utils.d.ts +48 -0
- package/cjs/lib/Utils/rich-message-utils.js +381 -0
- package/cjs/lib/Utils/signal.d.ts +82 -0
- package/cjs/lib/Utils/signal.js +232 -0
- package/cjs/lib/Utils/stanza-ack.d.ts +16 -0
- package/cjs/lib/Utils/stanza-ack.js +53 -0
- package/cjs/lib/Utils/sync-action-utils.d.ts +2 -0
- package/cjs/lib/Utils/sync-action-utils.js +68 -0
- package/cjs/lib/Utils/tc-token-utils.d.ts +29 -0
- package/cjs/lib/Utils/tc-token-utils.js +182 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.js +135 -0
- package/cjs/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/cjs/lib/Utils/use-single-file-auth-state.js +115 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.js +140 -0
- package/cjs/lib/Utils/validate-connection.d.ts +44 -0
- package/cjs/lib/Utils/validate-connection.js +229 -0
- package/cjs/lib/WABinary/constants.d.ts +61 -0
- package/cjs/lib/WABinary/constants.js +1992 -0
- package/cjs/lib/WABinary/decode.d.ts +9 -0
- package/cjs/lib/WABinary/decode.js +292 -0
- package/cjs/lib/WABinary/encode.d.ts +2 -0
- package/cjs/lib/WABinary/encode.js +240 -0
- package/cjs/lib/WABinary/generic-utils.d.ts +79 -0
- package/cjs/lib/WABinary/generic-utils.js +252 -0
- package/cjs/lib/WABinary/index.d.ts +5 -0
- package/cjs/lib/WABinary/index.js +29 -0
- package/cjs/lib/WABinary/jid-utils.d.ts +28 -0
- package/cjs/lib/WABinary/jid-utils.js +151 -0
- package/cjs/lib/WABinary/types.d.ts +1 -0
- package/cjs/lib/WABinary/types.js +23 -0
- package/cjs/lib/WACrypto/appstate-keys.js +39 -0
- package/cjs/lib/WACrypto/curves/constants.js +37 -0
- package/cjs/lib/WACrypto/hkdf.js +38 -0
- package/cjs/lib/WACrypto/index.js +51 -0
- package/cjs/lib/WACrypto/lthash.js +59 -0
- package/cjs/lib/WACrypto/math/constants.js +53 -0
- package/cjs/lib/WACrypto/math/edwards.js +206 -0
- package/cjs/lib/WACrypto/math/fe.js +449 -0
- package/cjs/lib/WACrypto/math/le.js +44 -0
- package/cjs/lib/WACrypto/math/mod.js +36 -0
- package/cjs/lib/WACrypto/util/bytes.js +348 -0
- package/cjs/lib/WACrypto/x25519.js +157 -0
- package/cjs/lib/WACrypto/xeddsa.js +134 -0
- package/cjs/lib/WAM/BinaryInfo.d.ts +7 -0
- package/cjs/lib/WAM/BinaryInfo.js +35 -0
- package/cjs/lib/WAM/constants.d.ts +34926 -0
- package/cjs/lib/WAM/constants.js +22890 -0
- package/cjs/lib/WAM/encode.d.ts +1 -0
- package/cjs/lib/WAM/encode.js +162 -0
- package/cjs/lib/WAM/index.d.ts +3 -0
- package/cjs/lib/WAM/index.js +25 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.js +77 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.js +76 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +52 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.js +61 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.js +50 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +76 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.js +53 -0
- package/cjs/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/cjs/lib/WAUSync/Protocols/index.js +29 -0
- package/cjs/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/cjs/lib/WAUSync/USyncQuery.js +113 -0
- package/cjs/lib/WAUSync/USyncUser.d.ts +16 -0
- package/cjs/lib/WAUSync/USyncUser.js +56 -0
- package/cjs/lib/WAUSync/index.d.ts +3 -0
- package/cjs/lib/WAUSync/index.js +25 -0
- package/cjs/lib/index.d.ts +11 -0
- package/cjs/lib/index.js +56 -0
- package/cjs/package.json +3 -0
- package/engine-requirements.js +12 -0
- package/lib/Addon/cache.js +201 -0
- package/lib/Addon/crc32.js +21 -0
- package/lib/Addon/file-type.js +198 -0
- package/lib/Addon/get-file.js +98 -0
- package/lib/Addon/http-error.d.ts +18 -0
- package/lib/Addon/http-error.js +40 -0
- package/lib/Addon/index.d.ts +96 -0
- package/lib/Addon/index.js +26 -0
- package/lib/Addon/keyed-db.d.ts +14 -0
- package/lib/Addon/keyed-db.js +241 -0
- package/lib/Addon/link-preview.d.ts +15 -0
- package/lib/Addon/link-preview.js +79 -0
- package/lib/Addon/media-info.js +96 -0
- package/lib/Addon/mutex.js +76 -0
- package/lib/Addon/qr.js +531 -0
- package/lib/Addon/queue.js +44 -0
- package/lib/Addon/waveform.js +135 -0
- package/lib/Addon/zip.js +144 -0
- package/lib/Defaults/index.d.ts +184 -0
- package/lib/Defaults/index.js +181 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +11 -0
- package/lib/Signal/Group/group-cipher.d.ts +10 -0
- package/lib/Signal/Group/group-cipher.js +81 -0
- package/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/lib/Signal/Group/group-session-builder.js +29 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +11 -0
- package/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/lib/Signal/Group/keyhelper.js +17 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +25 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +65 -0
- package/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/lib/Signal/Group/sender-key-name.js +47 -0
- package/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/lib/Signal/Group/sender-key-record.js +40 -0
- package/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/lib/Signal/Group/sender-key-state.js +83 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +25 -0
- package/lib/Signal/libsignal.d.ts +54 -0
- package/lib/Signal/libsignal.js +426 -0
- package/lib/Signal/lid-mapping.d.ts +20 -0
- package/lib/Signal/lid-mapping.js +274 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +2 -0
- package/lib/Socket/Client/types.d.ts +5 -0
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +119 -0
- package/lib/Socket/business.d.ts +387 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.d.ts +144 -0
- package/lib/Socket/chats.js +1216 -0
- package/lib/Socket/communities.d.ts +554 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/groups.d.ts +286 -0
- package/lib/Socket/groups.js +347 -0
- package/lib/Socket/index.d.ts +522 -0
- package/lib/Socket/index.js +11 -0
- package/lib/Socket/messages-recv.d.ts +326 -0
- package/lib/Socket/messages-recv.js +1822 -0
- package/lib/Socket/messages-send.d.ts +321 -0
- package/lib/Socket/messages-send.js +1378 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.d.ts +283 -0
- package/lib/Socket/newsletter.js +225 -0
- package/lib/Socket/socket.d.ts +61 -0
- package/lib/Socket/socket.js +992 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +3 -0
- package/lib/Store/make-in-memory-store.d.ts +63 -0
- package/lib/Store/make-in-memory-store.js +419 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/make-ordered-dictionary.js +78 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +23 -0
- package/lib/Transport/crypto.d.ts +6 -0
- package/lib/Transport/crypto.js +61 -0
- package/lib/Transport/curve.d.ts +8 -0
- package/lib/Transport/curve.js +66 -0
- package/lib/Transport/index.d.ts +16 -0
- package/lib/Transport/index.js +9 -0
- package/lib/Transport/internals.d.ts +57 -0
- package/lib/Transport/internals.js +155 -0
- package/lib/Transport/session-builder.d.ts +40 -0
- package/lib/Transport/session-builder.js +143 -0
- package/lib/Transport/session-cipher.d.ts +26 -0
- package/lib/Transport/session-cipher.js +301 -0
- package/lib/Transport/session-record.d.ts +55 -0
- package/lib/Transport/session-record.js +272 -0
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.d.ts +1 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.d.ts +1 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.js +7 -0
- package/lib/Types/Contact.d.ts +1 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +1 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +1 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/Label.js +24 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/LabelAssociation.js +6 -0
- package/lib/Types/Message.d.ts +11 -0
- package/lib/Types/Message.js +17 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Mex.js +38 -0
- package/lib/Types/Product.d.ts +1 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/RichType.d.ts +2 -0
- package/lib/Types/RichType.js +22 -0
- package/lib/Types/Signal.d.ts +1 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +1 -0
- package/lib/Types/Socket.js +1 -0
- package/lib/Types/State.d.ts +5 -0
- package/lib/Types/State.js +54 -0
- package/lib/Types/USync.d.ts +1 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +13 -0
- package/lib/Types/index.js +25 -0
- package/lib/Utils/auth-utils.d.ts +58 -0
- package/lib/Utils/auth-utils.js +316 -0
- package/lib/Utils/browser-utils.d.ts +9 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.d.ts +49 -0
- package/lib/Utils/business.js +230 -0
- package/lib/Utils/chat-utils.d.ts +408 -0
- package/lib/Utils/chat-utils.js +871 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/lib/Utils/companion-reg-client-utils.js +39 -0
- package/lib/Utils/crypto.d.ts +39 -0
- package/lib/Utils/crypto.js +117 -0
- package/lib/Utils/decode-wa-message.d.ts +83 -0
- package/lib/Utils/decode-wa-message.js +316 -0
- package/lib/Utils/event-buffer.d.ts +12 -0
- package/lib/Utils/event-buffer.js +621 -0
- package/lib/Utils/generics.d.ts +63 -0
- package/lib/Utils/generics.js +394 -0
- package/lib/Utils/history.d.ts +75 -0
- package/lib/Utils/history.js +133 -0
- package/lib/Utils/identity-change-handler.d.ts +13 -0
- package/lib/Utils/identity-change-handler.js +48 -0
- package/lib/Utils/index.d.ts +24 -0
- package/lib/Utils/index.js +24 -0
- package/lib/Utils/link-preview.d.ts +13 -0
- package/lib/Utils/link-preview.js +73 -0
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.js +12 -0
- package/lib/Utils/lt-hash.d.ts +6 -0
- package/lib/Utils/lt-hash.js +7 -0
- package/lib/Utils/make-mutex.d.ts +6 -0
- package/lib/Utils/make-mutex.js +32 -0
- package/lib/Utils/message-retry-manager.d.ts +79 -0
- package/lib/Utils/message-retry-manager.js +259 -0
- package/lib/Utils/messages-media.d.ts +134 -0
- package/lib/Utils/messages-media.js +802 -0
- package/lib/Utils/messages.d.ts +47 -0
- package/lib/Utils/messages.js +1907 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +200 -0
- package/lib/Utils/offline-node-processor.d.ts +10 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/pre-key-manager.d.ts +25 -0
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.d.ts +83 -0
- package/lib/Utils/process-message.js +748 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-message-utils.d.ts +48 -0
- package/lib/Utils/rich-message-utils.js +366 -0
- package/lib/Utils/signal.d.ts +82 -0
- package/lib/Utils/signal.js +200 -0
- package/lib/Utils/stanza-ack.d.ts +16 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/sync-action-utils.d.ts +2 -0
- package/lib/Utils/sync-action-utils.js +48 -0
- package/lib/Utils/tc-token-utils.d.ts +29 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-multi-file-auth-state.js +116 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-single-file-auth-state.js +94 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.js +109 -0
- package/lib/Utils/validate-connection.d.ts +44 -0
- package/lib/Utils/validate-connection.js +210 -0
- package/lib/WABinary/constants.d.ts +61 -0
- package/lib/WABinary/constants.js +1466 -0
- package/lib/WABinary/decode.d.ts +9 -0
- package/lib/WABinary/decode.js +261 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +219 -0
- package/lib/WABinary/generic-utils.d.ts +79 -0
- package/lib/WABinary/generic-utils.js +226 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +5 -0
- package/lib/WABinary/jid-utils.d.ts +28 -0
- package/lib/WABinary/jid-utils.js +95 -0
- package/lib/WABinary/types.d.ts +1 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WACrypto/appstate-keys.js +26 -0
- package/lib/WACrypto/curves/constants.js +12 -0
- package/lib/WACrypto/hkdf.js +27 -0
- package/lib/WACrypto/index.js +20 -0
- package/lib/WACrypto/lthash.js +54 -0
- package/lib/WACrypto/math/constants.js +24 -0
- package/lib/WACrypto/math/edwards.js +194 -0
- package/lib/WACrypto/math/fe.js +698 -0
- package/lib/WACrypto/math/le.js +23 -0
- package/lib/WACrypto/math/mod.js +15 -0
- package/lib/WACrypto/util/bytes.js +339 -0
- package/lib/WACrypto/x25519.js +145 -0
- package/lib/WACrypto/xeddsa.js +92 -0
- package/lib/WAM/BinaryInfo.d.ts +7 -0
- package/lib/WAM/BinaryInfo.js +9 -0
- package/lib/WAM/constants.d.ts +34926 -0
- package/lib/WAM/constants.js +22852 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +149 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +51 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/lib/WAUSync/Protocols/index.js +5 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncQuery.js +97 -0
- package/lib/WAUSync/USyncUser.d.ts +16 -0
- package/lib/WAUSync/USyncUser.js +30 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +11 -0
- package/package.json +74 -5
- package/tests/addon-test.mjs +162 -0
- package/tests/differential-test.mjs +90 -0
|
@@ -0,0 +1,607 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var process_message_exports = {};
|
|
19
|
+
__export(process_message_exports, {
|
|
20
|
+
cleanMessage: () => cleanMessage,
|
|
21
|
+
decryptEventResponse: () => decryptEventResponse,
|
|
22
|
+
decryptMessageEdit: () => decryptMessageEdit,
|
|
23
|
+
decryptPollVote: () => decryptPollVote,
|
|
24
|
+
default: () => process_message_default,
|
|
25
|
+
getChatId: () => getChatId,
|
|
26
|
+
isRealMessage: () => isRealMessage,
|
|
27
|
+
shouldIncrementChatUnread: () => shouldIncrementChatUnread
|
|
28
|
+
});
|
|
29
|
+
module.exports = __toCommonJS(process_message_exports);
|
|
30
|
+
var import_WAProto = require("../../WAProto/index.js");
|
|
31
|
+
var import_Addon = require("../Addon/index.js");
|
|
32
|
+
var import_Types = require("../Types/index.js");
|
|
33
|
+
var import_messages = require("../Utils/messages.js");
|
|
34
|
+
var import_WABinary = require("../WABinary/index.js");
|
|
35
|
+
var import_crypto = require("./crypto.js");
|
|
36
|
+
var import_generics = require("./generics.js");
|
|
37
|
+
var import_history = require("./history.js");
|
|
38
|
+
var import_tc_token_utils = require("./tc-token-utils.js");
|
|
39
|
+
const REAL_MSG_STUB_TYPES = /* @__PURE__ */ new Set([
|
|
40
|
+
import_Types.WAMessageStubType.CALL_MISSED_GROUP_VIDEO,
|
|
41
|
+
import_Types.WAMessageStubType.CALL_MISSED_GROUP_VOICE,
|
|
42
|
+
import_Types.WAMessageStubType.CALL_MISSED_VIDEO,
|
|
43
|
+
import_Types.WAMessageStubType.CALL_MISSED_VOICE
|
|
44
|
+
]);
|
|
45
|
+
const REAL_MSG_REQ_ME_STUB_TYPES = /* @__PURE__ */ new Set([import_Types.WAMessageStubType.GROUP_PARTICIPANT_ADD]);
|
|
46
|
+
async function storeTcTokensFromHistorySync(chats, signalRepository, keyStore, logger) {
|
|
47
|
+
const getLIDForPN = signalRepository.lidMapping.getLIDForPN.bind(signalRepository.lidMapping);
|
|
48
|
+
const candidates = [];
|
|
49
|
+
for (const chat of chats) {
|
|
50
|
+
const ts = chat.tcTokenTimestamp ? (0, import_generics.toNumber)(chat.tcTokenTimestamp) : 0;
|
|
51
|
+
if (chat.tcToken?.length && ts > 0) {
|
|
52
|
+
const jid = (0, import_WABinary.jidNormalizedUser)(chat.id);
|
|
53
|
+
const storageJid = await (0, import_tc_token_utils.resolveTcTokenJid)(jid, getLIDForPN);
|
|
54
|
+
candidates.push({
|
|
55
|
+
storageJid,
|
|
56
|
+
token: Buffer.from(chat.tcToken),
|
|
57
|
+
ts,
|
|
58
|
+
senderTs: chat.tcTokenSenderTimestamp ? (0, import_generics.toNumber)(chat.tcTokenSenderTimestamp) : void 0
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (!candidates.length) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const jids = candidates.map((c) => c.storageJid);
|
|
66
|
+
const existing = await keyStore.get("tctoken", jids);
|
|
67
|
+
const entries = {};
|
|
68
|
+
for (const c of candidates) {
|
|
69
|
+
const existingEntry = existing[c.storageJid];
|
|
70
|
+
const existingTs = existingEntry?.timestamp ? Number(existingEntry.timestamp) : 0;
|
|
71
|
+
if (existingTs > 0 && existingTs >= c.ts) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
entries[c.storageJid] = {
|
|
75
|
+
...existingEntry,
|
|
76
|
+
token: c.token,
|
|
77
|
+
timestamp: String(c.ts),
|
|
78
|
+
...c.senderTs !== void 0 ? { senderTimestamp: c.senderTs } : {}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (Object.keys(entries).length) {
|
|
82
|
+
logger?.debug({ count: Object.keys(entries).length }, "storing tctokens from history sync");
|
|
83
|
+
try {
|
|
84
|
+
const indexWrite = await (0, import_tc_token_utils.buildMergedTcTokenIndexWrite)(keyStore, Object.keys(entries));
|
|
85
|
+
await keyStore.set({ tctoken: { ...entries, ...indexWrite } });
|
|
86
|
+
} catch (err) {
|
|
87
|
+
logger?.warn({ err }, "failed to store tctokens from history sync");
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const cleanMessage = (message, meId, meLid) => {
|
|
92
|
+
if ((0, import_WABinary.isHostedPnUser)(message.key.remoteJid) || (0, import_WABinary.isHostedLidUser)(message.key.remoteJid)) {
|
|
93
|
+
message.key.remoteJid = (0, import_WABinary.jidEncode)((0, import_WABinary.jidDecode)(message.key?.remoteJid)?.user, (0, import_WABinary.isHostedPnUser)(message.key.remoteJid) ? "s.whatsapp.net" : "lid");
|
|
94
|
+
} else {
|
|
95
|
+
message.key.remoteJid = (0, import_WABinary.jidNormalizedUser)(message.key.remoteJid);
|
|
96
|
+
}
|
|
97
|
+
if ((0, import_WABinary.isHostedPnUser)(message.key.participant) || (0, import_WABinary.isHostedLidUser)(message.key.participant)) {
|
|
98
|
+
message.key.participant = (0, import_WABinary.jidEncode)((0, import_WABinary.jidDecode)(message.key.participant)?.user, (0, import_WABinary.isHostedPnUser)(message.key.participant) ? "s.whatsapp.net" : "lid");
|
|
99
|
+
} else {
|
|
100
|
+
message.key.participant = (0, import_WABinary.jidNormalizedUser)(message.key.participant);
|
|
101
|
+
}
|
|
102
|
+
const content = (0, import_messages.normalizeMessageContent)(message.message);
|
|
103
|
+
if (content?.reactionMessage) {
|
|
104
|
+
normaliseKey(content.reactionMessage.key);
|
|
105
|
+
}
|
|
106
|
+
if (content?.pollUpdateMessage) {
|
|
107
|
+
normaliseKey(content.pollUpdateMessage.pollCreationMessageKey);
|
|
108
|
+
}
|
|
109
|
+
function normaliseKey(msgKey) {
|
|
110
|
+
if (!message.key.fromMe) {
|
|
111
|
+
msgKey.fromMe = !msgKey.fromMe ? (0, import_WABinary.areJidsSameUser)(msgKey.participant || msgKey.remoteJid, meId) || (0, import_WABinary.areJidsSameUser)(msgKey.participant || msgKey.remoteJid, meLid) : (
|
|
112
|
+
// if the message being reacted to, was from them
|
|
113
|
+
// fromMe automatically becomes false
|
|
114
|
+
false
|
|
115
|
+
);
|
|
116
|
+
msgKey.remoteJid = message.key.remoteJid;
|
|
117
|
+
msgKey.participant = msgKey.participant || message.key.participant;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const isRealMessage = (message) => {
|
|
122
|
+
const normalizedContent = (0, import_messages.normalizeMessageContent)(message.message);
|
|
123
|
+
const hasSomeContent = !!(0, import_messages.getContentType)(normalizedContent);
|
|
124
|
+
return (!!normalizedContent || REAL_MSG_STUB_TYPES.has(message.messageStubType) || REAL_MSG_REQ_ME_STUB_TYPES.has(message.messageStubType)) && hasSomeContent && !normalizedContent?.protocolMessage && !normalizedContent?.reactionMessage && !normalizedContent?.pollUpdateMessage;
|
|
125
|
+
};
|
|
126
|
+
const shouldIncrementChatUnread = (message) => !message.key.fromMe && !message.messageStubType;
|
|
127
|
+
const getChatId = ({ remoteJid, participant, fromMe }) => {
|
|
128
|
+
if (!remoteJid) {
|
|
129
|
+
throw new import_Addon.HttpError("Cannot derive chat id: message key is missing remoteJid", {
|
|
130
|
+
data: { remoteJid, participant, fromMe }
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if ((0, import_WABinary.isJidBroadcast)(remoteJid) && !(0, import_WABinary.isJidStatusBroadcast)(remoteJid) && !fromMe) {
|
|
134
|
+
if (!participant) {
|
|
135
|
+
throw new import_Addon.HttpError("Cannot derive chat id: broadcast message key is missing participant", {
|
|
136
|
+
data: { remoteJid, fromMe }
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return participant;
|
|
140
|
+
}
|
|
141
|
+
return remoteJid;
|
|
142
|
+
};
|
|
143
|
+
function decryptPollVote({ encPayload, encIv }, { pollCreatorJid, pollMsgId, pollEncKey, voterJid }) {
|
|
144
|
+
const sign = Buffer.concat([
|
|
145
|
+
toBinary(pollMsgId),
|
|
146
|
+
toBinary(pollCreatorJid),
|
|
147
|
+
toBinary(voterJid),
|
|
148
|
+
toBinary("Poll Vote"),
|
|
149
|
+
new Uint8Array([1])
|
|
150
|
+
]);
|
|
151
|
+
const key0 = (0, import_crypto.hmacSign)(pollEncKey, new Uint8Array(32), "sha256");
|
|
152
|
+
const decKey = (0, import_crypto.hmacSign)(sign, key0, "sha256");
|
|
153
|
+
const aad = toBinary(`${pollMsgId}\0${voterJid}`);
|
|
154
|
+
const decrypted = (0, import_crypto.aesDecryptGCM)(encPayload, decKey, encIv, aad);
|
|
155
|
+
return import_WAProto.proto.Message.PollVoteMessage.decode(decrypted);
|
|
156
|
+
function toBinary(txt) {
|
|
157
|
+
return Buffer.from(txt);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function decryptEventResponse({ encPayload, encIv }, { eventCreatorJid, eventMsgId, eventEncKey, responderJid }) {
|
|
161
|
+
const sign = Buffer.concat([
|
|
162
|
+
toBinary(eventMsgId),
|
|
163
|
+
toBinary(eventCreatorJid),
|
|
164
|
+
toBinary(responderJid),
|
|
165
|
+
toBinary("Event Response"),
|
|
166
|
+
new Uint8Array([1])
|
|
167
|
+
]);
|
|
168
|
+
const key0 = (0, import_crypto.hmacSign)(eventEncKey, new Uint8Array(32), "sha256");
|
|
169
|
+
const decKey = (0, import_crypto.hmacSign)(sign, key0, "sha256");
|
|
170
|
+
const aad = toBinary(`${eventMsgId}\0${responderJid}`);
|
|
171
|
+
const decrypted = (0, import_crypto.aesDecryptGCM)(encPayload, decKey, encIv, aad);
|
|
172
|
+
return import_WAProto.proto.Message.EventResponseMessage.decode(decrypted);
|
|
173
|
+
function toBinary(txt) {
|
|
174
|
+
return Buffer.from(txt);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
function decryptMessageEdit({ encPayload, encIv }, { originalSenderJid, originalMsgId, editEncKey, editorJid }) {
|
|
178
|
+
const sign = Buffer.concat([
|
|
179
|
+
toBinary(originalMsgId),
|
|
180
|
+
toBinary(originalSenderJid),
|
|
181
|
+
toBinary(editorJid),
|
|
182
|
+
toBinary("Message Edit"),
|
|
183
|
+
new Uint8Array([1])
|
|
184
|
+
]);
|
|
185
|
+
const key0 = (0, import_crypto.hmacSign)(editEncKey, new Uint8Array(32), "sha256");
|
|
186
|
+
const decKey = (0, import_crypto.hmacSign)(sign, key0, "sha256");
|
|
187
|
+
const aad = Buffer.alloc(0);
|
|
188
|
+
const decrypted = (0, import_crypto.aesDecryptGCM)(encPayload, decKey, encIv, aad);
|
|
189
|
+
return import_WAProto.proto.Message.decode(decrypted);
|
|
190
|
+
function toBinary(txt) {
|
|
191
|
+
return Buffer.from(txt);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
const buildEditUpdate = (args) => {
|
|
195
|
+
const editedInner = decryptMessageEdit({ encPayload: args.encPayload, encIv: args.encIv }, {
|
|
196
|
+
editEncKey: args.editEncKey,
|
|
197
|
+
originalSenderJid: args.originalSenderJid,
|
|
198
|
+
originalMsgId: args.originalMsgId,
|
|
199
|
+
editorJid: args.editorJid
|
|
200
|
+
});
|
|
201
|
+
const editProtocol = editedInner.protocolMessage;
|
|
202
|
+
const innerEdited = editProtocol?.editedMessage;
|
|
203
|
+
if (!innerEdited) {
|
|
204
|
+
args.logger?.warn({ targetKey: args.targetKey }, "decrypted MESSAGE_EDIT plaintext had no protocolMessage.editedMessage \u2014 skipping update");
|
|
205
|
+
return null;
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
key: { ...args.messageKey, id: args.targetKeyId },
|
|
209
|
+
update: {
|
|
210
|
+
message: {
|
|
211
|
+
editedMessage: {
|
|
212
|
+
message: innerEdited
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
messageTimestamp: editProtocol?.timestampMs ? Math.floor((0, import_generics.toNumber)(editProtocol.timestampMs) / 1e3) : args.fallbackTimestamp
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
const processMessage = async (message, { shouldProcessHistoryMsg, placeholderResendCache, ev, creds, signalRepository, keyStore, logger, options, getMessage }) => {
|
|
220
|
+
const meId = creds.me.id;
|
|
221
|
+
const { accountSettings } = creds;
|
|
222
|
+
const chat = { id: (0, import_WABinary.jidNormalizedUser)(getChatId(message.key)) };
|
|
223
|
+
const isRealMsg = isRealMessage(message);
|
|
224
|
+
if (isRealMsg) {
|
|
225
|
+
chat.messages = [{ message }];
|
|
226
|
+
chat.conversationTimestamp = (0, import_generics.toNumber)(message.messageTimestamp);
|
|
227
|
+
if (shouldIncrementChatUnread(message)) {
|
|
228
|
+
chat.unreadCount = (chat.unreadCount || 0) + 1;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
const content = (0, import_messages.normalizeMessageContent)(message.message);
|
|
232
|
+
if ((isRealMsg || content?.reactionMessage?.key?.fromMe) && accountSettings?.unarchiveChats) {
|
|
233
|
+
chat.archived = false;
|
|
234
|
+
chat.readOnly = false;
|
|
235
|
+
}
|
|
236
|
+
const protocolMsg = content?.protocolMessage;
|
|
237
|
+
if (protocolMsg) {
|
|
238
|
+
const SELF_ONLY_TYPES = /* @__PURE__ */ new Set([
|
|
239
|
+
import_WAProto.proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION,
|
|
240
|
+
import_WAProto.proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE,
|
|
241
|
+
import_WAProto.proto.Message.ProtocolMessage.Type.LID_MIGRATION_MAPPING_SYNC,
|
|
242
|
+
import_WAProto.proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE
|
|
243
|
+
]);
|
|
244
|
+
if (protocolMsg.type !== null && protocolMsg.type !== void 0 && SELF_ONLY_TYPES.has(protocolMsg.type) && !message.key.fromMe) {
|
|
245
|
+
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");
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
switch (protocolMsg.type) {
|
|
249
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.HISTORY_SYNC_NOTIFICATION:
|
|
250
|
+
const histNotification = protocolMsg.historySyncNotification;
|
|
251
|
+
const process = shouldProcessHistoryMsg;
|
|
252
|
+
const isLatest = !creds.processedHistoryMessages?.length;
|
|
253
|
+
logger?.info({
|
|
254
|
+
histNotification,
|
|
255
|
+
process,
|
|
256
|
+
id: message.key.id,
|
|
257
|
+
isLatest
|
|
258
|
+
}, "got history notification");
|
|
259
|
+
if (process) {
|
|
260
|
+
if (histNotification.syncType !== import_WAProto.proto.HistorySync.HistorySyncType.ON_DEMAND) {
|
|
261
|
+
ev.emit("creds.update", {
|
|
262
|
+
processedHistoryMessages: [
|
|
263
|
+
...creds.processedHistoryMessages || [],
|
|
264
|
+
{ key: message.key, messageTimestamp: message.messageTimestamp }
|
|
265
|
+
]
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
const data = await (0, import_history.downloadAndProcessHistorySyncNotification)(histNotification, options, logger);
|
|
269
|
+
if (data.lidPnMappings?.length) {
|
|
270
|
+
logger?.debug({ count: data.lidPnMappings.length }, "processing LID-PN mappings from history sync");
|
|
271
|
+
await signalRepository.lidMapping.storeLIDPNMappings(data.lidPnMappings).catch((err) => logger?.warn({ err }, "failed to store LID-PN mappings from history sync"));
|
|
272
|
+
}
|
|
273
|
+
await storeTcTokensFromHistorySync(data.chats, signalRepository, keyStore, logger);
|
|
274
|
+
ev.emit("messaging-history.set", {
|
|
275
|
+
...data,
|
|
276
|
+
isLatest: histNotification.syncType !== import_WAProto.proto.HistorySync.HistorySyncType.ON_DEMAND ? isLatest : void 0,
|
|
277
|
+
chunkOrder: histNotification.chunkOrder,
|
|
278
|
+
peerDataRequestSessionId: histNotification.peerDataRequestSessionId
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
break;
|
|
282
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.APP_STATE_SYNC_KEY_SHARE:
|
|
283
|
+
const keys = protocolMsg.appStateSyncKeyShare.keys;
|
|
284
|
+
if (keys?.length) {
|
|
285
|
+
let newAppStateSyncKeyId = "";
|
|
286
|
+
await keyStore.transaction(async () => {
|
|
287
|
+
const newKeys = [];
|
|
288
|
+
for (const { keyData, keyId } of keys) {
|
|
289
|
+
const strKeyId = Buffer.from(keyId.keyId).toString("base64");
|
|
290
|
+
newKeys.push(strKeyId);
|
|
291
|
+
await keyStore.set({ "app-state-sync-key": { [strKeyId]: keyData } });
|
|
292
|
+
newAppStateSyncKeyId = strKeyId;
|
|
293
|
+
}
|
|
294
|
+
logger?.info({ newAppStateSyncKeyId, newKeys }, "injecting new app state sync keys");
|
|
295
|
+
}, meId);
|
|
296
|
+
ev.emit("creds.update", { myAppStateKeyId: newAppStateSyncKeyId });
|
|
297
|
+
} else {
|
|
298
|
+
logger?.info({ protocolMsg }, "recv app state sync with 0 keys");
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.REVOKE:
|
|
302
|
+
ev.emit("messages.update", [
|
|
303
|
+
{
|
|
304
|
+
key: {
|
|
305
|
+
...message.key,
|
|
306
|
+
id: protocolMsg.key.id
|
|
307
|
+
},
|
|
308
|
+
update: { message: null, messageStubType: import_Types.WAMessageStubType.REVOKE, key: message.key }
|
|
309
|
+
}
|
|
310
|
+
]);
|
|
311
|
+
break;
|
|
312
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.EPHEMERAL_SETTING:
|
|
313
|
+
Object.assign(chat, {
|
|
314
|
+
ephemeralSettingTimestamp: (0, import_generics.toNumber)(message.messageTimestamp),
|
|
315
|
+
ephemeralExpiration: protocolMsg.ephemeralExpiration || null
|
|
316
|
+
});
|
|
317
|
+
break;
|
|
318
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.PEER_DATA_OPERATION_REQUEST_RESPONSE_MESSAGE:
|
|
319
|
+
const response = protocolMsg.peerDataOperationRequestResponseMessage;
|
|
320
|
+
if (response) {
|
|
321
|
+
const peerDataOperationResult = response.peerDataOperationResult || [];
|
|
322
|
+
for (const result of peerDataOperationResult) {
|
|
323
|
+
const retryResponse = result?.placeholderMessageResendResponse;
|
|
324
|
+
if (!retryResponse?.webMessageInfoBytes) {
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
try {
|
|
328
|
+
const webMessageInfo = import_WAProto.proto.WebMessageInfo.decode(retryResponse.webMessageInfoBytes);
|
|
329
|
+
const msgId = webMessageInfo.key?.id;
|
|
330
|
+
const cachedData = msgId ? await placeholderResendCache?.get(msgId) : void 0;
|
|
331
|
+
if (msgId) {
|
|
332
|
+
await placeholderResendCache?.del(msgId);
|
|
333
|
+
}
|
|
334
|
+
let finalMsg;
|
|
335
|
+
if (cachedData && typeof cachedData === "object") {
|
|
336
|
+
cachedData.message = webMessageInfo.message;
|
|
337
|
+
if (webMessageInfo.messageTimestamp) {
|
|
338
|
+
cachedData.messageTimestamp = webMessageInfo.messageTimestamp;
|
|
339
|
+
}
|
|
340
|
+
finalMsg = cachedData;
|
|
341
|
+
} else {
|
|
342
|
+
finalMsg = webMessageInfo;
|
|
343
|
+
}
|
|
344
|
+
logger?.debug({ msgId, requestId: response.stanzaId }, "received placeholder resend");
|
|
345
|
+
ev.emit("messages.upsert", {
|
|
346
|
+
messages: [finalMsg],
|
|
347
|
+
type: "notify",
|
|
348
|
+
requestId: response.stanzaId
|
|
349
|
+
});
|
|
350
|
+
} catch (err) {
|
|
351
|
+
logger?.warn({ err, stanzaId: response.stanzaId }, "failed to decode placeholder resend response");
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
break;
|
|
356
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.MESSAGE_EDIT:
|
|
357
|
+
ev.emit("messages.update", [
|
|
358
|
+
{
|
|
359
|
+
// flip the sender / fromMe properties because they're in the perspective of the sender
|
|
360
|
+
key: { ...message.key, id: protocolMsg.key?.id },
|
|
361
|
+
update: {
|
|
362
|
+
message: {
|
|
363
|
+
editedMessage: {
|
|
364
|
+
message: protocolMsg.editedMessage
|
|
365
|
+
}
|
|
366
|
+
},
|
|
367
|
+
messageTimestamp: protocolMsg.timestampMs ? Math.floor((0, import_generics.toNumber)(protocolMsg.timestampMs) / 1e3) : message.messageTimestamp
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
]);
|
|
371
|
+
break;
|
|
372
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.GROUP_MEMBER_LABEL_CHANGE:
|
|
373
|
+
const labelAssociationMsg = protocolMsg.memberLabel;
|
|
374
|
+
if (labelAssociationMsg?.label) {
|
|
375
|
+
ev.emit("group.member-tag.update", {
|
|
376
|
+
groupId: chat.id,
|
|
377
|
+
label: labelAssociationMsg.label,
|
|
378
|
+
participant: message.key.participant,
|
|
379
|
+
participantAlt: message.key.participantAlt,
|
|
380
|
+
messageTimestamp: Number(message.messageTimestamp)
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
case import_WAProto.proto.Message.ProtocolMessage.Type.LID_MIGRATION_MAPPING_SYNC:
|
|
385
|
+
const encodedPayload = protocolMsg.lidMigrationMappingSyncMessage?.encodedMappingPayload;
|
|
386
|
+
const { pnToLidMappings, chatDbMigrationTimestamp } = import_WAProto.proto.LIDMigrationMappingSyncPayload.decode(encodedPayload);
|
|
387
|
+
logger?.debug({ pnToLidMappings, chatDbMigrationTimestamp }, "got lid mappings and chat db migration timestamp");
|
|
388
|
+
const pairs = [];
|
|
389
|
+
for (const { pn, latestLid, assignedLid } of pnToLidMappings) {
|
|
390
|
+
const lid = latestLid || assignedLid;
|
|
391
|
+
pairs.push({ lid: `${lid}@lid`, pn: `${pn}@s.whatsapp.net` });
|
|
392
|
+
}
|
|
393
|
+
await signalRepository.lidMapping.storeLIDPNMappings(pairs);
|
|
394
|
+
if (pairs.length) {
|
|
395
|
+
for (const { pn, lid } of pairs) {
|
|
396
|
+
await signalRepository.migrateSession(pn, lid);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
} else if (content?.reactionMessage) {
|
|
401
|
+
const reaction = {
|
|
402
|
+
...content.reactionMessage,
|
|
403
|
+
key: message.key
|
|
404
|
+
};
|
|
405
|
+
ev.emit("messages.reaction", [
|
|
406
|
+
{
|
|
407
|
+
reaction,
|
|
408
|
+
key: content.reactionMessage?.key
|
|
409
|
+
}
|
|
410
|
+
]);
|
|
411
|
+
} else if (content?.encEventResponseMessage) {
|
|
412
|
+
const encEventResponse = content.encEventResponseMessage;
|
|
413
|
+
const creationMsgKey = encEventResponse.eventCreationMessageKey;
|
|
414
|
+
const eventMsg = await getMessage(creationMsgKey);
|
|
415
|
+
if (eventMsg) {
|
|
416
|
+
try {
|
|
417
|
+
const meIdNormalised = (0, import_WABinary.jidNormalizedUser)(meId);
|
|
418
|
+
const eventCreatorKey = creationMsgKey.participant || creationMsgKey.remoteJid;
|
|
419
|
+
const eventCreatorPn = (0, import_WABinary.isLidUser)(eventCreatorKey) ? await signalRepository.lidMapping.getPNForLID(eventCreatorKey) : eventCreatorKey;
|
|
420
|
+
const eventCreatorJid = (0, import_generics.getKeyAuthor)({ remoteJid: (0, import_WABinary.jidNormalizedUser)(eventCreatorPn), fromMe: meIdNormalised === eventCreatorPn }, meIdNormalised);
|
|
421
|
+
const responderJid = (0, import_generics.getKeyAuthor)(message.key, meIdNormalised);
|
|
422
|
+
const eventEncKey = eventMsg?.messageContextInfo?.messageSecret;
|
|
423
|
+
if (!eventEncKey) {
|
|
424
|
+
logger?.warn({ creationMsgKey }, "event response: missing messageSecret for decryption");
|
|
425
|
+
} else {
|
|
426
|
+
const responseMsg = decryptEventResponse(encEventResponse, {
|
|
427
|
+
eventEncKey,
|
|
428
|
+
eventCreatorJid,
|
|
429
|
+
eventMsgId: creationMsgKey.id,
|
|
430
|
+
responderJid
|
|
431
|
+
});
|
|
432
|
+
const eventResponse = {
|
|
433
|
+
eventResponseMessageKey: message.key,
|
|
434
|
+
senderTimestampMs: responseMsg.timestampMs,
|
|
435
|
+
response: responseMsg
|
|
436
|
+
};
|
|
437
|
+
ev.emit("messages.update", [
|
|
438
|
+
{
|
|
439
|
+
key: creationMsgKey,
|
|
440
|
+
update: {
|
|
441
|
+
eventResponses: [eventResponse]
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
]);
|
|
445
|
+
}
|
|
446
|
+
} catch (err) {
|
|
447
|
+
logger?.warn({ err, creationMsgKey }, "failed to decrypt event response");
|
|
448
|
+
}
|
|
449
|
+
} else {
|
|
450
|
+
logger?.warn({ creationMsgKey }, "event creation message not found, cannot decrypt response");
|
|
451
|
+
}
|
|
452
|
+
} else if (content?.secretEncryptedMessage && content.secretEncryptedMessage.secretEncType === import_WAProto.proto.Message.SecretEncryptedMessage.SecretEncType.MESSAGE_EDIT) {
|
|
453
|
+
const secEnc = content.secretEncryptedMessage;
|
|
454
|
+
const targetKey = secEnc.targetMessageKey;
|
|
455
|
+
const targetMsg = await getMessage(targetKey);
|
|
456
|
+
if (targetMsg) {
|
|
457
|
+
try {
|
|
458
|
+
const meIdNormalised = (0, import_WABinary.jidNormalizedUser)(meId);
|
|
459
|
+
const origSenderRaw = targetKey.participant || targetKey.remoteJid;
|
|
460
|
+
const origSenderPn = (0, import_WABinary.isLidUser)(origSenderRaw) ? await signalRepository.lidMapping.getPNForLID(origSenderRaw) : origSenderRaw;
|
|
461
|
+
const originalSenderJid = (0, import_generics.getKeyAuthor)({ remoteJid: (0, import_WABinary.jidNormalizedUser)(origSenderPn), fromMe: meIdNormalised === origSenderPn }, meIdNormalised);
|
|
462
|
+
const editorJid = (0, import_generics.getKeyAuthor)(message.key, meIdNormalised);
|
|
463
|
+
const editEncKey = targetMsg?.messageContextInfo?.messageSecret;
|
|
464
|
+
if (!editEncKey) {
|
|
465
|
+
logger?.warn({ targetKey }, "message edit: missing messageSecret on original message \u2014 cannot decrypt");
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
const update = buildEditUpdate({
|
|
469
|
+
editEncKey,
|
|
470
|
+
encPayload: secEnc.encPayload,
|
|
471
|
+
encIv: secEnc.encIv,
|
|
472
|
+
originalSenderJid,
|
|
473
|
+
originalMsgId: targetKey.id,
|
|
474
|
+
editorJid,
|
|
475
|
+
messageKey: message.key,
|
|
476
|
+
targetKeyId: targetKey.id,
|
|
477
|
+
fallbackTimestamp: (0, import_generics.toNumber)(message.messageTimestamp),
|
|
478
|
+
logger,
|
|
479
|
+
targetKey
|
|
480
|
+
});
|
|
481
|
+
if (update) {
|
|
482
|
+
ev.emit("messages.update", [update]);
|
|
483
|
+
}
|
|
484
|
+
} catch (err) {
|
|
485
|
+
logger?.warn({ err, targetKey }, "failed to decrypt secretEncryptedMessage MESSAGE_EDIT");
|
|
486
|
+
}
|
|
487
|
+
} else {
|
|
488
|
+
logger?.warn({ targetKey }, "original message not found in store, cannot decrypt secretEncryptedMessage edit");
|
|
489
|
+
}
|
|
490
|
+
} else if (message.messageStubType) {
|
|
491
|
+
const jid = message.key?.remoteJid;
|
|
492
|
+
let participants;
|
|
493
|
+
const emitParticipantsUpdate = (action) => ev.emit("group-participants.update", {
|
|
494
|
+
id: jid,
|
|
495
|
+
author: message.key.participant,
|
|
496
|
+
authorPn: message.key.participantAlt,
|
|
497
|
+
authorUsername: message.key.participantUsername,
|
|
498
|
+
participants,
|
|
499
|
+
action
|
|
500
|
+
});
|
|
501
|
+
const emitGroupUpdate = (update) => {
|
|
502
|
+
ev.emit("groups.update", [
|
|
503
|
+
{
|
|
504
|
+
id: jid,
|
|
505
|
+
...update,
|
|
506
|
+
author: message.key.participant ?? void 0,
|
|
507
|
+
authorPn: message.key.participantAlt,
|
|
508
|
+
authorUsername: message.key.participantUsername
|
|
509
|
+
}
|
|
510
|
+
]);
|
|
511
|
+
};
|
|
512
|
+
const emitGroupRequestJoin = (participant, action, method) => {
|
|
513
|
+
ev.emit("group.join-request", {
|
|
514
|
+
id: jid,
|
|
515
|
+
author: message.key.participant,
|
|
516
|
+
authorPn: message.key.participantAlt,
|
|
517
|
+
authorUsername: message.key.participantUsername,
|
|
518
|
+
participant: participant.lid,
|
|
519
|
+
participantPn: participant.pn,
|
|
520
|
+
action,
|
|
521
|
+
method
|
|
522
|
+
});
|
|
523
|
+
};
|
|
524
|
+
const participantsIncludesMe = () => participants.find((jid2) => (0, import_WABinary.areJidsSameUser)(meId, jid2.phoneNumber));
|
|
525
|
+
switch (message.messageStubType) {
|
|
526
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_CHANGE_NUMBER:
|
|
527
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
528
|
+
emitParticipantsUpdate("modify");
|
|
529
|
+
break;
|
|
530
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_LEAVE:
|
|
531
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_REMOVE:
|
|
532
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
533
|
+
emitParticipantsUpdate("remove");
|
|
534
|
+
if (participantsIncludesMe()) {
|
|
535
|
+
chat.readOnly = true;
|
|
536
|
+
}
|
|
537
|
+
break;
|
|
538
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_ADD:
|
|
539
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_INVITE:
|
|
540
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_ADD_REQUEST_JOIN:
|
|
541
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
542
|
+
if (participantsIncludesMe()) {
|
|
543
|
+
chat.readOnly = false;
|
|
544
|
+
}
|
|
545
|
+
emitParticipantsUpdate("add");
|
|
546
|
+
break;
|
|
547
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_DEMOTE:
|
|
548
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
549
|
+
emitParticipantsUpdate("demote");
|
|
550
|
+
break;
|
|
551
|
+
case import_Types.WAMessageStubType.GROUP_PARTICIPANT_PROMOTE:
|
|
552
|
+
participants = message.messageStubParameters.map((a) => JSON.parse(a)) || [];
|
|
553
|
+
emitParticipantsUpdate("promote");
|
|
554
|
+
break;
|
|
555
|
+
case import_Types.WAMessageStubType.GROUP_CHANGE_ANNOUNCE:
|
|
556
|
+
const announceValue = message.messageStubParameters?.[0];
|
|
557
|
+
emitGroupUpdate({ announce: announceValue === "true" || announceValue === "on" });
|
|
558
|
+
break;
|
|
559
|
+
case import_Types.WAMessageStubType.GROUP_CHANGE_RESTRICT:
|
|
560
|
+
const restrictValue = message.messageStubParameters?.[0];
|
|
561
|
+
emitGroupUpdate({ restrict: restrictValue === "true" || restrictValue === "on" });
|
|
562
|
+
break;
|
|
563
|
+
case import_Types.WAMessageStubType.GROUP_CHANGE_SUBJECT:
|
|
564
|
+
const name = message.messageStubParameters?.[0];
|
|
565
|
+
chat.name = name;
|
|
566
|
+
emitGroupUpdate({ subject: name });
|
|
567
|
+
break;
|
|
568
|
+
case import_Types.WAMessageStubType.GROUP_CHANGE_DESCRIPTION:
|
|
569
|
+
const description = message.messageStubParameters?.[0];
|
|
570
|
+
chat.description = description;
|
|
571
|
+
emitGroupUpdate({ desc: description });
|
|
572
|
+
break;
|
|
573
|
+
case import_Types.WAMessageStubType.GROUP_CHANGE_INVITE_LINK:
|
|
574
|
+
const code = message.messageStubParameters?.[0];
|
|
575
|
+
emitGroupUpdate({ inviteCode: code });
|
|
576
|
+
break;
|
|
577
|
+
case import_Types.WAMessageStubType.GROUP_MEMBER_ADD_MODE:
|
|
578
|
+
const memberAddValue = message.messageStubParameters?.[0];
|
|
579
|
+
emitGroupUpdate({ memberAddMode: memberAddValue === "all_member_add" });
|
|
580
|
+
break;
|
|
581
|
+
case import_Types.WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_MODE:
|
|
582
|
+
const approvalMode = message.messageStubParameters?.[0];
|
|
583
|
+
emitGroupUpdate({ joinApprovalMode: approvalMode === "on" });
|
|
584
|
+
break;
|
|
585
|
+
case import_Types.WAMessageStubType.GROUP_MEMBERSHIP_JOIN_APPROVAL_REQUEST_NON_ADMIN_ADD:
|
|
586
|
+
const participant = JSON.parse(message.messageStubParameters?.[0]);
|
|
587
|
+
const action = message.messageStubParameters?.[1];
|
|
588
|
+
const method = message.messageStubParameters?.[2];
|
|
589
|
+
emitGroupRequestJoin(participant, action, method);
|
|
590
|
+
break;
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
if (Object.keys(chat).length > 1) {
|
|
594
|
+
ev.emit("chats.update", [chat]);
|
|
595
|
+
}
|
|
596
|
+
};
|
|
597
|
+
var process_message_default = processMessage;
|
|
598
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
599
|
+
0 && (module.exports = {
|
|
600
|
+
cleanMessage,
|
|
601
|
+
decryptEventResponse,
|
|
602
|
+
decryptMessageEdit,
|
|
603
|
+
decryptPollVote,
|
|
604
|
+
getChatId,
|
|
605
|
+
isRealMessage,
|
|
606
|
+
shouldIncrementChatUnread
|
|
607
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function shouldIncludeReportingToken(message: any): boolean;
|
|
2
|
+
export function getMessageReportingToken(msgProtobuf: any, message: any, key: any): Promise<{
|
|
3
|
+
tag: string;
|
|
4
|
+
attrs: {};
|
|
5
|
+
content: {
|
|
6
|
+
tag: string;
|
|
7
|
+
attrs: {
|
|
8
|
+
v: string;
|
|
9
|
+
};
|
|
10
|
+
content: any;
|
|
11
|
+
}[];
|
|
12
|
+
} | null>;
|