@eduh_dev021/baileys 1.0.0 → 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 +0 -0
- package/README.md +1526 -178
- package/WAProto/index.d.ts +1 -1
- package/WAProto/index.js +1 -1
- package/cjs/WAProto/index.d.ts +1 -1
- package/cjs/WAProto/index.js +0 -0
- package/cjs/engine-requirements.js +0 -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 +0 -0
- package/cjs/lib/Addon/http-error.js +0 -0
- package/cjs/lib/Addon/index.d.ts +93 -0
- package/cjs/lib/Addon/index.js +18 -10
- package/cjs/lib/Addon/keyed-db.d.ts +0 -0
- package/cjs/lib/Addon/keyed-db.js +0 -0
- package/cjs/lib/Addon/link-preview.d.ts +0 -0
- package/cjs/lib/Addon/link-preview.js +0 -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 +2 -2
- package/cjs/lib/Defaults/index.js +2 -2
- package/cjs/lib/Signal/Group/ciphertext-message.d.ts +0 -0
- package/cjs/lib/Signal/Group/ciphertext-message.js +0 -0
- package/cjs/lib/Signal/Group/group-cipher.d.ts +0 -0
- package/cjs/lib/Signal/Group/group-cipher.js +0 -0
- package/cjs/lib/Signal/Group/group-session-builder.d.ts +0 -0
- package/cjs/lib/Signal/Group/group-session-builder.js +0 -0
- package/cjs/lib/Signal/Group/index.d.ts +0 -0
- package/cjs/lib/Signal/Group/index.js +0 -0
- package/cjs/lib/Signal/Group/keyhelper.d.ts +0 -0
- package/cjs/lib/Signal/Group/keyhelper.js +0 -0
- package/cjs/lib/Signal/Group/sender-chain-key.d.ts +0 -0
- package/cjs/lib/Signal/Group/sender-chain-key.js +0 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.js +0 -0
- package/cjs/lib/Signal/Group/sender-key-message.d.ts +0 -0
- package/cjs/lib/Signal/Group/sender-key-message.js +0 -0
- package/cjs/lib/Signal/Group/sender-key-name.d.ts +0 -0
- package/cjs/lib/Signal/Group/sender-key-name.js +0 -0
- package/cjs/lib/Signal/Group/sender-key-record.d.ts +0 -0
- package/cjs/lib/Signal/Group/sender-key-record.js +0 -0
- package/cjs/lib/Signal/Group/sender-key-state.d.ts +0 -0
- package/cjs/lib/Signal/Group/sender-key-state.js +0 -0
- package/cjs/lib/Signal/Group/sender-message-key.d.ts +0 -0
- package/cjs/lib/Signal/Group/sender-message-key.js +0 -0
- package/cjs/lib/Signal/libsignal.d.ts +0 -0
- package/cjs/lib/Signal/libsignal.js +0 -0
- package/cjs/lib/Signal/lid-mapping.d.ts +0 -0
- package/cjs/lib/Signal/lid-mapping.js +0 -0
- package/cjs/lib/Socket/Client/index.d.ts +0 -0
- package/cjs/lib/Socket/Client/index.js +0 -0
- package/cjs/lib/Socket/Client/types.d.ts +0 -0
- package/cjs/lib/Socket/Client/types.js +0 -0
- package/cjs/lib/Socket/Client/websocket.d.ts +0 -0
- package/cjs/lib/Socket/Client/websocket.js +0 -0
- package/cjs/lib/Socket/business.d.ts +0 -0
- package/cjs/lib/Socket/business.js +0 -0
- package/cjs/lib/Socket/chats.d.ts +0 -0
- package/cjs/lib/Socket/chats.js +0 -0
- package/cjs/lib/Socket/communities.d.ts +0 -0
- package/cjs/lib/Socket/communities.js +0 -0
- package/cjs/lib/Socket/groups.d.ts +0 -0
- package/cjs/lib/Socket/groups.js +0 -0
- package/cjs/lib/Socket/index.d.ts +0 -0
- package/cjs/lib/Socket/index.js +0 -0
- package/cjs/lib/Socket/messages-recv.d.ts +0 -0
- package/cjs/lib/Socket/messages-recv.js +0 -0
- package/cjs/lib/Socket/messages-send.d.ts +0 -0
- package/cjs/lib/Socket/messages-send.js +7 -7
- package/cjs/lib/Socket/mex.d.ts +0 -0
- package/cjs/lib/Socket/mex.js +0 -0
- package/cjs/lib/Socket/newsletter.d.ts +0 -0
- package/cjs/lib/Socket/newsletter.js +1 -1
- package/cjs/lib/Socket/socket.d.ts +0 -0
- package/cjs/lib/Socket/socket.js +0 -0
- package/cjs/lib/Store/index.d.ts +0 -0
- package/cjs/lib/Store/index.js +0 -0
- package/cjs/lib/Store/make-in-memory-store.d.ts +0 -0
- package/cjs/lib/Store/make-in-memory-store.js +0 -0
- package/cjs/lib/Store/make-ordered-dictionary.d.ts +0 -0
- package/cjs/lib/Store/make-ordered-dictionary.js +0 -0
- package/cjs/lib/Store/object-repository.d.ts +0 -0
- package/cjs/lib/Store/object-repository.js +0 -0
- package/cjs/lib/Transport/crypto.d.ts +0 -0
- package/cjs/lib/Transport/crypto.js +0 -0
- package/cjs/lib/Transport/curve.d.ts +0 -0
- package/cjs/lib/Transport/curve.js +0 -0
- package/cjs/lib/Transport/index.d.ts +0 -0
- package/cjs/lib/Transport/index.js +0 -0
- package/cjs/lib/Transport/internals.d.ts +0 -0
- package/cjs/lib/Transport/internals.js +0 -0
- package/cjs/lib/Transport/session-builder.d.ts +0 -0
- package/cjs/lib/Transport/session-builder.js +0 -0
- package/cjs/lib/Transport/session-cipher.d.ts +0 -0
- package/cjs/lib/Transport/session-cipher.js +0 -0
- package/cjs/lib/Transport/session-record.d.ts +0 -0
- package/cjs/lib/Transport/session-record.js +0 -0
- package/cjs/lib/Types/Auth.d.ts +0 -0
- package/cjs/lib/Types/Auth.js +0 -0
- package/cjs/lib/Types/Bussines.d.ts +0 -0
- package/cjs/lib/Types/Bussines.js +0 -0
- package/cjs/lib/Types/Call.d.ts +0 -0
- package/cjs/lib/Types/Call.js +0 -0
- package/cjs/lib/Types/Chat.d.ts +0 -0
- package/cjs/lib/Types/Chat.js +0 -0
- package/cjs/lib/Types/Contact.d.ts +0 -0
- package/cjs/lib/Types/Contact.js +0 -0
- package/cjs/lib/Types/Events.d.ts +0 -0
- package/cjs/lib/Types/Events.js +0 -0
- package/cjs/lib/Types/GroupMetadata.d.ts +0 -0
- package/cjs/lib/Types/GroupMetadata.js +0 -0
- package/cjs/lib/Types/Label.d.ts +0 -0
- package/cjs/lib/Types/Label.js +0 -0
- package/cjs/lib/Types/LabelAssociation.d.ts +0 -0
- package/cjs/lib/Types/LabelAssociation.js +0 -0
- package/cjs/lib/Types/Message.d.ts +0 -0
- package/cjs/lib/Types/Message.js +0 -0
- package/cjs/lib/Types/Mex.d.ts +0 -0
- package/cjs/lib/Types/Mex.js +0 -0
- package/cjs/lib/Types/Product.d.ts +0 -0
- package/cjs/lib/Types/Product.js +0 -0
- package/cjs/lib/Types/RichType.d.ts +0 -0
- package/cjs/lib/Types/RichType.js +0 -0
- package/cjs/lib/Types/Signal.d.ts +0 -0
- package/cjs/lib/Types/Signal.js +0 -0
- package/cjs/lib/Types/Socket.d.ts +0 -0
- package/cjs/lib/Types/Socket.js +0 -0
- package/cjs/lib/Types/State.d.ts +0 -0
- package/cjs/lib/Types/State.js +0 -0
- package/cjs/lib/Types/USync.d.ts +0 -0
- package/cjs/lib/Types/USync.js +0 -0
- package/cjs/lib/Types/index.d.ts +0 -0
- package/cjs/lib/Types/index.js +0 -0
- package/cjs/lib/Utils/auth-utils.d.ts +0 -0
- package/cjs/lib/Utils/auth-utils.js +0 -0
- package/cjs/lib/Utils/browser-utils.d.ts +0 -0
- package/cjs/lib/Utils/browser-utils.js +0 -0
- package/cjs/lib/Utils/business.d.ts +0 -0
- package/cjs/lib/Utils/business.js +0 -0
- package/cjs/lib/Utils/chat-utils.d.ts +0 -0
- package/cjs/lib/Utils/chat-utils.js +0 -0
- package/cjs/lib/Utils/companion-reg-client-utils.d.ts +0 -0
- package/cjs/lib/Utils/companion-reg-client-utils.js +0 -0
- package/cjs/lib/Utils/crypto.d.ts +0 -0
- package/cjs/lib/Utils/crypto.js +0 -0
- package/cjs/lib/Utils/decode-wa-message.d.ts +0 -0
- package/cjs/lib/Utils/decode-wa-message.js +0 -0
- package/cjs/lib/Utils/event-buffer.d.ts +0 -0
- package/cjs/lib/Utils/event-buffer.js +0 -0
- package/cjs/lib/Utils/generics.d.ts +0 -0
- package/cjs/lib/Utils/generics.js +1 -1
- package/cjs/lib/Utils/history.d.ts +0 -0
- package/cjs/lib/Utils/history.js +0 -0
- package/cjs/lib/Utils/identity-change-handler.d.ts +0 -0
- package/cjs/lib/Utils/identity-change-handler.js +0 -0
- package/cjs/lib/Utils/index.d.ts +0 -0
- package/cjs/lib/Utils/index.js +0 -0
- package/cjs/lib/Utils/link-preview.d.ts +0 -0
- package/cjs/lib/Utils/link-preview.js +0 -0
- package/cjs/lib/Utils/logger.d.ts +0 -0
- package/cjs/lib/Utils/logger.js +0 -0
- package/cjs/lib/Utils/lt-hash.d.ts +0 -0
- package/cjs/lib/Utils/lt-hash.js +0 -0
- package/cjs/lib/Utils/make-mutex.d.ts +0 -0
- package/cjs/lib/Utils/make-mutex.js +0 -0
- package/cjs/lib/Utils/message-retry-manager.d.ts +0 -0
- package/cjs/lib/Utils/message-retry-manager.js +0 -0
- package/cjs/lib/Utils/messages-media.d.ts +0 -0
- package/cjs/lib/Utils/messages-media.js +0 -0
- package/cjs/lib/Utils/messages.d.ts +0 -0
- package/cjs/lib/Utils/messages.js +11 -11
- package/cjs/lib/Utils/noise-handler.d.ts +0 -0
- package/cjs/lib/Utils/noise-handler.js +0 -0
- package/cjs/lib/Utils/offline-node-processor.d.ts +0 -0
- package/cjs/lib/Utils/offline-node-processor.js +0 -0
- package/cjs/lib/Utils/pre-key-manager.d.ts +0 -0
- package/cjs/lib/Utils/pre-key-manager.js +0 -0
- package/cjs/lib/Utils/process-message.d.ts +0 -0
- package/cjs/lib/Utils/process-message.js +0 -0
- package/cjs/lib/Utils/reporting-utils.d.ts +0 -0
- package/cjs/lib/Utils/reporting-utils.js +0 -0
- package/cjs/lib/Utils/rich-message-utils.d.ts +0 -0
- package/cjs/lib/Utils/rich-message-utils.js +6 -6
- package/cjs/lib/Utils/signal.d.ts +0 -0
- package/cjs/lib/Utils/signal.js +0 -0
- package/cjs/lib/Utils/stanza-ack.d.ts +0 -0
- package/cjs/lib/Utils/stanza-ack.js +0 -0
- package/cjs/lib/Utils/sync-action-utils.d.ts +0 -0
- package/cjs/lib/Utils/sync-action-utils.js +0 -0
- package/cjs/lib/Utils/tc-token-utils.d.ts +0 -0
- package/cjs/lib/Utils/tc-token-utils.js +0 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.d.ts +0 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.js +0 -0
- package/cjs/lib/Utils/use-single-file-auth-state.d.ts +0 -0
- package/cjs/lib/Utils/use-single-file-auth-state.js +0 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.d.ts +0 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.js +0 -0
- package/cjs/lib/Utils/validate-connection.d.ts +0 -0
- package/cjs/lib/Utils/validate-connection.js +0 -0
- package/cjs/lib/WABinary/constants.d.ts +0 -0
- package/cjs/lib/WABinary/constants.js +0 -0
- package/cjs/lib/WABinary/decode.d.ts +0 -0
- package/cjs/lib/WABinary/decode.js +0 -0
- package/cjs/lib/WABinary/encode.d.ts +0 -0
- package/cjs/lib/WABinary/encode.js +0 -0
- package/cjs/lib/WABinary/generic-utils.d.ts +0 -0
- package/cjs/lib/WABinary/generic-utils.js +0 -0
- package/cjs/lib/WABinary/index.d.ts +0 -0
- package/cjs/lib/WABinary/index.js +0 -0
- package/cjs/lib/WABinary/jid-utils.d.ts +0 -0
- package/cjs/lib/WABinary/jid-utils.js +0 -0
- package/cjs/lib/WABinary/types.d.ts +0 -0
- package/cjs/lib/WABinary/types.js +0 -0
- package/cjs/lib/WACrypto/appstate-keys.js +0 -0
- package/cjs/lib/WACrypto/curves/constants.js +0 -0
- package/cjs/lib/WACrypto/hkdf.js +0 -0
- package/cjs/lib/WACrypto/index.js +0 -0
- package/cjs/lib/WACrypto/lthash.js +0 -0
- package/cjs/lib/WACrypto/math/constants.js +0 -0
- package/cjs/lib/WACrypto/math/edwards.js +0 -0
- package/cjs/lib/WACrypto/math/fe.js +0 -0
- package/cjs/lib/WACrypto/math/le.js +0 -0
- package/cjs/lib/WACrypto/math/mod.js +0 -0
- package/cjs/lib/WACrypto/util/bytes.js +0 -0
- package/cjs/lib/WACrypto/x25519.js +0 -0
- package/cjs/lib/WACrypto/xeddsa.js +0 -0
- package/cjs/lib/WAM/BinaryInfo.d.ts +0 -0
- package/cjs/lib/WAM/BinaryInfo.js +0 -0
- package/cjs/lib/WAM/constants.d.ts +0 -0
- package/cjs/lib/WAM/constants.js +0 -0
- package/cjs/lib/WAM/encode.d.ts +0 -0
- package/cjs/lib/WAM/encode.js +0 -0
- package/cjs/lib/WAM/index.d.ts +0 -0
- package/cjs/lib/WAM/index.js +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -0
- package/cjs/lib/WAUSync/Protocols/index.d.ts +0 -0
- package/cjs/lib/WAUSync/Protocols/index.js +0 -0
- package/cjs/lib/WAUSync/USyncQuery.d.ts +0 -0
- package/cjs/lib/WAUSync/USyncQuery.js +0 -0
- package/cjs/lib/WAUSync/USyncUser.d.ts +0 -0
- package/cjs/lib/WAUSync/USyncUser.js +0 -0
- package/cjs/lib/WAUSync/index.d.ts +0 -0
- package/cjs/lib/WAUSync/index.js +0 -0
- package/cjs/lib/index.d.ts +0 -0
- package/cjs/lib/index.js +0 -0
- package/cjs/package.json +0 -0
- package/engine-requirements.js +0 -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 +0 -0
- package/lib/Addon/http-error.js +0 -0
- package/lib/Addon/index.d.ts +93 -0
- package/lib/Addon/index.js +23 -1
- package/lib/Addon/keyed-db.d.ts +0 -0
- package/lib/Addon/keyed-db.js +0 -0
- package/lib/Addon/link-preview.d.ts +0 -0
- package/lib/Addon/link-preview.js +0 -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 +2 -2
- package/lib/Defaults/index.js +3 -3
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -0
- package/lib/Signal/Group/ciphertext-message.js +0 -0
- package/lib/Signal/Group/group-cipher.d.ts +0 -0
- package/lib/Signal/Group/group-cipher.js +0 -0
- package/lib/Signal/Group/group-session-builder.d.ts +0 -0
- package/lib/Signal/Group/group-session-builder.js +0 -0
- package/lib/Signal/Group/index.d.ts +0 -0
- package/lib/Signal/Group/index.js +0 -0
- package/lib/Signal/Group/keyhelper.d.ts +0 -0
- package/lib/Signal/Group/keyhelper.js +0 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -0
- package/lib/Signal/Group/sender-chain-key.js +0 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +0 -0
- package/lib/Signal/Group/sender-key-message.d.ts +0 -0
- package/lib/Signal/Group/sender-key-message.js +0 -0
- package/lib/Signal/Group/sender-key-name.d.ts +0 -0
- package/lib/Signal/Group/sender-key-name.js +0 -0
- package/lib/Signal/Group/sender-key-record.d.ts +0 -0
- package/lib/Signal/Group/sender-key-record.js +0 -0
- package/lib/Signal/Group/sender-key-state.d.ts +0 -0
- package/lib/Signal/Group/sender-key-state.js +0 -0
- package/lib/Signal/Group/sender-message-key.d.ts +0 -0
- package/lib/Signal/Group/sender-message-key.js +0 -0
- package/lib/Signal/libsignal.d.ts +0 -0
- package/lib/Signal/libsignal.js +0 -0
- package/lib/Signal/lid-mapping.d.ts +0 -0
- package/lib/Signal/lid-mapping.js +0 -0
- package/lib/Socket/Client/index.d.ts +0 -0
- package/lib/Socket/Client/index.js +0 -0
- package/lib/Socket/Client/types.d.ts +0 -0
- package/lib/Socket/Client/types.js +0 -0
- package/lib/Socket/Client/websocket.d.ts +0 -0
- package/lib/Socket/Client/websocket.js +0 -0
- package/lib/Socket/business.d.ts +0 -0
- package/lib/Socket/business.js +0 -0
- package/lib/Socket/chats.d.ts +0 -0
- package/lib/Socket/chats.js +1 -1
- package/lib/Socket/communities.d.ts +0 -0
- package/lib/Socket/communities.js +0 -0
- package/lib/Socket/groups.d.ts +0 -0
- package/lib/Socket/groups.js +0 -0
- package/lib/Socket/index.d.ts +0 -0
- package/lib/Socket/index.js +0 -0
- package/lib/Socket/messages-recv.d.ts +0 -0
- package/lib/Socket/messages-recv.js +2 -2
- package/lib/Socket/messages-send.d.ts +0 -0
- package/lib/Socket/messages-send.js +19 -19
- package/lib/Socket/mex.d.ts +0 -0
- package/lib/Socket/mex.js +0 -0
- package/lib/Socket/newsletter.d.ts +0 -0
- package/lib/Socket/newsletter.js +1 -1
- package/lib/Socket/socket.d.ts +0 -0
- package/lib/Socket/socket.js +0 -0
- package/lib/Store/index.d.ts +0 -0
- package/lib/Store/index.js +0 -0
- package/lib/Store/make-in-memory-store.d.ts +0 -0
- package/lib/Store/make-in-memory-store.js +1 -1
- package/lib/Store/make-ordered-dictionary.d.ts +0 -0
- package/lib/Store/make-ordered-dictionary.js +0 -0
- package/lib/Store/object-repository.d.ts +0 -0
- package/lib/Store/object-repository.js +0 -0
- package/lib/Transport/crypto.d.ts +0 -0
- package/lib/Transport/crypto.js +0 -0
- package/lib/Transport/curve.d.ts +0 -0
- package/lib/Transport/curve.js +0 -0
- package/lib/Transport/index.d.ts +0 -0
- package/lib/Transport/index.js +0 -0
- package/lib/Transport/internals.d.ts +0 -0
- package/lib/Transport/internals.js +0 -0
- package/lib/Transport/session-builder.d.ts +0 -0
- package/lib/Transport/session-builder.js +0 -0
- package/lib/Transport/session-cipher.d.ts +0 -0
- package/lib/Transport/session-cipher.js +0 -0
- package/lib/Transport/session-record.d.ts +0 -0
- package/lib/Transport/session-record.js +0 -0
- package/lib/Types/Auth.d.ts +0 -0
- package/lib/Types/Auth.js +0 -0
- package/lib/Types/Bussines.d.ts +0 -0
- package/lib/Types/Bussines.js +0 -0
- package/lib/Types/Call.d.ts +0 -0
- package/lib/Types/Call.js +0 -0
- package/lib/Types/Chat.d.ts +0 -0
- package/lib/Types/Chat.js +0 -0
- package/lib/Types/Contact.d.ts +0 -0
- package/lib/Types/Contact.js +0 -0
- package/lib/Types/Events.d.ts +0 -0
- package/lib/Types/Events.js +0 -0
- package/lib/Types/GroupMetadata.d.ts +0 -0
- package/lib/Types/GroupMetadata.js +0 -0
- package/lib/Types/Label.d.ts +0 -0
- package/lib/Types/Label.js +0 -0
- package/lib/Types/LabelAssociation.d.ts +0 -0
- package/lib/Types/LabelAssociation.js +0 -0
- package/lib/Types/Message.d.ts +0 -0
- package/lib/Types/Message.js +1 -1
- package/lib/Types/Mex.d.ts +0 -0
- package/lib/Types/Mex.js +0 -0
- package/lib/Types/Product.d.ts +0 -0
- package/lib/Types/Product.js +0 -0
- package/lib/Types/RichType.d.ts +0 -0
- package/lib/Types/RichType.js +0 -0
- package/lib/Types/Signal.d.ts +0 -0
- package/lib/Types/Signal.js +0 -0
- package/lib/Types/Socket.d.ts +0 -0
- package/lib/Types/Socket.js +0 -0
- package/lib/Types/State.d.ts +0 -0
- package/lib/Types/State.js +0 -0
- package/lib/Types/USync.d.ts +0 -0
- package/lib/Types/USync.js +0 -0
- package/lib/Types/index.d.ts +0 -0
- package/lib/Types/index.js +0 -0
- package/lib/Utils/auth-utils.d.ts +0 -0
- package/lib/Utils/auth-utils.js +0 -0
- package/lib/Utils/browser-utils.d.ts +0 -0
- package/lib/Utils/browser-utils.js +0 -0
- package/lib/Utils/business.d.ts +0 -0
- package/lib/Utils/business.js +0 -0
- package/lib/Utils/chat-utils.d.ts +0 -0
- package/lib/Utils/chat-utils.js +0 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +0 -0
- package/lib/Utils/companion-reg-client-utils.js +0 -0
- package/lib/Utils/crypto.d.ts +0 -0
- package/lib/Utils/crypto.js +0 -0
- package/lib/Utils/decode-wa-message.d.ts +0 -0
- package/lib/Utils/decode-wa-message.js +0 -0
- package/lib/Utils/event-buffer.d.ts +0 -0
- package/lib/Utils/event-buffer.js +0 -0
- package/lib/Utils/generics.d.ts +0 -0
- package/lib/Utils/generics.js +1 -1
- package/lib/Utils/history.d.ts +0 -0
- package/lib/Utils/history.js +0 -0
- package/lib/Utils/identity-change-handler.d.ts +0 -0
- package/lib/Utils/identity-change-handler.js +0 -0
- package/lib/Utils/index.d.ts +0 -0
- package/lib/Utils/index.js +0 -0
- package/lib/Utils/link-preview.d.ts +0 -0
- package/lib/Utils/link-preview.js +0 -0
- package/lib/Utils/logger.d.ts +0 -0
- package/lib/Utils/logger.js +0 -0
- package/lib/Utils/lt-hash.d.ts +0 -0
- package/lib/Utils/lt-hash.js +0 -0
- package/lib/Utils/make-mutex.d.ts +0 -0
- package/lib/Utils/make-mutex.js +0 -0
- package/lib/Utils/message-retry-manager.d.ts +0 -0
- package/lib/Utils/message-retry-manager.js +0 -0
- package/lib/Utils/messages-media.d.ts +0 -0
- package/lib/Utils/messages-media.js +2 -2
- package/lib/Utils/messages.d.ts +0 -0
- package/lib/Utils/messages.js +46 -50
- package/lib/Utils/noise-handler.d.ts +0 -0
- package/lib/Utils/noise-handler.js +0 -0
- package/lib/Utils/offline-node-processor.d.ts +0 -0
- package/lib/Utils/offline-node-processor.js +0 -0
- package/lib/Utils/pre-key-manager.d.ts +0 -0
- package/lib/Utils/pre-key-manager.js +0 -0
- package/lib/Utils/process-message.d.ts +0 -0
- package/lib/Utils/process-message.js +0 -0
- package/lib/Utils/reporting-utils.d.ts +0 -0
- package/lib/Utils/reporting-utils.js +0 -0
- package/lib/Utils/rich-message-utils.d.ts +0 -0
- package/lib/Utils/rich-message-utils.js +10 -13
- package/lib/Utils/signal.d.ts +0 -0
- package/lib/Utils/signal.js +0 -0
- package/lib/Utils/stanza-ack.d.ts +0 -0
- package/lib/Utils/stanza-ack.js +0 -0
- package/lib/Utils/sync-action-utils.d.ts +0 -0
- package/lib/Utils/sync-action-utils.js +0 -0
- package/lib/Utils/tc-token-utils.d.ts +0 -0
- package/lib/Utils/tc-token-utils.js +0 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +0 -0
- package/lib/Utils/use-multi-file-auth-state.js +1 -1
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -0
- package/lib/Utils/use-single-file-auth-state.js +1 -1
- package/lib/Utils/use-sqlite-auth-state.d.ts +0 -0
- package/lib/Utils/use-sqlite-auth-state.js +1 -1
- package/lib/Utils/validate-connection.d.ts +0 -0
- package/lib/Utils/validate-connection.js +0 -0
- package/lib/WABinary/constants.d.ts +0 -0
- package/lib/WABinary/constants.js +0 -0
- package/lib/WABinary/decode.d.ts +0 -0
- package/lib/WABinary/decode.js +0 -0
- package/lib/WABinary/encode.d.ts +0 -0
- package/lib/WABinary/encode.js +0 -0
- package/lib/WABinary/generic-utils.d.ts +0 -0
- package/lib/WABinary/generic-utils.js +0 -2
- package/lib/WABinary/index.d.ts +0 -0
- package/lib/WABinary/index.js +0 -0
- package/lib/WABinary/jid-utils.d.ts +0 -0
- package/lib/WABinary/jid-utils.js +0 -0
- package/lib/WABinary/types.d.ts +0 -0
- package/lib/WABinary/types.js +0 -0
- package/lib/WACrypto/appstate-keys.js +0 -0
- package/lib/WACrypto/curves/constants.js +0 -0
- package/lib/WACrypto/hkdf.js +0 -0
- package/lib/WACrypto/index.js +0 -0
- package/lib/WACrypto/lthash.js +1 -1
- package/lib/WACrypto/math/constants.js +0 -0
- package/lib/WACrypto/math/edwards.js +0 -0
- package/lib/WACrypto/math/fe.js +0 -0
- package/lib/WACrypto/math/le.js +0 -0
- package/lib/WACrypto/math/mod.js +0 -0
- package/lib/WACrypto/util/bytes.js +0 -0
- package/lib/WACrypto/x25519.js +3 -3
- package/lib/WACrypto/xeddsa.js +0 -0
- package/lib/WAM/BinaryInfo.d.ts +0 -0
- package/lib/WAM/BinaryInfo.js +0 -0
- package/lib/WAM/constants.d.ts +0 -0
- package/lib/WAM/constants.js +0 -0
- package/lib/WAM/encode.d.ts +0 -0
- package/lib/WAM/encode.js +0 -0
- package/lib/WAM/index.d.ts +0 -0
- package/lib/WAM/index.js +0 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -0
- package/lib/WAUSync/Protocols/index.d.ts +0 -0
- package/lib/WAUSync/Protocols/index.js +0 -0
- package/lib/WAUSync/USyncQuery.d.ts +0 -0
- package/lib/WAUSync/USyncQuery.js +0 -0
- package/lib/WAUSync/USyncUser.d.ts +0 -0
- package/lib/WAUSync/USyncUser.js +0 -0
- package/lib/WAUSync/index.d.ts +0 -0
- package/lib/WAUSync/index.js +0 -0
- package/lib/index.d.ts +0 -0
- package/lib/index.js +0 -0
- package/package.json +4 -9
- package/tests/addon-test.mjs +162 -0
- package/tests/differential-test.mjs +90 -0
package/lib/Utils/messages.js
CHANGED
|
@@ -136,7 +136,7 @@ export const prepareWAMessageMedia = async (message, options) => {
|
|
|
136
136
|
catch (error) {
|
|
137
137
|
logger?.warn({ trace: error.stack }, 'failed to obtain extra info');
|
|
138
138
|
}
|
|
139
|
-
})
|
|
139
|
+
})
|
|
140
140
|
]).finally(async () => {
|
|
141
141
|
try {
|
|
142
142
|
await fs.unlink(filePath);
|
|
@@ -220,7 +220,7 @@ export const prepareWAMessageMedia = async (message, options) => {
|
|
|
220
220
|
catch (error) {
|
|
221
221
|
logger?.warn({ trace: error.stack }, 'failed to obtain extra info');
|
|
222
222
|
}
|
|
223
|
-
})
|
|
223
|
+
})
|
|
224
224
|
]).finally(async () => {
|
|
225
225
|
try {
|
|
226
226
|
await fs.unlink(encFilePath);
|
|
@@ -256,13 +256,13 @@ export const prepareWAMessageMedia = async (message, options) => {
|
|
|
256
256
|
}
|
|
257
257
|
return obj;
|
|
258
258
|
};
|
|
259
|
-
//
|
|
259
|
+
// Extract product message into a standalone function so it can also be reused as the header for interactive messages
|
|
260
260
|
const prepareProductMessage = async (message, options) => {
|
|
261
261
|
if (!message.businessOwnerJid) {
|
|
262
262
|
throw new HttpError('"businessOwnerJid" is missing from the content', { statusCode: 400 });
|
|
263
263
|
}
|
|
264
264
|
const { imageMessage } = await prepareWAMessageMedia({ image: message.image || message.product.productImage }, options);
|
|
265
|
-
//
|
|
265
|
+
// Add product message default value
|
|
266
266
|
const { image, ...content } = message;
|
|
267
267
|
content.product = {
|
|
268
268
|
currencyCode: 'IDR',
|
|
@@ -274,14 +274,12 @@ const prepareProductMessage = async (message, options) => {
|
|
|
274
274
|
return content;
|
|
275
275
|
};
|
|
276
276
|
/**
|
|
277
|
-
* Lia@Note 30-01-26
|
|
278
|
-
* ---
|
|
279
277
|
* Credits: Work on ensuring stickerPackMessage fields are valid by @jlucaso1 (https://github.com/jlucaso1).
|
|
280
278
|
* based on https://github.com/WhiskeySockets/Baileys/pull/1561
|
|
281
279
|
*/
|
|
282
|
-
//
|
|
280
|
+
// Enhanced prepareStickerPackMessage
|
|
283
281
|
const prepareStickerPackMessage = async (message, options) => {
|
|
284
|
-
const { cover, stickers = [], name = '📦 Sticker Pack', publisher = 'GitHub:
|
|
282
|
+
const { cover, stickers = [], name = '📦 Sticker Pack', publisher = 'GitHub: eduh_dev021', description = '🏷️ eduh_dev021/baileys' } = message;
|
|
285
283
|
if (stickers.length > 60) {
|
|
286
284
|
throw new HttpError('Sticker pack exceeds the maximum limit of 60 stickers', { statusCode: 400 });
|
|
287
285
|
}
|
|
@@ -292,7 +290,7 @@ const prepareStickerPackMessage = async (message, options) => {
|
|
|
292
290
|
throw new HttpError('Sticker pack must contain a cover', { statusCode: 400 });
|
|
293
291
|
}
|
|
294
292
|
const logger = options.logger;
|
|
295
|
-
//
|
|
293
|
+
// Add caching for sticker pack
|
|
296
294
|
let cacheableKey = false;
|
|
297
295
|
if (Array.isArray(stickers) && stickers.length && options.mediaCache) {
|
|
298
296
|
const urls = [];
|
|
@@ -477,18 +475,18 @@ const prepareStickerPackMessage = async (message, options) => {
|
|
|
477
475
|
}
|
|
478
476
|
return payload;
|
|
479
477
|
};
|
|
480
|
-
//
|
|
478
|
+
// Add native flow button helper for interactive message
|
|
481
479
|
const prepareNativeFlowButtons = (message) => {
|
|
482
480
|
const buttons = message.nativeFlow;
|
|
483
481
|
const isButtonsFieldArray = Array.isArray(buttons);
|
|
484
482
|
const correctedField = isButtonsFieldArray ? buttons : buttons.buttons;
|
|
485
483
|
const messageParamsJson = {};
|
|
486
|
-
//
|
|
484
|
+
// Add offer and options inside interactive message
|
|
487
485
|
if (hasOptionalProperty(message, 'offerText') && !!message.offerText) {
|
|
488
486
|
Object.assign(messageParamsJson, {
|
|
489
487
|
limited_time_offer: {
|
|
490
488
|
text: message.offerText || LIBRARY_NAME,
|
|
491
|
-
url: message.offerUrl || DONATE_URL, //
|
|
489
|
+
url: message.offerUrl || DONATE_URL, // Apologies if this feels cheeky, just a fallback
|
|
492
490
|
copy_code: message.offerCode,
|
|
493
491
|
expiration_time: message.offerExpiration
|
|
494
492
|
}
|
|
@@ -550,7 +548,7 @@ const prepareNativeFlowButtons = (message) => {
|
|
|
550
548
|
})
|
|
551
549
|
};
|
|
552
550
|
}
|
|
553
|
-
//
|
|
551
|
+
// Add "single_select" shortcut \(°o°)/
|
|
554
552
|
else if (hasOptionalProperty(button, 'sections') && !!button.sections) {
|
|
555
553
|
return {
|
|
556
554
|
name: 'single_select',
|
|
@@ -622,7 +620,7 @@ export const hasOptionalProperty = (obj, key) => {
|
|
|
622
620
|
key in obj &&
|
|
623
621
|
obj[key] != null;
|
|
624
622
|
};
|
|
625
|
-
//
|
|
623
|
+
// Validate album message media to avoid errors
|
|
626
624
|
export const hasValidAlbumMedia = (message) => {
|
|
627
625
|
return !!(message.imageMessage ||
|
|
628
626
|
message.videoMessage);
|
|
@@ -634,7 +632,7 @@ export const hasValidInteractiveHeader = (message) => {
|
|
|
634
632
|
message.productMessage ||
|
|
635
633
|
message.locationMessage);
|
|
636
634
|
};
|
|
637
|
-
//
|
|
635
|
+
// Validate carousel cards header to avoid errors
|
|
638
636
|
export const hasValidCarouselHeader = (message) => {
|
|
639
637
|
return !!(message.imageMessage ||
|
|
640
638
|
message.videoMessage ||
|
|
@@ -655,12 +653,12 @@ export const markViewOnce = (m) => {
|
|
|
655
653
|
export const generateWAMessageContent = async (message, options) => {
|
|
656
654
|
var _a, _b;
|
|
657
655
|
let m = {};
|
|
658
|
-
//
|
|
656
|
+
// Add "raw" boolean to send raw messages directly via generateWAMessage
|
|
659
657
|
if (hasNonNullishProperty(message, 'raw')) {
|
|
660
658
|
delete message.raw;
|
|
661
659
|
return message;
|
|
662
660
|
}
|
|
663
|
-
//
|
|
661
|
+
// Add support for code block and table with richResponseMessage
|
|
664
662
|
else if (hasNonNullishProperty(message, 'code') ||
|
|
665
663
|
hasNonNullishProperty(message, 'links') ||
|
|
666
664
|
hasNonNullishProperty(message, 'table') ||
|
|
@@ -878,16 +876,16 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
878
876
|
m.pollCreationMessageV2 = pollCreationMessage;
|
|
879
877
|
}
|
|
880
878
|
else {
|
|
881
|
-
//
|
|
879
|
+
// Add quiz message support
|
|
882
880
|
if (message.poll.pollType === 1) {
|
|
883
881
|
if (!message.poll.correctAnswer) {
|
|
884
882
|
throw new HttpError('No "correctAnswer" provided for quiz', { statusCode: 400 });
|
|
885
883
|
}
|
|
886
884
|
m.pollCreationMessageV5 = {
|
|
887
|
-
//
|
|
885
|
+
// quiz for newsletter only
|
|
888
886
|
...pollCreationMessage,
|
|
889
887
|
correctAnswer: {
|
|
890
|
-
optionName: message.poll.correctAnswer.toString
|
|
888
|
+
optionName: message.poll.correctAnswer.toString
|
|
891
889
|
},
|
|
892
890
|
pollType: 1,
|
|
893
891
|
selectableOptionsCount: 1
|
|
@@ -907,7 +905,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
907
905
|
messageSecret: message.poll.messageSecret || randomBytes(32)
|
|
908
906
|
};
|
|
909
907
|
}
|
|
910
|
-
//
|
|
908
|
+
// Add poll result snapshot message
|
|
911
909
|
else if (hasNonNullishProperty(message, 'pollResult')) {
|
|
912
910
|
const pollResultSnapshotMessage = {
|
|
913
911
|
name: message.pollResult.name,
|
|
@@ -925,7 +923,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
925
923
|
m.pollResultSnapshotMessage = pollResultSnapshotMessage;
|
|
926
924
|
}
|
|
927
925
|
}
|
|
928
|
-
//
|
|
926
|
+
// Add poll update message
|
|
929
927
|
else if (hasNonNullishProperty(message, 'pollUpdate')) {
|
|
930
928
|
if (!message.pollUpdate.key) {
|
|
931
929
|
throw new HttpError('Message key is required', { statusCode: 400 });
|
|
@@ -940,14 +938,14 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
940
938
|
vote: message.pollUpdate.vote
|
|
941
939
|
};
|
|
942
940
|
}
|
|
943
|
-
//
|
|
941
|
+
// Add payment invite message
|
|
944
942
|
else if (hasNonNullishProperty(message, 'paymentInviteServiceType')) {
|
|
945
943
|
m.paymentInviteMessage = {
|
|
946
944
|
expiryTimestamp: Date.now(),
|
|
947
945
|
serviceType: message.paymentInviteServiceType
|
|
948
946
|
};
|
|
949
947
|
}
|
|
950
|
-
//
|
|
948
|
+
// Add order message
|
|
951
949
|
else if (hasNonNullishProperty(message, 'orderText')) {
|
|
952
950
|
if (!Buffer.isBuffer(message.thumbnail)) {
|
|
953
951
|
throw new HttpError('Must provide thumbnail buffer in order message', { statusCode: 400 });
|
|
@@ -966,7 +964,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
966
964
|
};
|
|
967
965
|
delete m.orderMessage.orderText;
|
|
968
966
|
}
|
|
969
|
-
//
|
|
967
|
+
// Add support for album messages
|
|
970
968
|
else if (hasNonNullishProperty(message, 'album')) {
|
|
971
969
|
if (!Array.isArray(message.album)) {
|
|
972
970
|
throw new HttpError('Invalid album type. Expected an array.', { statusCode: 400 });
|
|
@@ -1016,11 +1014,11 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1016
1014
|
else {
|
|
1017
1015
|
m = await prepareWAMessageMedia(message, options);
|
|
1018
1016
|
}
|
|
1019
|
-
//
|
|
1017
|
+
// Add interactive messages (buttonsMessage, listMessage, interactiveMessage, templateMessage, and carouselMessage)
|
|
1020
1018
|
if (hasNonNullishProperty(message, 'buttons')) {
|
|
1021
1019
|
const buttonsMessage = {
|
|
1022
1020
|
buttons: message.buttons.map(button => {
|
|
1023
|
-
//
|
|
1021
|
+
// Add "single_select" shortcut!
|
|
1024
1022
|
const buttonText = button.text || button.buttonText;
|
|
1025
1023
|
if (hasOptionalProperty(button, 'sections')) {
|
|
1026
1024
|
return {
|
|
@@ -1078,7 +1076,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1078
1076
|
};
|
|
1079
1077
|
m = { listMessage };
|
|
1080
1078
|
}
|
|
1081
|
-
//
|
|
1079
|
+
// This message type is shown on WhatsApp Web/Desktop and iOS. On Android, it only appears in newsletters (so far)
|
|
1082
1080
|
else if (hasNonNullishProperty(message, 'templateButtons')) {
|
|
1083
1081
|
const hydratedTemplate = {
|
|
1084
1082
|
hydratedButtons: message.templateButtons.map((button, i) => {
|
|
@@ -1128,7 +1126,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1128
1126
|
if (hasOptionalProperty(message, 'footer')) {
|
|
1129
1127
|
hydratedTemplate.hydratedFooterText = message.footer;
|
|
1130
1128
|
}
|
|
1131
|
-
hydratedTemplate.templateId = message.id || 'template-' + Date.now(); //
|
|
1129
|
+
hydratedTemplate.templateId = message.id || 'template-' + Date.now(); // Minimal templateId to satisfy WhatsApp ( ꈍᴗꈍ)
|
|
1132
1130
|
m = {
|
|
1133
1131
|
templateMessage: {
|
|
1134
1132
|
hydratedFourRowTemplate: hydratedTemplate,
|
|
@@ -1250,7 +1248,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1250
1248
|
}
|
|
1251
1249
|
m = { interactiveMessage };
|
|
1252
1250
|
}
|
|
1253
|
-
//
|
|
1251
|
+
// Add request payment message
|
|
1254
1252
|
else if (hasNonNullishProperty(message, 'requestPaymentFrom')) {
|
|
1255
1253
|
const requestPaymentMessage = {
|
|
1256
1254
|
amount: {
|
|
@@ -1274,7 +1272,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1274
1272
|
}
|
|
1275
1273
|
m = { requestPaymentMessage };
|
|
1276
1274
|
}
|
|
1277
|
-
//
|
|
1275
|
+
// Add invoice message
|
|
1278
1276
|
else if (hasNonNullishProperty(message, 'invoiceNote')) {
|
|
1279
1277
|
const attachment = m.imageMessage || m.documentMessage;
|
|
1280
1278
|
const type = Object.keys(m)[0].replace('Message', '').toUpperCase();
|
|
@@ -1292,7 +1290,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1292
1290
|
attachmentMediaKey: mediaKey,
|
|
1293
1291
|
attachmentMediaKeyTimestamp: mediaKeyTimestamp,
|
|
1294
1292
|
attachmentMimetype: mimetype,
|
|
1295
|
-
token: generateMessageIDV2
|
|
1293
|
+
token: generateMessageIDV2
|
|
1296
1294
|
});
|
|
1297
1295
|
}
|
|
1298
1296
|
else {
|
|
@@ -1300,7 +1298,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1300
1298
|
}
|
|
1301
1299
|
m = { invoiceMessage };
|
|
1302
1300
|
}
|
|
1303
|
-
//
|
|
1301
|
+
// Add direct externalAdReply access (no need to create contextInfo first)
|
|
1304
1302
|
if (hasOptionalProperty(message, 'externalAdReply') && !!message.externalAdReply) {
|
|
1305
1303
|
const messageType = Object.keys(m)[0];
|
|
1306
1304
|
const key = m[messageType];
|
|
@@ -1309,7 +1307,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1309
1307
|
throw new HttpError('Thumbnail must in buffer type', { statusCode: 400 });
|
|
1310
1308
|
}
|
|
1311
1309
|
if (!content.url || typeof content.url !== 'string') {
|
|
1312
|
-
content.url = DONATE_URL; //
|
|
1310
|
+
content.url = DONATE_URL; // Apologies if this feels cheeky, just a fallback
|
|
1313
1311
|
}
|
|
1314
1312
|
const externalAdReply = {
|
|
1315
1313
|
...content,
|
|
@@ -1362,7 +1360,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1362
1360
|
key.contextInfo = message.contextInfo;
|
|
1363
1361
|
}
|
|
1364
1362
|
}
|
|
1365
|
-
//
|
|
1363
|
+
// Add "groupStatus" boolean to set contextInfo.isGroupStatus and wrap message into groupStatusMessageV2
|
|
1366
1364
|
if (hasOptionalProperty(message, 'groupStatus') && !!message.groupStatus) {
|
|
1367
1365
|
const messageType = Object.keys(m)[0];
|
|
1368
1366
|
const key = m[messageType];
|
|
@@ -1377,7 +1375,7 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1377
1375
|
m = { groupStatusMessageV2: { message: m } };
|
|
1378
1376
|
delete message.groupStatus;
|
|
1379
1377
|
}
|
|
1380
|
-
//
|
|
1378
|
+
// Add "spoiler" boolean to set contextInfo.isSpoiler and wrap message into spoilerMessage
|
|
1381
1379
|
if (hasOptionalProperty(message, 'spoiler') && !!message.spoiler) {
|
|
1382
1380
|
const messageType = Object.keys(m)[0];
|
|
1383
1381
|
const key = m[messageType];
|
|
@@ -1392,25 +1390,25 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1392
1390
|
m = { spoilerMessage: { message: m } };
|
|
1393
1391
|
delete message.spoiler;
|
|
1394
1392
|
}
|
|
1395
|
-
//
|
|
1393
|
+
// Add "interactiveAsTemplate" boolean to wrap interactiveMessage into templateMessage
|
|
1396
1394
|
else if (hasOptionalProperty(message, 'interactiveAsTemplate') && !!message.interactiveAsTemplate) {
|
|
1397
1395
|
if (!m.interactiveMessage) {
|
|
1398
|
-
throw new HttpError('Invalid message type for template', { statusCode: 400 });
|
|
1396
|
+
throw new HttpError('Invalid message type for template', { statusCode: 400 });
|
|
1399
1397
|
}
|
|
1400
1398
|
m = {
|
|
1401
1399
|
templateMessage: {
|
|
1402
1400
|
interactiveMessageTemplate: m.interactiveMessage,
|
|
1403
|
-
templateId: message.id || 'template-' + Date.now() //
|
|
1401
|
+
templateId: message.id || 'template-' + Date.now() // Minimal templateId to satisfy WhatsApp ( ꈍᴗꈍ)
|
|
1404
1402
|
}
|
|
1405
1403
|
};
|
|
1406
1404
|
delete message.interactiveAsTemplate;
|
|
1407
1405
|
}
|
|
1408
|
-
//
|
|
1406
|
+
// Add "ephemeral" boolean to wrap message into ephemeralMessage like "viewOnce"
|
|
1409
1407
|
if (hasOptionalProperty(message, 'ephemeral') && !!message.ephemeral) {
|
|
1410
1408
|
m = { ephemeralMessage: { message: m } };
|
|
1411
1409
|
delete message.ephemeral;
|
|
1412
1410
|
}
|
|
1413
|
-
//
|
|
1411
|
+
// Add wrap message into lottieStickerMessage by isLottie boolean
|
|
1414
1412
|
if (hasOptionalProperty(message, 'isLottie') && !!message.isLottie) {
|
|
1415
1413
|
m = { lottieStickerMessage: { message: m } };
|
|
1416
1414
|
}
|
|
@@ -1418,13 +1416,13 @@ export const generateWAMessageContent = async (message, options) => {
|
|
|
1418
1416
|
markViewOnce(m);
|
|
1419
1417
|
m = { viewOnceMessage: { message: m } };
|
|
1420
1418
|
}
|
|
1421
|
-
//
|
|
1419
|
+
// Add "viewOnceV2" boolean to wrap message into viewOnceMessageV2 like "viewOnce"
|
|
1422
1420
|
else if (hasOptionalProperty(message, 'viewOnceV2') && !!message.viewOnceV2) {
|
|
1423
1421
|
markViewOnce(m);
|
|
1424
1422
|
m = { viewOnceMessageV2: { message: m } };
|
|
1425
1423
|
delete message.viewOnceV2;
|
|
1426
1424
|
}
|
|
1427
|
-
//
|
|
1425
|
+
// Add "viewOnceV2Extension" boolean to wrap message into viewOnceMessageV2Extension like "viewOnce"
|
|
1428
1426
|
else if (hasOptionalProperty(message, 'viewOnceV2Extension') && !!message.viewOnceV2Extension) {
|
|
1429
1427
|
markViewOnce(m);
|
|
1430
1428
|
m = { viewOnceMessageV2Extension: { message: m } };
|
|
@@ -1499,14 +1497,14 @@ export const generateWAMessageFromContent = (jid, message, options) => {
|
|
|
1499
1497
|
innerMessage[key].contextInfo = {
|
|
1500
1498
|
...(innerMessage[key].contextInfo || {}),
|
|
1501
1499
|
expiration: options.ephemeralExpiration || WA_DEFAULT_EPHEMERAL
|
|
1502
|
-
//ephemeralSettingTimestamp: options.ephemeralOptions.eph_setting_ts?.toString
|
|
1500
|
+
//ephemeralSettingTimestamp: options.ephemeralOptions.eph_setting_ts?.toString
|
|
1503
1501
|
};
|
|
1504
1502
|
}
|
|
1505
|
-
//
|
|
1503
|
+
// Add deviceListMetadata inside messageContextInfo for private chat
|
|
1506
1504
|
if (messageContextInfo?.messageSecret && (isPnUser(jid) || isLidUser(jid))) {
|
|
1507
1505
|
messageContextInfo.deviceListMetadata = {
|
|
1508
1506
|
recipientKeyHash: randomBytes(10),
|
|
1509
|
-
recipientTimestamp: unixTimestampSeconds
|
|
1507
|
+
recipientTimestamp: unixTimestampSeconds
|
|
1510
1508
|
};
|
|
1511
1509
|
messageContextInfo.deviceListMetadataVersion = 2;
|
|
1512
1510
|
}
|
|
@@ -1514,7 +1512,7 @@ export const generateWAMessageFromContent = (jid, message, options) => {
|
|
|
1514
1512
|
key: {
|
|
1515
1513
|
remoteJid: jid,
|
|
1516
1514
|
fromMe: true,
|
|
1517
|
-
id: options?.messageId || generateMessageIDV2
|
|
1515
|
+
id: options?.messageId || generateMessageIDV2
|
|
1518
1516
|
},
|
|
1519
1517
|
message: ensureMessageProto(message),
|
|
1520
1518
|
messageTimestamp: timestamp,
|
|
@@ -1559,7 +1557,7 @@ export const normalizeMessageContent = (content) => {
|
|
|
1559
1557
|
content = inner.message;
|
|
1560
1558
|
}
|
|
1561
1559
|
return content;
|
|
1562
|
-
//
|
|
1560
|
+
// Add all futureProofMessage into getFutureProofMessage
|
|
1563
1561
|
function getFutureProofMessage(message) {
|
|
1564
1562
|
return (message?.acp2SettingMessage ||
|
|
1565
1563
|
message?.associatedChildMessage ||
|
|
@@ -1886,8 +1884,6 @@ const isWebPBuffer = (buffer) => {
|
|
|
1886
1884
|
buffer[11] === 0x50);
|
|
1887
1885
|
};
|
|
1888
1886
|
/**
|
|
1889
|
-
* Lia@Changes 30-01-26
|
|
1890
|
-
* ---
|
|
1891
1887
|
* Determines whether a message should include a Biz Binary Node.
|
|
1892
1888
|
* A Biz Binary Node is added only for interactive messages
|
|
1893
1889
|
* such as buttons or other supported interactive types.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Lia@Changes 09-04-26 [WIP]
|
|
3
2
|
* Adds support for tables and code blocks with richResponseMessage (wrapped inside botForwardedMessage).
|
|
4
|
-
*
|
|
5
|
-
* If you use or copy this code, please credit my name or project. AND DO NOT CHANGE THIS NOTE
|
|
6
3
|
*/
|
|
7
4
|
import { getRandomValues, randomUUID } from 'node:crypto';
|
|
8
5
|
import { DONATE_URL, LEXER_REGEX, TEXT_ENCODER } from '../Defaults/index.js';
|
|
@@ -44,7 +41,7 @@ export const tokenizeCode = (code, language = 'javascript') => {
|
|
|
44
41
|
}
|
|
45
42
|
return blocks;
|
|
46
43
|
};
|
|
47
|
-
//
|
|
44
|
+
// Inject buffer into unifiedResponse.data to support proper rendering of rich messages (ex: tables and code blocks)
|
|
48
45
|
export const toUnified = (submessages, uuid) => ({
|
|
49
46
|
response_id: uuid || randomUUID(),
|
|
50
47
|
sections: submessages.map((submessage, index) => {
|
|
@@ -248,8 +245,8 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
248
245
|
const url = linkField.url || DONATE_URL;
|
|
249
246
|
const sources = linkField.sources?.map((sourceField) => ({
|
|
250
247
|
source_type: 'THIRD_PARTY',
|
|
251
|
-
source_display_name: sourceField.displayName || '
|
|
252
|
-
source_subtitle: sourceField.subtitle || '
|
|
248
|
+
source_display_name: sourceField.displayName || 'Source',
|
|
249
|
+
source_subtitle: sourceField.subtitle || 'External link',
|
|
253
250
|
source_url: sourceField.url || url
|
|
254
251
|
}));
|
|
255
252
|
submessages.push({
|
|
@@ -260,8 +257,8 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
260
257
|
metadata: {
|
|
261
258
|
reference_id: index + 1,
|
|
262
259
|
reference_url: url,
|
|
263
|
-
reference_title: linkField.title || '
|
|
264
|
-
reference_display_name: linkField.displayName || '
|
|
260
|
+
reference_title: linkField.title || 'External link',
|
|
261
|
+
reference_display_name: linkField.displayName || 'Link',
|
|
265
262
|
sources: sources || [],
|
|
266
263
|
__typename: 'GenAISearchCitationItem'
|
|
267
264
|
}
|
|
@@ -312,7 +309,7 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
312
309
|
submessages,
|
|
313
310
|
messageType: proto.AIRichResponseMessageType.AI_RICH_RESPONSE_TYPE_STANDARD,
|
|
314
311
|
unifiedResponse: {
|
|
315
|
-
data: TEXT_ENCODER.encode(JSON.stringify(unified)) //
|
|
312
|
+
data: TEXT_ENCODER.encode(JSON.stringify(unified)) // Expects "ArrayBufferLike"
|
|
316
313
|
},
|
|
317
314
|
contextInfo: {
|
|
318
315
|
isForwarded: true,
|
|
@@ -323,15 +320,15 @@ export const prepareRichResponseMessage = (content) => {
|
|
|
323
320
|
});
|
|
324
321
|
const message = wrapToBotForwardedMessage(richResponseMessage);
|
|
325
322
|
const botMetadata = message.messageContextInfo.botMetadata;
|
|
326
|
-
//
|
|
323
|
+
// Add disclaimer text on richResponseMessage
|
|
327
324
|
if (disclaimerText) {
|
|
328
325
|
botMetadata.messageDisclaimerText = disclaimerText;
|
|
329
326
|
}
|
|
330
|
-
//
|
|
327
|
+
// Add responseId from unified directly to botMetadata
|
|
331
328
|
botMetadata.botResponseId = uuid;
|
|
332
329
|
return message;
|
|
333
330
|
};
|
|
334
|
-
//
|
|
331
|
+
// signature and certificateChain for proofs[] field
|
|
335
332
|
export const botMetadataSignature = () => {
|
|
336
333
|
const signature = new Uint8Array(64);
|
|
337
334
|
getRandomValues(signature);
|
|
@@ -347,7 +344,7 @@ export const botMetadataCertificate = (length = 685) => {
|
|
|
347
344
|
export const wrapToBotForwardedMessage = (richResponseMessage) => ({
|
|
348
345
|
messageContextInfo: {
|
|
349
346
|
botMetadata: {
|
|
350
|
-
//
|
|
347
|
+
// TODO: Fill verificationMetadata field
|
|
351
348
|
verificationMetadata: {
|
|
352
349
|
proofs: [
|
|
353
350
|
{
|
package/lib/Utils/signal.d.ts
CHANGED
|
File without changes
|
package/lib/Utils/signal.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/Utils/stanza-ack.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,7 +4,7 @@ import { proto } from '../../WAProto/index.js';
|
|
|
4
4
|
import { createMutex } from '../Addon/index.js';
|
|
5
5
|
import { initAuthCreds } from './auth-utils.js';
|
|
6
6
|
import { BufferJSON } from './generics.js';
|
|
7
|
-
//
|
|
7
|
+
// Refactored useMultiFileAuthState with atomic writes and per-file mutex for better stability and RAM consumption
|
|
8
8
|
const WRITE_BATCH = 32;
|
|
9
9
|
const locks = new Map();
|
|
10
10
|
const noop = () => { };
|
|
File without changes
|
|
@@ -3,7 +3,7 @@ import { proto } from '../../WAProto/index.js';
|
|
|
3
3
|
import { createMutex } from '../Addon/index.js';
|
|
4
4
|
import { initAuthCreds } from './auth-utils.js';
|
|
5
5
|
import { BufferJSON } from './generics.js';
|
|
6
|
-
//
|
|
6
|
+
// Refactored useSingleFileAuthState with debounced atomic flush and shared mutex for better stability and RAM consumption
|
|
7
7
|
const FLUSH_DELAY_MS = 3000;
|
|
8
8
|
const files = new Map();
|
|
9
9
|
export const useSingleFileAuthState = async (fileName) => {
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proto } from '../../WAProto/index.js';
|
|
2
2
|
import { initAuthCreds } from './auth-utils.js';
|
|
3
3
|
import { BufferJSON } from './generics.js';
|
|
4
|
-
//
|
|
4
|
+
// Refactored useSqliteAuthState to use bun:sqlite, node:sqlite and better-sqlite3 with synchronous prepared statements
|
|
5
5
|
const CREDS_KEY = '__creds__';
|
|
6
6
|
const SCHEMA = `
|
|
7
7
|
PRAGMA busy_timeout = 5000;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WABinary/decode.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/decode.js
CHANGED
|
File without changes
|
package/lib/WABinary/encode.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/encode.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -111,8 +111,6 @@ export function binaryNodeToString(node, i = 0) {
|
|
|
111
111
|
return tag + content;
|
|
112
112
|
}
|
|
113
113
|
/**
|
|
114
|
-
* Lia@Changes 30-01-26
|
|
115
|
-
* ---
|
|
116
114
|
* Produce the binary node (WABinary-like JSON shape) required for the specific
|
|
117
115
|
* interactive button / list type.
|
|
118
116
|
* compatible with observed official client traffic.
|
package/lib/WABinary/index.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WABinary/types.d.ts
CHANGED
|
File without changes
|
package/lib/WABinary/types.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/WACrypto/hkdf.js
CHANGED
|
File without changes
|
package/lib/WACrypto/index.js
CHANGED
|
File without changes
|
package/lib/WACrypto/lthash.js
CHANGED
|
@@ -37,7 +37,7 @@ function pointwise(left, right, combine, out) {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Drop-in synchronous replacement for the WASM bridge `LTHashAntiTampering`
|
|
40
|
-
* class, with the exact call signature used by
|
|
40
|
+
* class, with the exact call signature used by this library's internals:
|
|
41
41
|
* `subtractThenAdd(hash, subBuffs, addBuffs)`.
|
|
42
42
|
*/
|
|
43
43
|
export class LTHashAntiTampering {
|
|
File without changes
|
|
File without changes
|
package/lib/WACrypto/math/fe.js
CHANGED
|
File without changes
|
package/lib/WACrypto/math/le.js
CHANGED
|
File without changes
|
package/lib/WACrypto/math/mod.js
CHANGED
|
File without changes
|
|
File without changes
|
package/lib/WACrypto/x25519.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pure-TypeScript X25519 (curve25519) operations backed by Node.js native crypto.
|
|
3
3
|
*
|
|
4
|
-
* Replaces the `whatsapp-rust-bridge` WASM dependency
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Replaces the `whatsapp-rust-bridge` WASM dependency of the original fork.
|
|
5
|
+
* Function signatures and output shapes are kept byte-compatible with the
|
|
6
|
+
* WASM bridge so no other code changes are needed.
|
|
7
7
|
*
|
|
8
8
|
* Key-derivation logic (Edwards encoding of the public key) is derived from
|
|
9
9
|
* zapo-js v1.12.0 (https://github.com/vinikjkkj/zapo) by vinikjkkj — MIT License.
|
package/lib/WACrypto/xeddsa.js
CHANGED
|
File without changes
|
package/lib/WAM/BinaryInfo.d.ts
CHANGED
|
File without changes
|
package/lib/WAM/BinaryInfo.js
CHANGED
|
File without changes
|
package/lib/WAM/constants.d.ts
CHANGED
|
File without changes
|
package/lib/WAM/constants.js
CHANGED
|
File without changes
|