@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/cjs/WAProto/index.d.ts
CHANGED
package/cjs/WAProto/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var cache_exports = {};
|
|
19
|
+
__export(cache_exports, {
|
|
20
|
+
createCache: () => createCache
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(cache_exports);
|
|
23
|
+
function createCache(options = {}) {
|
|
24
|
+
const max = Number.isFinite(options.max) && options.max > 0 ? Math.floor(options.max) : Infinity;
|
|
25
|
+
const entries = /* @__PURE__ */ new Map();
|
|
26
|
+
const stats = { hits: 0, misses: 0 };
|
|
27
|
+
let sweepTimer = null;
|
|
28
|
+
let closed = false;
|
|
29
|
+
const defaultTtlMs = normalizeTtlMs(options.ttl);
|
|
30
|
+
function normalizeTtlMs(t) {
|
|
31
|
+
if (t === void 0 || t === null || t === false) return 0;
|
|
32
|
+
const n = Number(t);
|
|
33
|
+
if (!Number.isFinite(n) || n <= 0) return 0;
|
|
34
|
+
return n * 1e3;
|
|
35
|
+
}
|
|
36
|
+
function sweep() {
|
|
37
|
+
const now = Date.now();
|
|
38
|
+
for (const [key, entry] of entries) {
|
|
39
|
+
if (entry.expiresAt !== 0 && entry.expiresAt <= now) {
|
|
40
|
+
entries.delete(key);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function evictOverflow() {
|
|
45
|
+
while (entries.size > max) {
|
|
46
|
+
const oldest = entries.keys().next().value;
|
|
47
|
+
entries.delete(oldest);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function touch(key, entry) {
|
|
51
|
+
entries.delete(key);
|
|
52
|
+
entries.set(key, entry);
|
|
53
|
+
}
|
|
54
|
+
function isExpired(entry) {
|
|
55
|
+
return entry.expiresAt !== 0 && entry.expiresAt <= Date.now();
|
|
56
|
+
}
|
|
57
|
+
const cache = {
|
|
58
|
+
/** Stores a value. An optional per-entry ttl (seconds) overrides the cache default. */
|
|
59
|
+
set(key, value, ttlOverride) {
|
|
60
|
+
if (closed) return false;
|
|
61
|
+
const ms = ttlOverride === void 0 || ttlOverride === null ? defaultTtlMs : normalizeTtlMs(ttlOverride);
|
|
62
|
+
const expiresAt = ms > 0 ? Date.now() + ms : 0;
|
|
63
|
+
touch(key, { value, expiresAt });
|
|
64
|
+
evictOverflow();
|
|
65
|
+
return true;
|
|
66
|
+
},
|
|
67
|
+
/** Returns the stored value, or undefined when missing or expired. Counts a hit/miss. */
|
|
68
|
+
get(key) {
|
|
69
|
+
if (closed) return void 0;
|
|
70
|
+
const entry = entries.get(key);
|
|
71
|
+
if (entry === void 0 || isExpired(entry)) {
|
|
72
|
+
if (entry !== void 0) entries.delete(key);
|
|
73
|
+
stats.misses++;
|
|
74
|
+
return void 0;
|
|
75
|
+
}
|
|
76
|
+
stats.hits++;
|
|
77
|
+
touch(key, entry);
|
|
78
|
+
return entry.value;
|
|
79
|
+
},
|
|
80
|
+
/** Returns true when the key exists and has not expired. No hit/miss accounting. */
|
|
81
|
+
has(key) {
|
|
82
|
+
if (closed) return false;
|
|
83
|
+
const entry = entries.get(key);
|
|
84
|
+
if (entry === void 0) return false;
|
|
85
|
+
if (isExpired(entry)) {
|
|
86
|
+
entries.delete(key);
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
touch(key, entry);
|
|
90
|
+
return true;
|
|
91
|
+
},
|
|
92
|
+
/** Deletes one or more keys (a single key, varargs, or an array). Returns the count removed. */
|
|
93
|
+
del(...keys) {
|
|
94
|
+
const list = keys.length === 1 && Array.isArray(keys[0]) ? keys[0] : keys;
|
|
95
|
+
let deleted = 0;
|
|
96
|
+
for (const key of list) {
|
|
97
|
+
if (entries.delete(key)) deleted++;
|
|
98
|
+
}
|
|
99
|
+
return deleted;
|
|
100
|
+
},
|
|
101
|
+
/** Sets many entries at once: mset([{ key, val, ttl? }, ...]). */
|
|
102
|
+
mset(list) {
|
|
103
|
+
if (!Array.isArray(list)) return false;
|
|
104
|
+
for (const item of list) {
|
|
105
|
+
if (item === null || typeof item !== "object" || !("key" in item) || !("val" in item)) return false;
|
|
106
|
+
cache.set(item.key, item.val, item.ttl);
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
},
|
|
110
|
+
/** Returns an object of found entries: mget('a', 'b') -> { a: 1, b: 2 }. Missing keys are omitted. */
|
|
111
|
+
mget(...keys) {
|
|
112
|
+
const list = keys.length === 1 && Array.isArray(keys[0]) ? keys[0] : keys;
|
|
113
|
+
const found = {};
|
|
114
|
+
for (const key of list) {
|
|
115
|
+
if (key === void 0 || key === null) continue;
|
|
116
|
+
const value = cache.get(key);
|
|
117
|
+
if (value !== void 0) found[key] = value;
|
|
118
|
+
}
|
|
119
|
+
return found;
|
|
120
|
+
},
|
|
121
|
+
/** Deletes many keys: mdel('a', 'b') or mdel(['a', 'b']). Returns the count removed. */
|
|
122
|
+
mdel(...keys) {
|
|
123
|
+
const list = keys.length === 1 && Array.isArray(keys[0]) ? keys[0] : keys;
|
|
124
|
+
return cache.del(list);
|
|
125
|
+
},
|
|
126
|
+
/** Removes every entry from the cache. */
|
|
127
|
+
flushAll() {
|
|
128
|
+
entries.clear();
|
|
129
|
+
},
|
|
130
|
+
/** Returns every live (non-expired) key. */
|
|
131
|
+
keys() {
|
|
132
|
+
sweep();
|
|
133
|
+
return [...entries.keys()];
|
|
134
|
+
},
|
|
135
|
+
/** Returns cumulative statistics: { hits, misses, keys }. */
|
|
136
|
+
getStats() {
|
|
137
|
+
sweep();
|
|
138
|
+
return { hits: stats.hits, misses: stats.misses, keys: entries.size };
|
|
139
|
+
},
|
|
140
|
+
/** Current number of live entries. */
|
|
141
|
+
get size() {
|
|
142
|
+
sweep();
|
|
143
|
+
return entries.size;
|
|
144
|
+
},
|
|
145
|
+
/** Approximate payload size in bytes (buffers counted, other values not measured). */
|
|
146
|
+
get calculatedSize() {
|
|
147
|
+
sweep();
|
|
148
|
+
let total = 0;
|
|
149
|
+
for (const entry of entries.values()) {
|
|
150
|
+
const v = entry.value;
|
|
151
|
+
if (Buffer.isBuffer(v)) total += v.length;
|
|
152
|
+
else if (ArrayBuffer.isView(v)) total += v.byteLength;
|
|
153
|
+
else if (typeof v === "string") total += Buffer.byteLength(v);
|
|
154
|
+
}
|
|
155
|
+
return total;
|
|
156
|
+
},
|
|
157
|
+
/**
|
|
158
|
+
* Stops the background sweep timer. The cache remains usable after close()
|
|
159
|
+
* (expiry then happens lazily on access), but no timers are left running —
|
|
160
|
+
* important so sockets can shut down cleanly.
|
|
161
|
+
*/
|
|
162
|
+
close() {
|
|
163
|
+
closed = false;
|
|
164
|
+
if (sweepTimer) {
|
|
165
|
+
clearInterval(sweepTimer);
|
|
166
|
+
sweepTimer = null;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
if (typeof setInterval === "function") {
|
|
171
|
+
sweepTimer = setInterval(sweep, 6e4);
|
|
172
|
+
if (typeof sweepTimer.unref === "function") sweepTimer.unref();
|
|
173
|
+
}
|
|
174
|
+
return cache;
|
|
175
|
+
}
|
|
176
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
177
|
+
0 && (module.exports = {
|
|
178
|
+
createCache
|
|
179
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var crc32_exports = {};
|
|
19
|
+
__export(crc32_exports, {
|
|
20
|
+
crc32: () => crc32
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(crc32_exports);
|
|
23
|
+
const TABLE = new Int32Array(256);
|
|
24
|
+
for (let n = 0; n < 256; n++) {
|
|
25
|
+
let c = n;
|
|
26
|
+
for (let k = 0; k < 8; k++) {
|
|
27
|
+
c = (c & 1) !== 0 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
28
|
+
}
|
|
29
|
+
TABLE[n] = c;
|
|
30
|
+
}
|
|
31
|
+
function crc32(data, start = 0) {
|
|
32
|
+
let c = (start ^ 4294967295) >>> 0;
|
|
33
|
+
for (let i = 0; i < data.length; i++) {
|
|
34
|
+
c = (TABLE[(c ^ data[i]) & 255] ^ c >>> 8) >>> 0;
|
|
35
|
+
}
|
|
36
|
+
return (c ^ 4294967295) >>> 0;
|
|
37
|
+
}
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
crc32
|
|
41
|
+
});
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var file_type_exports = {};
|
|
29
|
+
__export(file_type_exports, {
|
|
30
|
+
detectFileType: () => detectFileType
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(file_type_exports);
|
|
33
|
+
var import_promises = require("node:fs/promises");
|
|
34
|
+
const SIGNATURES = [
|
|
35
|
+
// Images
|
|
36
|
+
{ sig: [137, 80, 78, 71, 13, 10, 26, 10], mime: "image/png", ext: "png" },
|
|
37
|
+
{ sig: [255, 216, 255], mime: "image/jpeg", ext: "jpg" },
|
|
38
|
+
{ sig: "GIF87a", mime: "image/gif", ext: "gif" },
|
|
39
|
+
{ sig: "GIF89a", mime: "image/gif", ext: "gif" },
|
|
40
|
+
{ sig: "BM", mime: "image/bmp", ext: "bmp" },
|
|
41
|
+
{ sig: [0, 0, 1, 0], mime: "image/x-icon", ext: "ico" },
|
|
42
|
+
// RIFF containers (WEBP/WAV/AVI) — checked together below via container() handlers
|
|
43
|
+
{ container: "riff" },
|
|
44
|
+
// ISO BMFF containers (mp4/mov/3gp/m4a) — handled via brand table
|
|
45
|
+
{ container: "ftyp" },
|
|
46
|
+
// Matroska
|
|
47
|
+
{ sig: [26, 69, 223, 163], container: "ebml" },
|
|
48
|
+
// Ogg
|
|
49
|
+
{ sig: "OggS", mime: "application/ogg", ext: "ogx" },
|
|
50
|
+
// Audio
|
|
51
|
+
{ sig: "ID3", mime: "audio/mpeg", ext: "mp3" },
|
|
52
|
+
{ sig: "fLaC", mime: "audio/flac", ext: "flac" },
|
|
53
|
+
{ sig: "#!AMR", mime: "audio/amr", ext: "amr" },
|
|
54
|
+
{ sig: "FORM", container: "iff" },
|
|
55
|
+
// Documents / archives
|
|
56
|
+
{ sig: "%PDF", mime: "application/pdf", ext: "pdf" },
|
|
57
|
+
{ sig: "PK", mime: "application/zip", ext: "zip" },
|
|
58
|
+
{ sig: "PK", mime: "application/zip", ext: "zip" },
|
|
59
|
+
{ sig: "PK\x07\b", mime: "application/zip", ext: "zip" },
|
|
60
|
+
{ sig: [31, 139], mime: "application/gzip", ext: "gz" },
|
|
61
|
+
{ sig: [55, 122, 188, 175, 39, 28], mime: "application/x-7z-compressed", ext: "7z" },
|
|
62
|
+
{ sig: "Rar!\x07", mime: "application/x-rar-compressed", ext: "rar" },
|
|
63
|
+
{ sig: [253, 55, 122, 88, 90, 0], mime: "application/x-xz", ext: "xz" },
|
|
64
|
+
{ sig: "BZh", mime: "application/x-bzip2", ext: "bz2" },
|
|
65
|
+
{ sig: [37, 33, 80, 83], mime: "application/postscript", ext: "ps" },
|
|
66
|
+
{ sig: "\x7FELF", mime: "application/x-executable", ext: "bin" },
|
|
67
|
+
{ sig: [202, 254, 186, 190], mime: "application/x-java-applet", ext: "class" },
|
|
68
|
+
{ sig: "wOFF", mime: "font/woff", ext: "woff" },
|
|
69
|
+
{ sig: "wOF2", mime: "font/woff2", ext: "woff2" },
|
|
70
|
+
{ sig: [0, 1, 0, 0], mime: "font/ttf", ext: "ttf" },
|
|
71
|
+
{ sig: "OTTO", mime: "font/otf", ext: "otf" }
|
|
72
|
+
];
|
|
73
|
+
function matchesSig(header, sig) {
|
|
74
|
+
if (typeof sig === "string") sig = [...Buffer.from(sig, "latin1")];
|
|
75
|
+
if (header.length < sig.length) return false;
|
|
76
|
+
return sig.every((byte, i) => header[i] === byte);
|
|
77
|
+
}
|
|
78
|
+
function fromFtypBrand(header) {
|
|
79
|
+
if (header.length < 12) return null;
|
|
80
|
+
const brand = header.subarray(8, 12).toString("latin1");
|
|
81
|
+
const major = brand;
|
|
82
|
+
if (/^qt/.test(major)) return { mime: "video/quicktime", ext: "mov" };
|
|
83
|
+
if (/^3g?p?/.test(major)) return { mime: "video/3gpp", ext: "3gp" };
|
|
84
|
+
if (/^M4A/.test(major)) return { mime: "audio/mp4", ext: "m4a" };
|
|
85
|
+
if (/^M4V/.test(major)) return { mime: "video/x-m4v", ext: "m4v" };
|
|
86
|
+
return { mime: "video/mp4", ext: "mp4" };
|
|
87
|
+
}
|
|
88
|
+
function fromRiff(header) {
|
|
89
|
+
if (header.length < 12) return null;
|
|
90
|
+
const type = header.subarray(8, 12).toString("latin1");
|
|
91
|
+
switch (type) {
|
|
92
|
+
case "WEBP":
|
|
93
|
+
return { mime: "image/webp", ext: "webp" };
|
|
94
|
+
case "WAVE":
|
|
95
|
+
return { mime: "audio/wav", ext: "wav" };
|
|
96
|
+
case "AVI ":
|
|
97
|
+
return { mime: "video/x-msvideo", ext: "avi" };
|
|
98
|
+
default:
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function fromEbml(header) {
|
|
103
|
+
const head = header.toString("latin1");
|
|
104
|
+
if (head.includes("webm")) return { mime: "video/webm", ext: "webm" };
|
|
105
|
+
if (head.includes("matroska")) return { mime: "video/x-matroska", ext: "mkv" };
|
|
106
|
+
return { mime: "video/x-matroska", ext: "mkv" };
|
|
107
|
+
}
|
|
108
|
+
function fromMpegSync(header) {
|
|
109
|
+
if (header.length < 2) return null;
|
|
110
|
+
if (header[0] === 255 && (header[1] & 224) === 224) {
|
|
111
|
+
return { mime: "audio/mpeg", ext: "mp3" };
|
|
112
|
+
}
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
function builtinDetect(header) {
|
|
116
|
+
for (const def of SIGNATURES) {
|
|
117
|
+
if (def.container === "riff" && matchesSig(header, "RIFF")) return fromRiff(header);
|
|
118
|
+
if (def.container === "ftyp" && header.length >= 8 && header.subarray(4, 8).toString("latin1") === "ftyp") return fromFtypBrand(header);
|
|
119
|
+
if (def.container === "ebml" && matchesSig(header, def.sig)) return fromEbml(header);
|
|
120
|
+
if (def.container === "iff" && matchesSig(header, "FORM")) {
|
|
121
|
+
const type = header.subarray(8, 12).toString("latin1");
|
|
122
|
+
if (type === "AIFF") return { mime: "audio/aiff", ext: "aiff" };
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
if (def.sig && matchesSig(header, def.sig)) {
|
|
126
|
+
return { mime: def.mime, ext: def.ext };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return fromMpegSync(header);
|
|
130
|
+
}
|
|
131
|
+
async function loadOptionalDetector() {
|
|
132
|
+
try {
|
|
133
|
+
const magic = await import("magic-bytes.js");
|
|
134
|
+
if (typeof magic.filetypemime === "function") {
|
|
135
|
+
return async (buffer) => {
|
|
136
|
+
const mime = magic.filetypemime(buffer);
|
|
137
|
+
return mime ? { mime, ext: extFromMime(mime) } : null;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
} catch {
|
|
141
|
+
}
|
|
142
|
+
try {
|
|
143
|
+
const fileType = await import("file-type");
|
|
144
|
+
const fn = fileType.fileTypeFromBuffer || fileType.default?.fileTypeFromBuffer || fileType.default;
|
|
145
|
+
if (typeof fn === "function") {
|
|
146
|
+
return async (buffer) => {
|
|
147
|
+
const result = await fn(buffer);
|
|
148
|
+
return result ? { mime: result.mime, ext: result.ext } : null;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
} catch {
|
|
152
|
+
}
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
function extFromMime(mime) {
|
|
156
|
+
const map = {
|
|
157
|
+
"image/png": "png",
|
|
158
|
+
"image/jpeg": "jpg",
|
|
159
|
+
"image/gif": "gif",
|
|
160
|
+
"image/webp": "webp",
|
|
161
|
+
"image/bmp": "bmp",
|
|
162
|
+
"image/tiff": "tif",
|
|
163
|
+
"video/mp4": "mp4",
|
|
164
|
+
"video/webm": "webm",
|
|
165
|
+
"video/quicktime": "mov",
|
|
166
|
+
"video/x-msvideo": "avi",
|
|
167
|
+
"video/x-matroska": "mkv",
|
|
168
|
+
"video/3gpp": "3gp",
|
|
169
|
+
"audio/mpeg": "mp3",
|
|
170
|
+
"audio/wav": "wav",
|
|
171
|
+
"audio/ogg": "ogg",
|
|
172
|
+
"application/ogg": "ogx",
|
|
173
|
+
"audio/flac": "flac",
|
|
174
|
+
"audio/amr": "amr",
|
|
175
|
+
"audio/mp4": "m4a",
|
|
176
|
+
"audio/aiff": "aiff",
|
|
177
|
+
"application/pdf": "pdf",
|
|
178
|
+
"application/zip": "zip",
|
|
179
|
+
"application/gzip": "gz",
|
|
180
|
+
"application/x-7z-compressed": "7z",
|
|
181
|
+
"application/x-rar-compressed": "rar",
|
|
182
|
+
"application/x-bzip2": "bz2",
|
|
183
|
+
"application/x-xz": "xz"
|
|
184
|
+
};
|
|
185
|
+
return map[mime] || (mime.split("/")[1] || "bin").split(";")[0];
|
|
186
|
+
}
|
|
187
|
+
let optionalDetector;
|
|
188
|
+
async function detectFileType(input) {
|
|
189
|
+
let buffer;
|
|
190
|
+
if (typeof input === "string") {
|
|
191
|
+
buffer = await (0, import_promises.readFile)(input);
|
|
192
|
+
} else if (Buffer.isBuffer(input) || input instanceof Uint8Array) {
|
|
193
|
+
buffer = input;
|
|
194
|
+
} else if (input && typeof input.pipe === "function") {
|
|
195
|
+
const chunks = [];
|
|
196
|
+
for await (const chunk of input) chunks.push(chunk);
|
|
197
|
+
buffer = Buffer.concat(chunks);
|
|
198
|
+
} else {
|
|
199
|
+
throw new TypeError("detectFileType: expects a Buffer, Uint8Array or a file path");
|
|
200
|
+
}
|
|
201
|
+
const header = buffer.subarray(0, Math.min(buffer.length, 128));
|
|
202
|
+
if (header.length === 0) return {};
|
|
203
|
+
optionalDetector ||= await loadOptionalDetector();
|
|
204
|
+
if (optionalDetector) {
|
|
205
|
+
try {
|
|
206
|
+
const result = await optionalDetector(buffer);
|
|
207
|
+
if (result) return result;
|
|
208
|
+
} catch {
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
const detected = builtinDetect(header);
|
|
212
|
+
return detected ? { ...detected } : {};
|
|
213
|
+
}
|
|
214
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
215
|
+
0 && (module.exports = {
|
|
216
|
+
detectFileType
|
|
217
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var get_file_exports = {};
|
|
29
|
+
__export(get_file_exports, {
|
|
30
|
+
getFile: () => getFile
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(get_file_exports);
|
|
33
|
+
var import_node_fs = require("node:fs");
|
|
34
|
+
var import_promises = require("node:fs/promises");
|
|
35
|
+
var import_node_crypto = require("node:crypto");
|
|
36
|
+
var import_node_os = require("node:os");
|
|
37
|
+
var import_node_path = __toESM(require("node:path"), 1);
|
|
38
|
+
var import_promises2 = require("node:stream/promises");
|
|
39
|
+
var import_node_stream = require("node:stream");
|
|
40
|
+
const INVALID_SOURCE = "Invalid source type, expects URL, ArrayBuffer, or Readable";
|
|
41
|
+
function tempFilePath() {
|
|
42
|
+
return import_node_path.default.join((0, import_node_os.tmpdir)(), `BAILEYS_${process.pid}_${(0, import_node_crypto.randomBytes)(4).toString("hex")}.tmp`);
|
|
43
|
+
}
|
|
44
|
+
function toBuffer(data) {
|
|
45
|
+
if (Buffer.isBuffer(data)) return data;
|
|
46
|
+
if (data instanceof ArrayBuffer) return Buffer.from(data);
|
|
47
|
+
if (ArrayBuffer.isView(data)) return Buffer.from(data.buffer, data.byteOffset, data.byteLength);
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
async function writeTemp(buffer) {
|
|
51
|
+
const filePath = tempFilePath();
|
|
52
|
+
await (0, import_promises.unlink)(filePath).catch(() => {
|
|
53
|
+
});
|
|
54
|
+
const { writeFile } = await import("node:fs/promises");
|
|
55
|
+
await writeFile(filePath, buffer);
|
|
56
|
+
return filePath;
|
|
57
|
+
}
|
|
58
|
+
async function downloadToFile(url) {
|
|
59
|
+
const response = await fetch(url);
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
throw new Error(`HTTP ${response.status} ${response.statusText}`);
|
|
62
|
+
}
|
|
63
|
+
const filePath = tempFilePath();
|
|
64
|
+
const body = response.body;
|
|
65
|
+
if (!body) throw new Error("HTTP response had no body");
|
|
66
|
+
await (0, import_promises2.pipeline)(import_node_stream.Readable.fromWeb(body), (0, import_node_fs.createWriteStream)(filePath));
|
|
67
|
+
return filePath;
|
|
68
|
+
}
|
|
69
|
+
async function streamToFile(stream) {
|
|
70
|
+
const filePath = tempFilePath();
|
|
71
|
+
await (0, import_promises.unlink)(filePath).catch(() => {
|
|
72
|
+
});
|
|
73
|
+
await (0, import_promises2.pipeline)(stream, (0, import_node_fs.createWriteStream)(filePath));
|
|
74
|
+
return filePath;
|
|
75
|
+
}
|
|
76
|
+
function isHttpUrl(value) {
|
|
77
|
+
return typeof value === "string" && /^https?:\/\//i.test(value.trim());
|
|
78
|
+
}
|
|
79
|
+
async function getFile(source) {
|
|
80
|
+
if (source === null || source === void 0) {
|
|
81
|
+
throw new TypeError(INVALID_SOURCE);
|
|
82
|
+
}
|
|
83
|
+
const buffer = toBuffer(source);
|
|
84
|
+
if (buffer) return writeTemp(buffer);
|
|
85
|
+
if (typeof source.pipe === "function") return streamToFile(source);
|
|
86
|
+
if (typeof source.getReader === "function") return streamToFile(import_node_stream.Readable.fromWeb(source));
|
|
87
|
+
if (typeof source === "string") {
|
|
88
|
+
if (isHttpUrl(source)) return downloadToFile(source.trim());
|
|
89
|
+
return source;
|
|
90
|
+
}
|
|
91
|
+
if (typeof Blob !== "undefined" && source instanceof Blob) {
|
|
92
|
+
return writeTemp(Buffer.from(await source.arrayBuffer()));
|
|
93
|
+
}
|
|
94
|
+
throw new TypeError(INVALID_SOURCE);
|
|
95
|
+
}
|
|
96
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
97
|
+
0 && (module.exports = {
|
|
98
|
+
getFile
|
|
99
|
+
});
|
|
File without changes
|
|
File without changes
|
package/cjs/lib/Addon/index.d.ts
CHANGED
|
@@ -1,3 +1,96 @@
|
|
|
1
|
+
export interface CreateCacheOptions {
|
|
2
|
+
/** Default time-to-live in seconds (0/undefined = no expiry). */
|
|
3
|
+
ttl?: number;
|
|
4
|
+
/** Maximum number of entries; least-recently-used entries are evicted. */
|
|
5
|
+
max?: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface CacheStats {
|
|
9
|
+
hits: number;
|
|
10
|
+
misses: number;
|
|
11
|
+
keys: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface Cache {
|
|
15
|
+
set(key: any, value: any, ttl?: number): boolean;
|
|
16
|
+
get(key: any): any;
|
|
17
|
+
has(key: any): boolean;
|
|
18
|
+
del(...keys: any[]): number;
|
|
19
|
+
mset(entries: Array<{ key: any; val: any; ttl?: number }>): boolean;
|
|
20
|
+
mget(...keys: any[]): Record<string, any>;
|
|
21
|
+
mdel(...keys: any[]): number;
|
|
22
|
+
keys(): any[];
|
|
23
|
+
getStats(): CacheStats;
|
|
24
|
+
flushAll(): void;
|
|
25
|
+
close(): void;
|
|
26
|
+
readonly size: number;
|
|
27
|
+
readonly calculatedSize: number;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function createCache(options?: CreateCacheOptions): Cache;
|
|
31
|
+
|
|
32
|
+
export interface Mutex {
|
|
33
|
+
acquire(): Promise<() => void>;
|
|
34
|
+
lock(): Promise<() => void>;
|
|
35
|
+
tryAcquire(): (() => void) | undefined;
|
|
36
|
+
tryLock(): (() => void) | undefined;
|
|
37
|
+
runExclusive<T>(task: () => T | Promise<T>): Promise<T>;
|
|
38
|
+
isLocked(): boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function createMutex(): Mutex;
|
|
42
|
+
|
|
43
|
+
export interface Queue {
|
|
44
|
+
add<T>(task: () => T | Promise<T>): Promise<T>;
|
|
45
|
+
push<T>(task: () => T | Promise<T>): Promise<T>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function createQueue(concurrency?: number): Queue;
|
|
49
|
+
|
|
50
|
+
export interface ZipEntry {
|
|
51
|
+
name: string;
|
|
52
|
+
data: Buffer | Uint8Array | string;
|
|
53
|
+
date?: Date;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function createZip(entries: Iterable<ZipEntry> | Record<string, Buffer | Uint8Array | string>): Promise<Buffer>;
|
|
57
|
+
|
|
58
|
+
export interface FileTypeResult {
|
|
59
|
+
mime: string;
|
|
60
|
+
ext: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function detectFileType(input: Buffer | Uint8Array | string): Promise<FileTypeResult | Record<string, never>>;
|
|
64
|
+
|
|
65
|
+
export interface MediaInfo {
|
|
66
|
+
width?: number;
|
|
67
|
+
height?: number;
|
|
68
|
+
durationSeconds?: number;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function detectMediaInfo(input: Buffer | Uint8Array | string): Promise<MediaInfo>;
|
|
72
|
+
|
|
73
|
+
export interface QrCodeResult {
|
|
74
|
+
/** Terminal rendering using half-block glyphs (ends with a newline). */
|
|
75
|
+
ascii: string;
|
|
76
|
+
getPngBuffer(): Promise<Buffer>;
|
|
77
|
+
getRaw(): Promise<boolean[][]>;
|
|
78
|
+
version: number;
|
|
79
|
+
errorCorrectionLevel: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function encodeQR(text: string): Promise<QrCodeResult>;
|
|
83
|
+
|
|
84
|
+
export interface AudioWaveform {
|
|
85
|
+
durationSeconds: number;
|
|
86
|
+
/** 64 integer bars, 0-100, normalized against the loudest bar. */
|
|
87
|
+
waveform: number[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function getAudioWaveform(input: Buffer | Uint8Array | string | NodeJS.ReadableStream): Promise<AudioWaveform>;
|
|
91
|
+
|
|
92
|
+
export function getFile(source: Buffer | Uint8Array | ArrayBuffer | string | NodeJS.ReadableStream | Blob): Promise<string>;
|
|
93
|
+
|
|
1
94
|
export * from "./http-error.js";
|
|
2
95
|
export * from "./keyed-db.js";
|
|
3
96
|
export * from "./link-preview.js";
|