@violetix/baileys 0.0.0-stage → 0.3.18
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 +2843 -2
- package/WAProto/index.d.ts +15932 -0
- package/WAProto/index.js +115856 -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 +157 -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 +403 -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 +93 -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 +57 -0
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +428 -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 +176 -0
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +1238 -0
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +595 -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/graphql.js +908 -0
- package/lib/Socket/groups.d.ts +318 -0
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +364 -0
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +940 -0
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +19 -0
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/interop.js +562 -0
- package/lib/Socket/managed-account.js +210 -0
- package/lib/Socket/messages-recv.d.ts +367 -0
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +2199 -0
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +364 -0
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +1501 -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 +315 -0
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +235 -0
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/privacy.js +448 -0
- package/lib/Socket/registration.js +430 -0
- package/lib/Socket/socket.d.ts +93 -0
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +1272 -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 +462 -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 +60 -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 +9 -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 +22 -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 +3 -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 +11 -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 +41 -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 +36 -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 +22 -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 +49 -0
- package/lib/Types/Mex.js.map +1 -0
- package/lib/Types/Product.d.ts +5 -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 +10 -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 +33 -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 +9 -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 +16 -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/async-utils.js +7 -0
- package/lib/Utils/auth-utils.d.ts +59 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +306 -0
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +10 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +29 -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 +10 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +69 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto-worker.js +20 -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 +85 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +467 -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 +651 -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 +442 -0
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +77 -0
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +188 -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 +26 -0
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +26 -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/listener-guard.js +48 -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 +285 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +166 -0
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +957 -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 +1887 -0
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/meta-ai-msmsg.d.ts +12 -0
- package/lib/Utils/meta-ai-msmsg.js +124 -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 +206 -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 +102 -0
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +798 -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 +369 -0
- package/lib/Utils/rich-message-utils.js.map +1 -0
- package/lib/Utils/session-queue.js +33 -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 +22 -0
- package/lib/Utils/stanza-ack.d.ts.map +1 -0
- package/lib/Utils/stanza-ack.js +72 -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 +164 -0
- package/lib/Utils/tc-token-utils.js.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +175 -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 +210 -0
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/Utils/worker-pool.js +73 -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 +6 -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/USyncBusinessProtocol.d.ts +8 -0
- package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +99 -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 +53 -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/USyncFeatureProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +70 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncPictureProtocol.js +28 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +25 -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/USyncTextStatusProtocol.d.ts +11 -0
- package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +34 -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 +31 -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 +11 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +11 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +32 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +185 -0
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +25 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +48 -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 +122 -5
|
@@ -0,0 +1,467 @@
|
|
|
1
|
+
import { Boom } from '@hapi/boom';
|
|
2
|
+
import { proto } from '../../WAProto/index.js';
|
|
3
|
+
import { areJidsSameUser, isHostedLidUser, isHostedPnUser, isJidBroadcast, isJidGroup, isJidMetaAI, isJidNewsletter, isJidStatusBroadcast, isLidUser, isPnUser
|
|
4
|
+
// transferDevice
|
|
5
|
+
} from '../WABinary/index.js';
|
|
6
|
+
import { unpadRandomMax16 } from './generics.js';
|
|
7
|
+
import { decodeDecryptedMsmsgMessage, decryptMsmsgBotMessage } from './meta-ai-msmsg.js';
|
|
8
|
+
const MAX_SECRETS_PER_CHAT = 20;
|
|
9
|
+
// Outgoing @bot message id → messageSecret. Populated when we send to @bot (or see our
|
|
10
|
+
// own echo), consumed when the msmsg response from @bot arrives and needs decrypting.
|
|
11
|
+
const botMessageSecrets = new Map();
|
|
12
|
+
const botRecentSecretsByChat = new Map();
|
|
13
|
+
const pushRecentChatSecret = (chatJid, id, secretBuf) => {
|
|
14
|
+
if (!chatJid || !secretBuf) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const existing = botRecentSecretsByChat.get(chatJid) || [];
|
|
18
|
+
const filtered = existing.filter(item => item.id !== id && !item.secret.equals(secretBuf));
|
|
19
|
+
filtered.unshift({ id, secret: secretBuf });
|
|
20
|
+
if (filtered.length > MAX_SECRETS_PER_CHAT) {
|
|
21
|
+
filtered.length = MAX_SECRETS_PER_CHAT;
|
|
22
|
+
}
|
|
23
|
+
botRecentSecretsByChat.set(chatJid, filtered);
|
|
24
|
+
};
|
|
25
|
+
export const setBotMessageSecret = (id, secret, chatJid) => {
|
|
26
|
+
if (!id || !secret) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
let buf;
|
|
30
|
+
if (Buffer.isBuffer(secret)) {
|
|
31
|
+
buf = secret;
|
|
32
|
+
}
|
|
33
|
+
else if (secret instanceof Uint8Array) {
|
|
34
|
+
buf = Buffer.from(secret.buffer, secret.byteOffset, secret.byteLength);
|
|
35
|
+
}
|
|
36
|
+
else if (typeof secret === 'string') {
|
|
37
|
+
buf = Buffer.from(secret, 'base64');
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
botMessageSecrets.set(id, buf);
|
|
43
|
+
if (chatJid) {
|
|
44
|
+
pushRecentChatSecret(chatJid, id, buf);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
export const getDecryptionJid = async (sender, repository) => {
|
|
48
|
+
if (isLidUser(sender) || isHostedLidUser(sender)) {
|
|
49
|
+
return sender;
|
|
50
|
+
}
|
|
51
|
+
const mapped = await repository.lidMapping.getLIDForPN(sender);
|
|
52
|
+
return mapped || sender;
|
|
53
|
+
};
|
|
54
|
+
const storeMappingFromEnvelope = async (stanza, sender, repository, decryptionJid, logger) => {
|
|
55
|
+
// TODO: Handle hosted IDs
|
|
56
|
+
const { senderAlt } = extractAddressingContext(stanza);
|
|
57
|
+
if (senderAlt && isLidUser(senderAlt) && isPnUser(sender) && decryptionJid === sender) {
|
|
58
|
+
try {
|
|
59
|
+
await repository.lidMapping.storeLIDPNMappings([{ lid: senderAlt, pn: sender }]);
|
|
60
|
+
await repository.migrateSession(sender, senderAlt);
|
|
61
|
+
logger.debug({ sender, senderAlt }, 'Stored LID mapping from envelope');
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
logger.warn({ sender, senderAlt, error }, 'Failed to store LID mapping');
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export const NO_MESSAGE_FOUND_ERROR_TEXT = 'Message absent from node';
|
|
69
|
+
export const MISSING_KEYS_ERROR_TEXT = 'Key used already or never filled';
|
|
70
|
+
export const ACCOUNT_RESTRICTED_TEXT = 'Your account has been restricted';
|
|
71
|
+
// Retry configuration for failed decryption
|
|
72
|
+
export const DECRYPTION_RETRY_CONFIG = {
|
|
73
|
+
maxRetries: 3,
|
|
74
|
+
baseDelayMs: 100,
|
|
75
|
+
sessionRecordErrors: ['No session record', 'SessionError: No session record']
|
|
76
|
+
};
|
|
77
|
+
/** NACK reason codes we send to the server (client → server) */
|
|
78
|
+
export const NACK_REASONS = {
|
|
79
|
+
SenderReachoutTimelocked: 463,
|
|
80
|
+
ParsingError: 487,
|
|
81
|
+
UnrecognizedStanza: 488,
|
|
82
|
+
UnrecognizedStanzaClass: 489,
|
|
83
|
+
UnrecognizedStanzaType: 490,
|
|
84
|
+
InvalidProtobuf: 491,
|
|
85
|
+
InvalidHostedCompanionStanza: 493,
|
|
86
|
+
MissingMessageSecret: 495,
|
|
87
|
+
SignalErrorOldCounter: 496,
|
|
88
|
+
MessageDeletedOnPeer: 499,
|
|
89
|
+
UnhandledError: 500,
|
|
90
|
+
UnsupportedAdminRevoke: 550,
|
|
91
|
+
UnsupportedLIDGroup: 551,
|
|
92
|
+
DBOperationFailed: 552
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Server-side error codes returned in ack stanzas (server → client) that we
|
|
96
|
+
* currently have dedicated handlers for. Extend as more handlers are added.
|
|
97
|
+
* Distinct from the client-side NackReason enum (WAWebCreateNackFromStanza).
|
|
98
|
+
*/
|
|
99
|
+
export const SERVER_ERROR_CODES = {
|
|
100
|
+
/**
|
|
101
|
+
* 1:1 message missing privacy token (tctoken). Usually means the account is
|
|
102
|
+
* restricted: WhatsApp blocks starting new chats but preserves existing ones,
|
|
103
|
+
* since established chats already carry a tctoken.
|
|
104
|
+
*/
|
|
105
|
+
MessageAccountRestriction: '463',
|
|
106
|
+
/** Stanza validation failure (SMAX_INVALID) — likely stale device session */
|
|
107
|
+
SmaxInvalid: '479'
|
|
108
|
+
};
|
|
109
|
+
export const extractAddressingContext = (stanza) => {
|
|
110
|
+
let senderAlt;
|
|
111
|
+
let recipientAlt;
|
|
112
|
+
const sender = stanza.attrs.participant || stanza.attrs.from;
|
|
113
|
+
const addressingMode = stanza.attrs.addressing_mode || (sender?.endsWith('lid') ? 'lid' : 'pn');
|
|
114
|
+
if (addressingMode === 'lid') {
|
|
115
|
+
// Message is LID-addressed: sender is LID, extract corresponding PN
|
|
116
|
+
// without device data
|
|
117
|
+
senderAlt = stanza.attrs.participant_pn || stanza.attrs.sender_pn || stanza.attrs.peer_recipient_pn;
|
|
118
|
+
recipientAlt = stanza.attrs.recipient_pn;
|
|
119
|
+
// with device data
|
|
120
|
+
//if (sender && senderAlt) senderAlt = transferDevice(sender, senderAlt)
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
// Message is PN-addressed: sender is PN, extract corresponding LID
|
|
124
|
+
// without device data
|
|
125
|
+
senderAlt = stanza.attrs.participant_lid || stanza.attrs.sender_lid || stanza.attrs.peer_recipient_lid;
|
|
126
|
+
recipientAlt = stanza.attrs.recipient_lid;
|
|
127
|
+
//with device data
|
|
128
|
+
//if (sender && senderAlt) senderAlt = transferDevice(sender, senderAlt)
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
addressingMode,
|
|
132
|
+
senderAlt,
|
|
133
|
+
recipientAlt
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Decode the received node as a message.
|
|
138
|
+
* @note this will only parse the message, not decrypt it
|
|
139
|
+
*/
|
|
140
|
+
export function decodeMessageNode(stanza, meId, meLid) {
|
|
141
|
+
let msgType;
|
|
142
|
+
let chatId;
|
|
143
|
+
let author;
|
|
144
|
+
let fromMe = false;
|
|
145
|
+
const msgId = stanza.attrs.id;
|
|
146
|
+
const from = stanza.attrs.from;
|
|
147
|
+
const participant = stanza.attrs.participant;
|
|
148
|
+
const recipient = stanza.attrs.recipient;
|
|
149
|
+
if (!msgId) {
|
|
150
|
+
throw new Boom('Invalid message stanza: missing id attribute', { data: stanza });
|
|
151
|
+
}
|
|
152
|
+
if (!from) {
|
|
153
|
+
throw new Boom('Invalid message stanza: missing from attribute', { data: stanza });
|
|
154
|
+
}
|
|
155
|
+
const addressingContext = extractAddressingContext(stanza);
|
|
156
|
+
const isMe = (jid) => areJidsSameUser(jid, meId);
|
|
157
|
+
const isMeLid = (jid) => areJidsSameUser(jid, meLid);
|
|
158
|
+
if (isPnUser(from) || isLidUser(from) || isHostedLidUser(from) || isHostedPnUser(from)) {
|
|
159
|
+
if (recipient && !isJidMetaAI(recipient)) {
|
|
160
|
+
if (!isMe(from) && !isMeLid(from)) {
|
|
161
|
+
throw new Boom('receipient present, but msg not from me', { data: stanza });
|
|
162
|
+
}
|
|
163
|
+
if (isMe(from) || isMeLid(from)) {
|
|
164
|
+
fromMe = true;
|
|
165
|
+
}
|
|
166
|
+
chatId = recipient;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
// Peer-routed self stanzas (history sync, app-state sync, etc.) arrive
|
|
170
|
+
// with `from` set to our own device but no `recipient` attribute —
|
|
171
|
+
// still mark as fromMe so self-only protocolMessage handlers run.
|
|
172
|
+
if (isMe(from) || isMeLid(from)) {
|
|
173
|
+
fromMe = true;
|
|
174
|
+
}
|
|
175
|
+
chatId = from;
|
|
176
|
+
}
|
|
177
|
+
msgType = 'chat';
|
|
178
|
+
author = from;
|
|
179
|
+
}
|
|
180
|
+
else if (isJidGroup(from)) {
|
|
181
|
+
if (!participant) {
|
|
182
|
+
throw new Boom('No participant in group message');
|
|
183
|
+
}
|
|
184
|
+
if (isMe(participant) || isMeLid(participant)) {
|
|
185
|
+
fromMe = true;
|
|
186
|
+
}
|
|
187
|
+
msgType = 'group';
|
|
188
|
+
author = participant;
|
|
189
|
+
chatId = from;
|
|
190
|
+
}
|
|
191
|
+
else if (isJidBroadcast(from)) {
|
|
192
|
+
if (!participant) {
|
|
193
|
+
throw new Boom('No participant in group message');
|
|
194
|
+
}
|
|
195
|
+
const isParticipantMe = isMe(participant) || isMeLid(participant);
|
|
196
|
+
if (isJidStatusBroadcast(from)) {
|
|
197
|
+
msgType = isParticipantMe ? 'direct_peer_status' : 'other_status';
|
|
198
|
+
}
|
|
199
|
+
else {
|
|
200
|
+
msgType = isParticipantMe ? 'peer_broadcast' : 'other_broadcast';
|
|
201
|
+
}
|
|
202
|
+
fromMe = isParticipantMe;
|
|
203
|
+
chatId = from;
|
|
204
|
+
author = participant;
|
|
205
|
+
}
|
|
206
|
+
else if (isJidMetaAI(from)) {
|
|
207
|
+
// @bot responses (Meta AI) arrive from a bare @bot jid — treat them as a 1:1 chat
|
|
208
|
+
msgType = 'chat';
|
|
209
|
+
chatId = from;
|
|
210
|
+
author = from;
|
|
211
|
+
fromMe = false;
|
|
212
|
+
}
|
|
213
|
+
else if (isJidNewsletter(from)) {
|
|
214
|
+
msgType = 'newsletter';
|
|
215
|
+
chatId = from;
|
|
216
|
+
author = from;
|
|
217
|
+
if (isMe(from) || isMeLid(from)) {
|
|
218
|
+
fromMe = true;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
throw new Boom('Unknown message type', { data: stanza });
|
|
223
|
+
}
|
|
224
|
+
const pushname = stanza?.attrs?.notify;
|
|
225
|
+
const key = {
|
|
226
|
+
remoteJid: chatId,
|
|
227
|
+
remoteJidAlt: !isJidGroup(chatId) ? addressingContext.senderAlt : undefined,
|
|
228
|
+
remoteJidUsername: !isJidGroup(chatId)
|
|
229
|
+
? stanza.attrs.peer_recipient_username || stanza.attrs.recipient_username || stanza.attrs.username
|
|
230
|
+
: undefined,
|
|
231
|
+
fromMe,
|
|
232
|
+
id: msgId,
|
|
233
|
+
participant,
|
|
234
|
+
participantAlt: isJidGroup(chatId) ? addressingContext.senderAlt : undefined,
|
|
235
|
+
participantUsername: stanza.attrs.participant ? stanza.attrs.participant_username : undefined,
|
|
236
|
+
addressingMode: addressingContext.addressingMode,
|
|
237
|
+
...(msgType === 'newsletter' && stanza.attrs.server_id ? { server_id: stanza.attrs.server_id } : {})
|
|
238
|
+
};
|
|
239
|
+
const fullMessage = {
|
|
240
|
+
key,
|
|
241
|
+
category: stanza.attrs.category,
|
|
242
|
+
messageTimestamp: +stanza.attrs.t,
|
|
243
|
+
pushName: pushname,
|
|
244
|
+
broadcast: isJidBroadcast(from)
|
|
245
|
+
};
|
|
246
|
+
if (key.fromMe) {
|
|
247
|
+
fullMessage.status = proto.WebMessageInfo.Status.SERVER_ACK;
|
|
248
|
+
}
|
|
249
|
+
return {
|
|
250
|
+
fullMessage,
|
|
251
|
+
author,
|
|
252
|
+
sender: msgType === 'chat' ? author : chatId
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
export const decryptMessageNode = (stanza, meId, meLid, repository, logger) => {
|
|
256
|
+
const { fullMessage, author, sender } = decodeMessageNode(stanza, meId, meLid);
|
|
257
|
+
return {
|
|
258
|
+
fullMessage,
|
|
259
|
+
category: stanza.attrs.category,
|
|
260
|
+
author,
|
|
261
|
+
async decrypt() {
|
|
262
|
+
let decryptables = 0;
|
|
263
|
+
if (Array.isArray(stanza.content)) {
|
|
264
|
+
// msmsg replies carry their key material in sibling <meta>/<bot> nodes, so
|
|
265
|
+
// collect those before walking the enc nodes.
|
|
266
|
+
let metaTargetId = null;
|
|
267
|
+
let metaTargetSenderJid = null;
|
|
268
|
+
let botEditTargetId = null;
|
|
269
|
+
let botType = null;
|
|
270
|
+
if (stanza.content.some(n => n?.attrs?.type === 'msmsg')) {
|
|
271
|
+
for (const { tag, attrs } of stanza.content) {
|
|
272
|
+
if (tag === 'meta' && attrs?.target_id) {
|
|
273
|
+
metaTargetId = attrs.target_id;
|
|
274
|
+
}
|
|
275
|
+
if (tag === 'meta' && attrs?.target_sender_jid) {
|
|
276
|
+
metaTargetSenderJid = attrs.target_sender_jid;
|
|
277
|
+
}
|
|
278
|
+
if (tag === 'bot' && attrs && 'edit_target_id' in attrs) {
|
|
279
|
+
botEditTargetId = attrs.edit_target_id; // can be '' for the 'first' type
|
|
280
|
+
}
|
|
281
|
+
if (tag === 'bot' && attrs?.edit) {
|
|
282
|
+
botType = attrs.edit;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
for (const { tag, attrs, content } of stanza.content) {
|
|
287
|
+
if (tag === 'verified_name' && content instanceof Uint8Array) {
|
|
288
|
+
const cert = proto.VerifiedNameCertificate.decode(content);
|
|
289
|
+
const details = proto.VerifiedNameCertificate.Details.decode(cert.details);
|
|
290
|
+
fullMessage.verifiedBizName = details.verifiedName;
|
|
291
|
+
}
|
|
292
|
+
if (tag === 'unavailable' && attrs.type === 'view_once') {
|
|
293
|
+
fullMessage.key.isViewOnce = true; // TODO: remove from here and add a STUB TYPE
|
|
294
|
+
}
|
|
295
|
+
if (attrs.count && tag === 'enc') {
|
|
296
|
+
fullMessage.retryCount = Number(attrs.count);
|
|
297
|
+
}
|
|
298
|
+
if (tag !== 'enc' && tag !== 'plaintext') {
|
|
299
|
+
continue;
|
|
300
|
+
}
|
|
301
|
+
if (!(content instanceof Uint8Array)) {
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
decryptables += 1;
|
|
305
|
+
let msgBuffer;
|
|
306
|
+
const decryptionJid = await getDecryptionJid(author, repository);
|
|
307
|
+
if (tag !== 'plaintext') {
|
|
308
|
+
// TODO: Handle hosted devices
|
|
309
|
+
await storeMappingFromEnvelope(stanza, author, repository, decryptionJid, logger);
|
|
310
|
+
}
|
|
311
|
+
try {
|
|
312
|
+
const e2eType = tag === 'plaintext' ? 'plaintext' : attrs.type;
|
|
313
|
+
switch (e2eType) {
|
|
314
|
+
case 'skmsg':
|
|
315
|
+
msgBuffer = await repository.decryptGroupMessage({
|
|
316
|
+
group: sender,
|
|
317
|
+
authorJid: author,
|
|
318
|
+
msg: content
|
|
319
|
+
});
|
|
320
|
+
break;
|
|
321
|
+
case 'pkmsg':
|
|
322
|
+
case 'msg':
|
|
323
|
+
msgBuffer = await repository.decryptMessage({
|
|
324
|
+
jid: decryptionJid,
|
|
325
|
+
type: e2eType,
|
|
326
|
+
ciphertext: content
|
|
327
|
+
});
|
|
328
|
+
break;
|
|
329
|
+
case 'msmsg': {
|
|
330
|
+
// botType: null = non-streaming (no <bot> node), 'full'/'last' = complete
|
|
331
|
+
// response, 'first' = streaming partial, which we intentionally skip.
|
|
332
|
+
if (botType !== null && !['full', 'last'].includes(botType)) {
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
const secretIdCandidates = [botEditTargetId, metaTargetId, fullMessage.key?.id].filter(Boolean);
|
|
336
|
+
const secretCandidates = [];
|
|
337
|
+
const seenSecrets = new Set();
|
|
338
|
+
for (const idCandidate of secretIdCandidates) {
|
|
339
|
+
const byId = botMessageSecrets.get(idCandidate);
|
|
340
|
+
if (!byId) {
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
const fp = byId.toString('hex');
|
|
344
|
+
if (!seenSecrets.has(fp)) {
|
|
345
|
+
seenSecrets.add(fp);
|
|
346
|
+
secretCandidates.push({ source: `id:${idCandidate}`, secret: byId });
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
for (const item of botRecentSecretsByChat.get(sender) || []) {
|
|
350
|
+
const fp = item.secret.toString('hex');
|
|
351
|
+
if (!seenSecrets.has(fp)) {
|
|
352
|
+
seenSecrets.add(fp);
|
|
353
|
+
secretCandidates.push({ source: `chat:${item.id}`, secret: item.secret });
|
|
354
|
+
}
|
|
355
|
+
if (secretCandidates.length >= 6) {
|
|
356
|
+
break;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
if (!secretCandidates.length) {
|
|
360
|
+
logger.warn({ metaTargetId, botType, secretIdCandidates }, 'msmsg: no candidate messageSecret found, skipping');
|
|
361
|
+
break;
|
|
362
|
+
}
|
|
363
|
+
const msMsg = proto.MessageSecretMessage.decode(content);
|
|
364
|
+
const helperKey = {
|
|
365
|
+
participant: author,
|
|
366
|
+
meId: metaTargetSenderJid || `${meLid.split(':')[0]}@lid`,
|
|
367
|
+
meLid,
|
|
368
|
+
botEditTargetId,
|
|
369
|
+
metaTargetId,
|
|
370
|
+
stanzaId: stanza.attrs?.id
|
|
371
|
+
};
|
|
372
|
+
let decryptErr;
|
|
373
|
+
for (const candidate of secretCandidates) {
|
|
374
|
+
try {
|
|
375
|
+
msgBuffer = await decryptMsmsgBotMessage(candidate.secret, helperKey, msMsg);
|
|
376
|
+
logger.debug({ source: candidate.source }, 'msmsg: decrypted with candidate secret');
|
|
377
|
+
break;
|
|
378
|
+
}
|
|
379
|
+
catch (e) {
|
|
380
|
+
decryptErr = e;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (!msgBuffer && decryptErr) {
|
|
384
|
+
logger.warn({
|
|
385
|
+
secretCandidateSources: secretCandidates.map(candidate => candidate.source),
|
|
386
|
+
cause: decryptErr?.message
|
|
387
|
+
}, 'msmsg: helper decryption failed for all candidate secrets');
|
|
388
|
+
throw decryptErr;
|
|
389
|
+
}
|
|
390
|
+
break;
|
|
391
|
+
}
|
|
392
|
+
case 'plaintext':
|
|
393
|
+
msgBuffer = content;
|
|
394
|
+
break;
|
|
395
|
+
default:
|
|
396
|
+
throw new Error(`Unknown e2e type: ${e2eType}`);
|
|
397
|
+
}
|
|
398
|
+
if (!msgBuffer) {
|
|
399
|
+
// a skipped streaming msmsg partial leaves nothing to decode
|
|
400
|
+
continue;
|
|
401
|
+
}
|
|
402
|
+
let msg = e2eType === 'msmsg'
|
|
403
|
+
? decodeDecryptedMsmsgMessage(msgBuffer)
|
|
404
|
+
: proto.Message.decode(e2eType !== 'plaintext' ? unpadRandomMax16(msgBuffer) : msgBuffer);
|
|
405
|
+
const outerMessageContextInfo = msg.messageContextInfo;
|
|
406
|
+
msg = msg.deviceSentMessage?.message || msg;
|
|
407
|
+
// deviceSentMessage.message may omit messageContextInfo (which carries the
|
|
408
|
+
// messageSecret for @bot) even though the outer wrapper has it — preserve it
|
|
409
|
+
if (outerMessageContextInfo && !msg.messageContextInfo) {
|
|
410
|
+
msg.messageContextInfo = outerMessageContextInfo;
|
|
411
|
+
}
|
|
412
|
+
if (msg.senderKeyDistributionMessage) {
|
|
413
|
+
//eslint-disable-next-line max-depth
|
|
414
|
+
try {
|
|
415
|
+
await repository.processSenderKeyDistributionMessage({
|
|
416
|
+
authorJid: author,
|
|
417
|
+
item: msg.senderKeyDistributionMessage
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
catch (err) {
|
|
421
|
+
logger.error({ key: fullMessage.key, err }, 'failed to process sender key distribution message');
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (fullMessage.message) {
|
|
425
|
+
Object.assign(fullMessage.message, msg);
|
|
426
|
+
}
|
|
427
|
+
else {
|
|
428
|
+
fullMessage.message = msg;
|
|
429
|
+
}
|
|
430
|
+
// stash the messageSecret from any message — the AI group server can set it
|
|
431
|
+
// on any of them, and the msmsg reply needs it to decrypt
|
|
432
|
+
const secret = msg.messageContextInfo?.messageSecret;
|
|
433
|
+
if (secret) {
|
|
434
|
+
setBotMessageSecret(fullMessage.key.id, secret, fullMessage.key.remoteJid);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
catch (err) {
|
|
438
|
+
const errorContext = {
|
|
439
|
+
key: fullMessage.key,
|
|
440
|
+
err,
|
|
441
|
+
messageType: tag === 'plaintext' ? 'plaintext' : attrs.type,
|
|
442
|
+
sender,
|
|
443
|
+
author,
|
|
444
|
+
isSessionRecordError: isSessionRecordError(err)
|
|
445
|
+
};
|
|
446
|
+
logger.error(errorContext, 'failed to decrypt message');
|
|
447
|
+
fullMessage.messageStubType = proto.WebMessageInfo.StubType.CIPHERTEXT;
|
|
448
|
+
fullMessage.messageStubParameters = [err.message.toString()];
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
// if nothing was found to decrypt
|
|
453
|
+
if (!decryptables && !fullMessage.key?.isViewOnce) {
|
|
454
|
+
fullMessage.messageStubType = proto.WebMessageInfo.StubType.CIPHERTEXT;
|
|
455
|
+
fullMessage.messageStubParameters = [NO_MESSAGE_FOUND_ERROR_TEXT];
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
};
|
|
459
|
+
};
|
|
460
|
+
/**
|
|
461
|
+
* Utility function to check if an error is related to missing session record
|
|
462
|
+
*/
|
|
463
|
+
function isSessionRecordError(error) {
|
|
464
|
+
const errorMessage = error?.message || error?.toString() || '';
|
|
465
|
+
return DECRYPTION_RETRY_CONFIG.sessionRecordErrors.some(errorPattern => errorMessage.includes(errorPattern));
|
|
466
|
+
}
|
|
467
|
+
//# sourceMappingURL=decode-wa-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-wa-message.js","sourceRoot":"","sources":["../../src/Utils/decode-wa-message.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAA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wBACF,MAAM,CAAC,KAAK,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;wBACxD,WAAW,CAAC,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC;wBACvE,WAAW,CAAC,qBAAqB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;oBACjE,CAAC;gBACL,CAAC;YACL,CAAC;YACD,kCAAkC;YAClC,IAAI,CAAC,YAAY,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;gBAChD,WAAW,CAAC,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,UAAU,CAAC;gBACvE,WAAW,CAAC,qBAAqB,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACtE,CAAC;QACL,CAAC;KACJ,CAAC;AACN,CAAC,CAAC;AACF;;GAEG;AACH,SAAS,oBAAoB,CAAC,KAAK;IAC/B,MAAM,YAAY,GAAG,KAAK,EAAE,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC/D,OAAO,uBAAuB,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC;AACjH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function makeEventBuffer(logger: any): {
|
|
2
|
+
process(handler: any): () => void;
|
|
3
|
+
emit(event: any, evData: any): any;
|
|
4
|
+
isBuffering(): boolean;
|
|
5
|
+
buffer: () => void;
|
|
6
|
+
flush: () => boolean;
|
|
7
|
+
createBufferedFunction(work: any): (...args: any[]) => Promise<any>;
|
|
8
|
+
on: (...args: any[]) => any;
|
|
9
|
+
off: (...args: any[]) => any;
|
|
10
|
+
removeAllListeners: (...args: any[]) => any;
|
|
11
|
+
destroy(): void;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=event-buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-buffer.d.ts","sourceRoot":"","sources":["../../src/Utils/event-buffer.js"],"names":[],"mappings":"AAwBO;;;;;;wCAqHmB,GAAG,WAAI;;;;;EAoDhC"}
|