@eduh_dev021/baileys 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +495 -2
- package/WAProto/index.d.ts +22220 -0
- package/WAProto/index.js +5 -0
- package/cjs/WAProto/index.d.ts +22220 -0
- package/cjs/WAProto/index.js +60125 -0
- package/cjs/engine-requirements.js +12 -0
- package/cjs/lib/Addon/http-error.d.ts +18 -0
- package/cjs/lib/Addon/http-error.js +66 -0
- package/cjs/lib/Addon/index.d.ts +3 -0
- package/cjs/lib/Addon/index.js +50 -0
- package/cjs/lib/Addon/keyed-db.d.ts +14 -0
- package/cjs/lib/Addon/keyed-db.js +264 -0
- package/cjs/lib/Addon/link-preview.d.ts +15 -0
- package/cjs/lib/Addon/link-preview.js +104 -0
- package/cjs/lib/Defaults/index.d.ts +184 -0
- package/cjs/lib/Defaults/index.js +292 -0
- package/cjs/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/cjs/lib/Signal/Group/ciphertext-message.js +37 -0
- package/cjs/lib/Signal/Group/group-cipher.d.ts +10 -0
- package/cjs/lib/Signal/Group/group-cipher.js +105 -0
- package/cjs/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/cjs/lib/Signal/Group/group-session-builder.js +65 -0
- package/cjs/lib/Signal/Group/index.d.ts +11 -0
- package/cjs/lib/Signal/Group/index.js +67 -0
- package/cjs/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/cjs/lib/Signal/Group/keyhelper.js +47 -0
- package/cjs/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/cjs/lib/Signal/Group/sender-chain-key.js +51 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.js +80 -0
- package/cjs/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/cjs/lib/Signal/Group/sender-key-message.js +87 -0
- package/cjs/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/cjs/lib/Signal/Group/sender-key-name.js +73 -0
- package/cjs/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/cjs/lib/Signal/Group/sender-key-record.js +66 -0
- package/cjs/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/cjs/lib/Signal/Group/sender-key-state.js +106 -0
- package/cjs/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/cjs/lib/Signal/Group/sender-message-key.js +51 -0
- package/cjs/lib/Signal/libsignal.d.ts +54 -0
- package/cjs/lib/Signal/libsignal.js +421 -0
- package/cjs/lib/Signal/lid-mapping.d.ts +20 -0
- package/cjs/lib/Signal/lid-mapping.js +292 -0
- package/cjs/lib/Socket/Client/index.d.ts +2 -0
- package/cjs/lib/Socket/Client/index.js +23 -0
- package/cjs/lib/Socket/Client/types.d.ts +5 -0
- package/cjs/lib/Socket/Client/types.js +36 -0
- package/cjs/lib/Socket/Client/websocket.d.ts +12 -0
- package/cjs/lib/Socket/Client/websocket.js +143 -0
- package/cjs/lib/Socket/business.d.ts +387 -0
- package/cjs/lib/Socket/business.js +402 -0
- package/cjs/lib/Socket/chats.d.ts +144 -0
- package/cjs/lib/Socket/chats.js +1118 -0
- package/cjs/lib/Socket/communities.d.ts +554 -0
- package/cjs/lib/Socket/communities.js +456 -0
- package/cjs/lib/Socket/groups.d.ts +286 -0
- package/cjs/lib/Socket/groups.js +366 -0
- package/cjs/lib/Socket/index.d.ts +522 -0
- package/cjs/lib/Socket/index.js +32 -0
- package/cjs/lib/Socket/messages-recv.d.ts +326 -0
- package/cjs/lib/Socket/messages-recv.js +1670 -0
- package/cjs/lib/Socket/messages-send.d.ts +321 -0
- package/cjs/lib/Socket/messages-send.js +1252 -0
- package/cjs/lib/Socket/mex.d.ts +1 -0
- package/cjs/lib/Socket/mex.js +65 -0
- package/cjs/lib/Socket/newsletter.d.ts +283 -0
- package/cjs/lib/Socket/newsletter.js +243 -0
- package/cjs/lib/Socket/socket.d.ts +61 -0
- package/cjs/lib/Socket/socket.js +908 -0
- package/cjs/lib/Store/index.d.ts +3 -0
- package/cjs/lib/Store/index.js +25 -0
- package/cjs/lib/Store/make-in-memory-store.d.ts +63 -0
- package/cjs/lib/Store/make-in-memory-store.js +431 -0
- package/cjs/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/cjs/lib/Store/make-ordered-dictionary.js +101 -0
- package/cjs/lib/Store/object-repository.d.ts +10 -0
- package/cjs/lib/Store/object-repository.js +49 -0
- package/cjs/lib/Transport/crypto.d.ts +6 -0
- package/cjs/lib/Transport/crypto.js +107 -0
- package/cjs/lib/Transport/curve.d.ts +8 -0
- package/cjs/lib/Transport/curve.js +94 -0
- package/cjs/lib/Transport/index.d.ts +16 -0
- package/cjs/lib/Transport/index.js +67 -0
- package/cjs/lib/Transport/internals.d.ts +57 -0
- package/cjs/lib/Transport/internals.js +203 -0
- package/cjs/lib/Transport/session-builder.d.ts +40 -0
- package/cjs/lib/Transport/session-builder.js +169 -0
- package/cjs/lib/Transport/session-cipher.d.ts +26 -0
- package/cjs/lib/Transport/session-cipher.js +328 -0
- package/cjs/lib/Transport/session-record.d.ts +55 -0
- package/cjs/lib/Transport/session-record.js +289 -0
- package/cjs/lib/Types/Auth.d.ts +1 -0
- package/cjs/lib/Types/Auth.js +15 -0
- package/cjs/lib/Types/Bussines.d.ts +1 -0
- package/cjs/lib/Types/Bussines.js +15 -0
- package/cjs/lib/Types/Call.d.ts +1 -0
- package/cjs/lib/Types/Call.js +15 -0
- package/cjs/lib/Types/Chat.d.ts +1 -0
- package/cjs/lib/Types/Chat.js +33 -0
- package/cjs/lib/Types/Contact.d.ts +1 -0
- package/cjs/lib/Types/Contact.js +15 -0
- package/cjs/lib/Types/Events.d.ts +1 -0
- package/cjs/lib/Types/Events.js +1 -0
- package/cjs/lib/Types/GroupMetadata.d.ts +1 -0
- package/cjs/lib/Types/GroupMetadata.js +15 -0
- package/cjs/lib/Types/Label.d.ts +2 -0
- package/cjs/lib/Types/Label.js +49 -0
- package/cjs/lib/Types/LabelAssociation.d.ts +2 -0
- package/cjs/lib/Types/LabelAssociation.js +31 -0
- package/cjs/lib/Types/Message.d.ts +11 -0
- package/cjs/lib/Types/Message.js +58 -0
- package/cjs/lib/Types/Mex.d.ts +2 -0
- package/cjs/lib/Types/Mex.js +66 -0
- package/cjs/lib/Types/Product.d.ts +1 -0
- package/cjs/lib/Types/Product.js +15 -0
- package/cjs/lib/Types/RichType.d.ts +2 -0
- package/cjs/lib/Types/RichType.js +50 -0
- package/cjs/lib/Types/Signal.d.ts +1 -0
- package/cjs/lib/Types/Signal.js +1 -0
- package/cjs/lib/Types/Socket.d.ts +1 -0
- package/cjs/lib/Types/Socket.js +1 -0
- package/cjs/lib/Types/State.d.ts +5 -0
- package/cjs/lib/Types/State.js +83 -0
- package/cjs/lib/Types/USync.d.ts +1 -0
- package/cjs/lib/Types/USync.js +1 -0
- package/cjs/lib/Types/index.d.ts +13 -0
- package/cjs/lib/Types/index.js +64 -0
- package/cjs/lib/Utils/auth-utils.d.ts +58 -0
- package/cjs/lib/Utils/auth-utils.js +275 -0
- package/cjs/lib/Utils/browser-utils.d.ts +9 -0
- package/cjs/lib/Utils/browser-utils.js +56 -0
- package/cjs/lib/Utils/business.d.ts +49 -0
- package/cjs/lib/Utils/business.js +259 -0
- package/cjs/lib/Utils/chat-utils.d.ts +408 -0
- package/cjs/lib/Utils/chat-utils.js +821 -0
- package/cjs/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/cjs/lib/Utils/companion-reg-client-utils.js +71 -0
- package/cjs/lib/Utils/crypto.d.ts +39 -0
- package/cjs/lib/Utils/crypto.js +155 -0
- package/cjs/lib/Utils/decode-wa-message.d.ts +83 -0
- package/cjs/lib/Utils/decode-wa-message.js +316 -0
- package/cjs/lib/Utils/event-buffer.d.ts +12 -0
- package/cjs/lib/Utils/event-buffer.js +605 -0
- package/cjs/lib/Utils/generics.d.ts +63 -0
- package/cjs/lib/Utils/generics.js +440 -0
- package/cjs/lib/Utils/history.d.ts +75 -0
- package/cjs/lib/Utils/history.js +153 -0
- package/cjs/lib/Utils/identity-change-handler.d.ts +13 -0
- package/cjs/lib/Utils/identity-change-handler.js +73 -0
- package/cjs/lib/Utils/index.d.ts +24 -0
- package/cjs/lib/Utils/index.js +67 -0
- package/cjs/lib/Utils/link-preview.d.ts +13 -0
- package/cjs/lib/Utils/link-preview.js +87 -0
- package/cjs/lib/Utils/logger.d.ts +12 -0
- package/cjs/lib/Utils/logger.js +40 -0
- package/cjs/lib/Utils/lt-hash.d.ts +6 -0
- package/cjs/lib/Utils/lt-hash.js +28 -0
- package/cjs/lib/Utils/make-mutex.d.ts +6 -0
- package/cjs/lib/Utils/make-mutex.js +58 -0
- package/cjs/lib/Utils/message-retry-manager.d.ts +79 -0
- package/cjs/lib/Utils/message-retry-manager.js +274 -0
- package/cjs/lib/Utils/messages-media.d.ts +134 -0
- package/cjs/lib/Utils/messages-media.js +799 -0
- package/cjs/lib/Utils/messages.d.ts +47 -0
- package/cjs/lib/Utils/messages.js +1667 -0
- package/cjs/lib/Utils/noise-handler.d.ts +20 -0
- package/cjs/lib/Utils/noise-handler.js +223 -0
- package/cjs/lib/Utils/offline-node-processor.d.ts +10 -0
- package/cjs/lib/Utils/offline-node-processor.js +60 -0
- package/cjs/lib/Utils/pre-key-manager.d.ts +25 -0
- package/cjs/lib/Utils/pre-key-manager.js +116 -0
- package/cjs/lib/Utils/process-message.d.ts +83 -0
- package/cjs/lib/Utils/process-message.js +607 -0
- package/cjs/lib/Utils/reporting-utils.d.ts +12 -0
- package/cjs/lib/Utils/reporting-utils.js +282 -0
- package/cjs/lib/Utils/rich-message-utils.d.ts +48 -0
- package/cjs/lib/Utils/rich-message-utils.js +381 -0
- package/cjs/lib/Utils/signal.d.ts +82 -0
- package/cjs/lib/Utils/signal.js +232 -0
- package/cjs/lib/Utils/stanza-ack.d.ts +16 -0
- package/cjs/lib/Utils/stanza-ack.js +53 -0
- package/cjs/lib/Utils/sync-action-utils.d.ts +2 -0
- package/cjs/lib/Utils/sync-action-utils.js +68 -0
- package/cjs/lib/Utils/tc-token-utils.d.ts +29 -0
- package/cjs/lib/Utils/tc-token-utils.js +182 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.js +135 -0
- package/cjs/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/cjs/lib/Utils/use-single-file-auth-state.js +115 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.js +140 -0
- package/cjs/lib/Utils/validate-connection.d.ts +44 -0
- package/cjs/lib/Utils/validate-connection.js +229 -0
- package/cjs/lib/WABinary/constants.d.ts +61 -0
- package/cjs/lib/WABinary/constants.js +1992 -0
- package/cjs/lib/WABinary/decode.d.ts +9 -0
- package/cjs/lib/WABinary/decode.js +292 -0
- package/cjs/lib/WABinary/encode.d.ts +2 -0
- package/cjs/lib/WABinary/encode.js +240 -0
- package/cjs/lib/WABinary/generic-utils.d.ts +79 -0
- package/cjs/lib/WABinary/generic-utils.js +252 -0
- package/cjs/lib/WABinary/index.d.ts +5 -0
- package/cjs/lib/WABinary/index.js +29 -0
- package/cjs/lib/WABinary/jid-utils.d.ts +28 -0
- package/cjs/lib/WABinary/jid-utils.js +151 -0
- package/cjs/lib/WABinary/types.d.ts +1 -0
- package/cjs/lib/WABinary/types.js +23 -0
- package/cjs/lib/WACrypto/appstate-keys.js +39 -0
- package/cjs/lib/WACrypto/curves/constants.js +37 -0
- package/cjs/lib/WACrypto/hkdf.js +38 -0
- package/cjs/lib/WACrypto/index.js +51 -0
- package/cjs/lib/WACrypto/lthash.js +59 -0
- package/cjs/lib/WACrypto/math/constants.js +53 -0
- package/cjs/lib/WACrypto/math/edwards.js +206 -0
- package/cjs/lib/WACrypto/math/fe.js +449 -0
- package/cjs/lib/WACrypto/math/le.js +44 -0
- package/cjs/lib/WACrypto/math/mod.js +36 -0
- package/cjs/lib/WACrypto/util/bytes.js +348 -0
- package/cjs/lib/WACrypto/x25519.js +157 -0
- package/cjs/lib/WACrypto/xeddsa.js +134 -0
- package/cjs/lib/WAM/BinaryInfo.d.ts +7 -0
- package/cjs/lib/WAM/BinaryInfo.js +35 -0
- package/cjs/lib/WAM/constants.d.ts +34926 -0
- package/cjs/lib/WAM/constants.js +22890 -0
- package/cjs/lib/WAM/encode.d.ts +1 -0
- package/cjs/lib/WAM/encode.js +162 -0
- package/cjs/lib/WAM/index.d.ts +3 -0
- package/cjs/lib/WAM/index.js +25 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.js +77 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.js +76 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +52 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.js +61 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.js +50 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +76 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.js +53 -0
- package/cjs/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/cjs/lib/WAUSync/Protocols/index.js +29 -0
- package/cjs/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/cjs/lib/WAUSync/USyncQuery.js +113 -0
- package/cjs/lib/WAUSync/USyncUser.d.ts +16 -0
- package/cjs/lib/WAUSync/USyncUser.js +56 -0
- package/cjs/lib/WAUSync/index.d.ts +3 -0
- package/cjs/lib/WAUSync/index.js +25 -0
- package/cjs/lib/index.d.ts +11 -0
- package/cjs/lib/index.js +56 -0
- package/cjs/package.json +3 -0
- package/engine-requirements.js +12 -0
- package/lib/Addon/http-error.d.ts +18 -0
- package/lib/Addon/http-error.js +40 -0
- package/lib/Addon/index.d.ts +3 -0
- package/lib/Addon/index.js +4 -0
- package/lib/Addon/keyed-db.d.ts +14 -0
- package/lib/Addon/keyed-db.js +241 -0
- package/lib/Addon/link-preview.d.ts +15 -0
- package/lib/Addon/link-preview.js +79 -0
- package/lib/Defaults/index.d.ts +184 -0
- package/lib/Defaults/index.js +181 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +11 -0
- package/lib/Signal/Group/group-cipher.d.ts +10 -0
- package/lib/Signal/Group/group-cipher.js +81 -0
- package/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/lib/Signal/Group/group-session-builder.js +29 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +11 -0
- package/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/lib/Signal/Group/keyhelper.js +17 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +25 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +65 -0
- package/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/lib/Signal/Group/sender-key-name.js +47 -0
- package/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/lib/Signal/Group/sender-key-record.js +40 -0
- package/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/lib/Signal/Group/sender-key-state.js +83 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +25 -0
- package/lib/Signal/libsignal.d.ts +54 -0
- package/lib/Signal/libsignal.js +426 -0
- package/lib/Signal/lid-mapping.d.ts +20 -0
- package/lib/Signal/lid-mapping.js +274 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +2 -0
- package/lib/Socket/Client/types.d.ts +5 -0
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +119 -0
- package/lib/Socket/business.d.ts +387 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.d.ts +144 -0
- package/lib/Socket/chats.js +1216 -0
- package/lib/Socket/communities.d.ts +554 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/groups.d.ts +286 -0
- package/lib/Socket/groups.js +347 -0
- package/lib/Socket/index.d.ts +522 -0
- package/lib/Socket/index.js +11 -0
- package/lib/Socket/messages-recv.d.ts +326 -0
- package/lib/Socket/messages-recv.js +1822 -0
- package/lib/Socket/messages-send.d.ts +321 -0
- package/lib/Socket/messages-send.js +1378 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.d.ts +283 -0
- package/lib/Socket/newsletter.js +225 -0
- package/lib/Socket/socket.d.ts +61 -0
- package/lib/Socket/socket.js +992 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +3 -0
- package/lib/Store/make-in-memory-store.d.ts +63 -0
- package/lib/Store/make-in-memory-store.js +419 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/make-ordered-dictionary.js +78 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +23 -0
- package/lib/Transport/crypto.d.ts +6 -0
- package/lib/Transport/crypto.js +61 -0
- package/lib/Transport/curve.d.ts +8 -0
- package/lib/Transport/curve.js +66 -0
- package/lib/Transport/index.d.ts +16 -0
- package/lib/Transport/index.js +9 -0
- package/lib/Transport/internals.d.ts +57 -0
- package/lib/Transport/internals.js +155 -0
- package/lib/Transport/session-builder.d.ts +40 -0
- package/lib/Transport/session-builder.js +143 -0
- package/lib/Transport/session-cipher.d.ts +26 -0
- package/lib/Transport/session-cipher.js +301 -0
- package/lib/Transport/session-record.d.ts +55 -0
- package/lib/Transport/session-record.js +272 -0
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.d.ts +1 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.d.ts +1 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.js +7 -0
- package/lib/Types/Contact.d.ts +1 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +1 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +1 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/Label.js +24 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/LabelAssociation.js +6 -0
- package/lib/Types/Message.d.ts +11 -0
- package/lib/Types/Message.js +17 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Mex.js +38 -0
- package/lib/Types/Product.d.ts +1 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/RichType.d.ts +2 -0
- package/lib/Types/RichType.js +22 -0
- package/lib/Types/Signal.d.ts +1 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +1 -0
- package/lib/Types/Socket.js +1 -0
- package/lib/Types/State.d.ts +5 -0
- package/lib/Types/State.js +54 -0
- package/lib/Types/USync.d.ts +1 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +13 -0
- package/lib/Types/index.js +25 -0
- package/lib/Utils/auth-utils.d.ts +58 -0
- package/lib/Utils/auth-utils.js +316 -0
- package/lib/Utils/browser-utils.d.ts +9 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.d.ts +49 -0
- package/lib/Utils/business.js +230 -0
- package/lib/Utils/chat-utils.d.ts +408 -0
- package/lib/Utils/chat-utils.js +871 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/lib/Utils/companion-reg-client-utils.js +39 -0
- package/lib/Utils/crypto.d.ts +39 -0
- package/lib/Utils/crypto.js +117 -0
- package/lib/Utils/decode-wa-message.d.ts +83 -0
- package/lib/Utils/decode-wa-message.js +316 -0
- package/lib/Utils/event-buffer.d.ts +12 -0
- package/lib/Utils/event-buffer.js +621 -0
- package/lib/Utils/generics.d.ts +63 -0
- package/lib/Utils/generics.js +394 -0
- package/lib/Utils/history.d.ts +75 -0
- package/lib/Utils/history.js +133 -0
- package/lib/Utils/identity-change-handler.d.ts +13 -0
- package/lib/Utils/identity-change-handler.js +48 -0
- package/lib/Utils/index.d.ts +24 -0
- package/lib/Utils/index.js +24 -0
- package/lib/Utils/link-preview.d.ts +13 -0
- package/lib/Utils/link-preview.js +73 -0
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.js +12 -0
- package/lib/Utils/lt-hash.d.ts +6 -0
- package/lib/Utils/lt-hash.js +7 -0
- package/lib/Utils/make-mutex.d.ts +6 -0
- package/lib/Utils/make-mutex.js +32 -0
- package/lib/Utils/message-retry-manager.d.ts +79 -0
- package/lib/Utils/message-retry-manager.js +259 -0
- package/lib/Utils/messages-media.d.ts +134 -0
- package/lib/Utils/messages-media.js +802 -0
- package/lib/Utils/messages.d.ts +47 -0
- package/lib/Utils/messages.js +1911 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +200 -0
- package/lib/Utils/offline-node-processor.d.ts +10 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/pre-key-manager.d.ts +25 -0
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.d.ts +83 -0
- package/lib/Utils/process-message.js +748 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-message-utils.d.ts +48 -0
- package/lib/Utils/rich-message-utils.js +369 -0
- package/lib/Utils/signal.d.ts +82 -0
- package/lib/Utils/signal.js +200 -0
- package/lib/Utils/stanza-ack.d.ts +16 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/sync-action-utils.d.ts +2 -0
- package/lib/Utils/sync-action-utils.js +48 -0
- package/lib/Utils/tc-token-utils.d.ts +29 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-multi-file-auth-state.js +116 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-single-file-auth-state.js +94 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.js +109 -0
- package/lib/Utils/validate-connection.d.ts +44 -0
- package/lib/Utils/validate-connection.js +210 -0
- package/lib/WABinary/constants.d.ts +61 -0
- package/lib/WABinary/constants.js +1466 -0
- package/lib/WABinary/decode.d.ts +9 -0
- package/lib/WABinary/decode.js +261 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +219 -0
- package/lib/WABinary/generic-utils.d.ts +79 -0
- package/lib/WABinary/generic-utils.js +228 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +5 -0
- package/lib/WABinary/jid-utils.d.ts +28 -0
- package/lib/WABinary/jid-utils.js +95 -0
- package/lib/WABinary/types.d.ts +1 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WACrypto/appstate-keys.js +26 -0
- package/lib/WACrypto/curves/constants.js +12 -0
- package/lib/WACrypto/hkdf.js +27 -0
- package/lib/WACrypto/index.js +20 -0
- package/lib/WACrypto/lthash.js +54 -0
- package/lib/WACrypto/math/constants.js +24 -0
- package/lib/WACrypto/math/edwards.js +194 -0
- package/lib/WACrypto/math/fe.js +698 -0
- package/lib/WACrypto/math/le.js +23 -0
- package/lib/WACrypto/math/mod.js +15 -0
- package/lib/WACrypto/util/bytes.js +339 -0
- package/lib/WACrypto/x25519.js +145 -0
- package/lib/WACrypto/xeddsa.js +92 -0
- package/lib/WAM/BinaryInfo.d.ts +7 -0
- package/lib/WAM/BinaryInfo.js +9 -0
- package/lib/WAM/constants.d.ts +34926 -0
- package/lib/WAM/constants.js +22852 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +149 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +51 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/lib/WAUSync/Protocols/index.js +5 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncQuery.js +97 -0
- package/lib/WAUSync/USyncUser.d.ts +16 -0
- package/lib/WAUSync/USyncUser.js +30 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +11 -0
- package/package.json +79 -5
|
@@ -0,0 +1,274 @@
|
|
|
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 message_retry_manager_exports = {};
|
|
19
|
+
__export(message_retry_manager_exports, {
|
|
20
|
+
MessageRetryManager: () => MessageRetryManager,
|
|
21
|
+
RetryReason: () => RetryReason
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(message_retry_manager_exports);
|
|
24
|
+
var import_Addon = require("../Addon/index.js");
|
|
25
|
+
const RECENT_MESSAGES_SIZE = 1024;
|
|
26
|
+
const MESSAGE_KEY_SEPARATOR = "\0";
|
|
27
|
+
const RECREATE_SESSION_TIMEOUT = 60 * 60;
|
|
28
|
+
const PHONE_REQUEST_DELAY = 3e3;
|
|
29
|
+
var RetryReason;
|
|
30
|
+
(function(RetryReason2) {
|
|
31
|
+
RetryReason2[RetryReason2["UnknownError"] = 0] = "UnknownError";
|
|
32
|
+
RetryReason2[RetryReason2["SignalErrorNoSession"] = 1] = "SignalErrorNoSession";
|
|
33
|
+
RetryReason2[RetryReason2["SignalErrorInvalidKey"] = 2] = "SignalErrorInvalidKey";
|
|
34
|
+
RetryReason2[RetryReason2["SignalErrorInvalidKeyId"] = 3] = "SignalErrorInvalidKeyId";
|
|
35
|
+
RetryReason2[RetryReason2["SignalErrorInvalidMessage"] = 4] = "SignalErrorInvalidMessage";
|
|
36
|
+
RetryReason2[RetryReason2["SignalErrorInvalidSignature"] = 5] = "SignalErrorInvalidSignature";
|
|
37
|
+
RetryReason2[RetryReason2["SignalErrorFutureMessage"] = 6] = "SignalErrorFutureMessage";
|
|
38
|
+
RetryReason2[RetryReason2["SignalErrorBadMac"] = 7] = "SignalErrorBadMac";
|
|
39
|
+
RetryReason2[RetryReason2["SignalErrorInvalidSession"] = 8] = "SignalErrorInvalidSession";
|
|
40
|
+
RetryReason2[RetryReason2["SignalErrorInvalidMsgKey"] = 9] = "SignalErrorInvalidMsgKey";
|
|
41
|
+
RetryReason2[RetryReason2["BadBroadcastEphemeralSetting"] = 10] = "BadBroadcastEphemeralSetting";
|
|
42
|
+
RetryReason2[RetryReason2["UnknownCompanionNoPrekey"] = 11] = "UnknownCompanionNoPrekey";
|
|
43
|
+
RetryReason2[RetryReason2["AdvFailure"] = 12] = "AdvFailure";
|
|
44
|
+
RetryReason2[RetryReason2["StatusRevokeDelay"] = 13] = "StatusRevokeDelay";
|
|
45
|
+
})(RetryReason || (RetryReason = {}));
|
|
46
|
+
const MAC_ERROR_CODES = /* @__PURE__ */ new Set([RetryReason.SignalErrorInvalidMessage, RetryReason.SignalErrorBadMac]);
|
|
47
|
+
class MessageRetryManager {
|
|
48
|
+
constructor(logger, maxMsgRetryCount) {
|
|
49
|
+
this.logger = logger;
|
|
50
|
+
this.recentMessagesMap = (0, import_Addon.createCache)({
|
|
51
|
+
max: RECENT_MESSAGES_SIZE,
|
|
52
|
+
ttl: 5 * 60,
|
|
53
|
+
dispose: (_value, key) => {
|
|
54
|
+
const separatorIndex = key.lastIndexOf(MESSAGE_KEY_SEPARATOR);
|
|
55
|
+
if (separatorIndex > -1) {
|
|
56
|
+
const messageId = key.slice(separatorIndex + MESSAGE_KEY_SEPARATOR.length);
|
|
57
|
+
this.messageKeyIndex.delete(messageId);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
this.messageKeyIndex = /* @__PURE__ */ new Map();
|
|
62
|
+
this.sessionRecreateHistory = (0, import_Addon.createCache)({
|
|
63
|
+
ttl: RECREATE_SESSION_TIMEOUT * 2
|
|
64
|
+
});
|
|
65
|
+
this.retryCounters = (0, import_Addon.createCache)({
|
|
66
|
+
ttl: 15 * 60
|
|
67
|
+
});
|
|
68
|
+
this.baseKeys = (0, import_Addon.createCache)({
|
|
69
|
+
max: 1024,
|
|
70
|
+
ttl: 15 * 60
|
|
71
|
+
});
|
|
72
|
+
this.pendingPhoneRequests = {};
|
|
73
|
+
this.maxMsgRetryCount = 5;
|
|
74
|
+
this.statistics = {
|
|
75
|
+
totalRetries: 0,
|
|
76
|
+
successfulRetries: 0,
|
|
77
|
+
failedRetries: 0,
|
|
78
|
+
mediaRetries: 0,
|
|
79
|
+
sessionRecreations: 0,
|
|
80
|
+
phoneRequests: 0
|
|
81
|
+
};
|
|
82
|
+
this.maxMsgRetryCount = maxMsgRetryCount;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Add a recent message to the cache for retry handling
|
|
86
|
+
*/
|
|
87
|
+
addRecentMessage(to, id, message) {
|
|
88
|
+
const key = { to, id };
|
|
89
|
+
const keyStr = this.keyToString(key);
|
|
90
|
+
this.recentMessagesMap.set(keyStr, {
|
|
91
|
+
message,
|
|
92
|
+
timestamp: Date.now()
|
|
93
|
+
});
|
|
94
|
+
this.messageKeyIndex.set(id, keyStr);
|
|
95
|
+
this.logger.debug(`Added message to retry cache: ${to}/${id}`);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get a recent message from the cache
|
|
99
|
+
*/
|
|
100
|
+
getRecentMessage(to, id) {
|
|
101
|
+
const key = { to, id };
|
|
102
|
+
const keyStr = this.keyToString(key);
|
|
103
|
+
return this.recentMessagesMap.get(keyStr);
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Check if a session should be recreated based on retry count, history, and error code.
|
|
107
|
+
* MAC errors (codes 4 and 7) trigger immediate session recreation regardless of timeout.
|
|
108
|
+
*/
|
|
109
|
+
shouldRecreateSession(jid, hasSession, errorCode) {
|
|
110
|
+
if (!hasSession) {
|
|
111
|
+
this.sessionRecreateHistory.set(jid, Date.now());
|
|
112
|
+
this.statistics.sessionRecreations++;
|
|
113
|
+
return {
|
|
114
|
+
reason: "we don't have a Signal session with them",
|
|
115
|
+
recreate: true
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (errorCode !== void 0 && MAC_ERROR_CODES.has(errorCode)) {
|
|
119
|
+
this.sessionRecreateHistory.set(jid, Date.now());
|
|
120
|
+
this.statistics.sessionRecreations++;
|
|
121
|
+
this.logger.warn({ jid, errorCode: RetryReason[errorCode] }, "MAC error detected, forcing immediate session recreation");
|
|
122
|
+
return {
|
|
123
|
+
reason: `MAC error (code ${errorCode}: ${RetryReason[errorCode]}), immediate session recreation`,
|
|
124
|
+
recreate: true
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
const now = Date.now();
|
|
128
|
+
const prevTime = this.sessionRecreateHistory.get(jid);
|
|
129
|
+
if (!prevTime || now - prevTime > RECREATE_SESSION_TIMEOUT) {
|
|
130
|
+
this.sessionRecreateHistory.set(jid, now);
|
|
131
|
+
this.statistics.sessionRecreations++;
|
|
132
|
+
return {
|
|
133
|
+
reason: "retry count > 1 and over an hour since last recreation",
|
|
134
|
+
recreate: true
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
return { reason: "", recreate: false };
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Parse error code from retry receipt's retry node.
|
|
141
|
+
* Returns undefined if no error code is present.
|
|
142
|
+
*/
|
|
143
|
+
parseRetryErrorCode(errorAttr) {
|
|
144
|
+
if (errorAttr === void 0 || errorAttr === "") {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
const code = parseInt(errorAttr, 10);
|
|
148
|
+
if (Number.isNaN(code)) {
|
|
149
|
+
return void 0;
|
|
150
|
+
}
|
|
151
|
+
if (code >= RetryReason.UnknownError && code <= RetryReason.StatusRevokeDelay) {
|
|
152
|
+
return code;
|
|
153
|
+
}
|
|
154
|
+
return RetryReason.UnknownError;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Check if an error code indicates a MAC failure
|
|
158
|
+
*/
|
|
159
|
+
isMacError(errorCode) {
|
|
160
|
+
return errorCode !== void 0 && MAC_ERROR_CODES.has(errorCode);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Increment retry counter for a message
|
|
164
|
+
*/
|
|
165
|
+
incrementRetryCount(messageId) {
|
|
166
|
+
this.retryCounters.set(messageId, (this.retryCounters.get(messageId) || 0) + 1);
|
|
167
|
+
this.statistics.totalRetries++;
|
|
168
|
+
return this.retryCounters.get(messageId);
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get retry count for a message
|
|
172
|
+
*/
|
|
173
|
+
getRetryCount(messageId) {
|
|
174
|
+
return this.retryCounters.get(messageId) || 0;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Check if message has exceeded maximum retry attempts
|
|
178
|
+
*/
|
|
179
|
+
hasExceededMaxRetries(messageId) {
|
|
180
|
+
return this.getRetryCount(messageId) >= this.maxMsgRetryCount;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Mark retry as successful
|
|
184
|
+
*/
|
|
185
|
+
markRetrySuccess(messageId) {
|
|
186
|
+
this.statistics.successfulRetries++;
|
|
187
|
+
this.retryCounters.del(messageId);
|
|
188
|
+
this.cancelPendingPhoneRequest(messageId);
|
|
189
|
+
this.removeRecentMessage(messageId);
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Mark retry as failed
|
|
193
|
+
*/
|
|
194
|
+
markRetryFailed(messageId) {
|
|
195
|
+
this.statistics.failedRetries++;
|
|
196
|
+
this.retryCounters.del(messageId);
|
|
197
|
+
this.cancelPendingPhoneRequest(messageId);
|
|
198
|
+
this.removeRecentMessage(messageId);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Schedule a phone request with delay
|
|
202
|
+
*/
|
|
203
|
+
schedulePhoneRequest(messageId, callback, delay = PHONE_REQUEST_DELAY) {
|
|
204
|
+
this.cancelPendingPhoneRequest(messageId);
|
|
205
|
+
this.pendingPhoneRequests[messageId] = setTimeout(() => {
|
|
206
|
+
delete this.pendingPhoneRequests[messageId];
|
|
207
|
+
this.statistics.phoneRequests++;
|
|
208
|
+
callback();
|
|
209
|
+
}, delay);
|
|
210
|
+
this.logger.debug(`Scheduled phone request for message ${messageId} with ${delay}ms delay`);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Cancel pending phone request
|
|
214
|
+
*/
|
|
215
|
+
cancelPendingPhoneRequest(messageId) {
|
|
216
|
+
const timeout = this.pendingPhoneRequests[messageId];
|
|
217
|
+
if (timeout) {
|
|
218
|
+
clearTimeout(timeout);
|
|
219
|
+
delete this.pendingPhoneRequests[messageId];
|
|
220
|
+
this.logger.debug(`Cancelled pending phone request for message ${messageId}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
clear() {
|
|
224
|
+
this.recentMessagesMap.flushAll();
|
|
225
|
+
this.messageKeyIndex.clear();
|
|
226
|
+
this.sessionRecreateHistory.flushAll();
|
|
227
|
+
this.retryCounters.flushAll();
|
|
228
|
+
this.baseKeys.flushAll();
|
|
229
|
+
for (const messageId of Object.keys(this.pendingPhoneRequests)) {
|
|
230
|
+
this.cancelPendingPhoneRequest(messageId);
|
|
231
|
+
}
|
|
232
|
+
this.statistics = {
|
|
233
|
+
totalRetries: 0,
|
|
234
|
+
successfulRetries: 0,
|
|
235
|
+
failedRetries: 0,
|
|
236
|
+
mediaRetries: 0,
|
|
237
|
+
sessionRecreations: 0,
|
|
238
|
+
phoneRequests: 0
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
saveBaseKey(addr, msgId, baseKey) {
|
|
242
|
+
this.baseKeys.set(`${addr}:${msgId}`, baseKey);
|
|
243
|
+
}
|
|
244
|
+
hasSameBaseKey(addr, msgId, baseKey) {
|
|
245
|
+
const stored = this.baseKeys.get(`${addr}:${msgId}`);
|
|
246
|
+
if (!stored || stored.length !== baseKey.length) {
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
for (let i = 0; i < stored.length; i++) {
|
|
250
|
+
if (stored[i] !== baseKey[i])
|
|
251
|
+
return false;
|
|
252
|
+
}
|
|
253
|
+
return true;
|
|
254
|
+
}
|
|
255
|
+
deleteBaseKey(addr, msgId) {
|
|
256
|
+
this.baseKeys.del(`${addr}:${msgId}`);
|
|
257
|
+
}
|
|
258
|
+
keyToString(key) {
|
|
259
|
+
return `${key.to}${MESSAGE_KEY_SEPARATOR}${key.id}`;
|
|
260
|
+
}
|
|
261
|
+
removeRecentMessage(messageId) {
|
|
262
|
+
const keyStr = this.messageKeyIndex.get(messageId);
|
|
263
|
+
if (!keyStr) {
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
this.recentMessagesMap.del(keyStr);
|
|
267
|
+
this.messageKeyIndex.delete(messageId);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
271
|
+
0 && (module.exports = {
|
|
272
|
+
MessageRetryManager,
|
|
273
|
+
RetryReason
|
|
274
|
+
});
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** generates all the keys required to encrypt/decrypt & sign a media message */
|
|
2
|
+
export function getMediaKeys(buffer: any, mediaType: any): Promise<{
|
|
3
|
+
iv: any;
|
|
4
|
+
cipherKey: any;
|
|
5
|
+
macKey: any;
|
|
6
|
+
}>;
|
|
7
|
+
export function getAudioData(buffer: any, logger: any): Promise<any>;
|
|
8
|
+
/** generates a thumbnail for a given media, if required */
|
|
9
|
+
export function generateThumbnail(file: any, mediaType: any, options: any): Promise<{
|
|
10
|
+
thumbnail: any;
|
|
11
|
+
originalImageDimensions: {
|
|
12
|
+
width: any;
|
|
13
|
+
height: any;
|
|
14
|
+
} | undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export function extensionForMediaMessage(message: any): any;
|
|
17
|
+
export function getImageProcessingLibrary(): Promise<any>;
|
|
18
|
+
export function hkdfInfoKey(type: any): string;
|
|
19
|
+
export function getRawMediaUploadData(media: any, mediaType: any, logger: any): Promise<{
|
|
20
|
+
filePath: any;
|
|
21
|
+
fileSha256: any;
|
|
22
|
+
fileLength: number;
|
|
23
|
+
}>;
|
|
24
|
+
export function extractVideoThumb(path: any, time: any, size: any): Promise<any>;
|
|
25
|
+
export function extractImageThumb(bufferOrFilePath: any, width?: number): Promise<{
|
|
26
|
+
buffer: any;
|
|
27
|
+
original: {
|
|
28
|
+
width: any;
|
|
29
|
+
height: any;
|
|
30
|
+
};
|
|
31
|
+
}>;
|
|
32
|
+
export function encodeBase64EncodedStringForUpload(b64: any): string;
|
|
33
|
+
export function generateProfilePicture(mediaUpload: any, dimensions: any): Promise<{
|
|
34
|
+
img: any;
|
|
35
|
+
}>;
|
|
36
|
+
export function mediaMessageSHA256B64(message: any): any;
|
|
37
|
+
export function toReadable(buffer: any): any;
|
|
38
|
+
export function toBuffer(stream: any): Promise<any>;
|
|
39
|
+
export function getStream(item: any, opts: any): Promise<{
|
|
40
|
+
stream: any;
|
|
41
|
+
type: string;
|
|
42
|
+
}>;
|
|
43
|
+
export function getHttpStream(url: any, options?: {}): Promise<any>;
|
|
44
|
+
export function encryptedStream(media: any, mediaType: any, { logger, saveOriginalFileIfRequired, mediaKey, opts }?: {
|
|
45
|
+
mediaKey?: any;
|
|
46
|
+
}): Promise<{
|
|
47
|
+
mediaKey: any;
|
|
48
|
+
originalFilePath: any;
|
|
49
|
+
encFilePath: any;
|
|
50
|
+
mac: any;
|
|
51
|
+
fileEncSha256: any;
|
|
52
|
+
fileSha256: any;
|
|
53
|
+
fileLength: number;
|
|
54
|
+
}>;
|
|
55
|
+
export const DEF_MEDIA_HOST: "mmg.whatsapp.net";
|
|
56
|
+
export function getUrlFromDirectPath(directPath: any, host?: string): string;
|
|
57
|
+
export function downloadContentFromMessage({ mediaKey, directPath, url }: {
|
|
58
|
+
mediaKey: any;
|
|
59
|
+
directPath: any;
|
|
60
|
+
url: any;
|
|
61
|
+
}, type: any, opts?: {}): Promise<any>;
|
|
62
|
+
export function downloadEncryptedContent(downloadUrl: any, { cipherKey, iv }: {
|
|
63
|
+
cipherKey: any;
|
|
64
|
+
iv: any;
|
|
65
|
+
}, { startByte, endByte, options }?: {}): Promise<any>;
|
|
66
|
+
export function uploadWithNodeHttp({ url, filePath, headers, timeoutMs, agent }: {
|
|
67
|
+
url: any;
|
|
68
|
+
filePath: any;
|
|
69
|
+
headers: any;
|
|
70
|
+
timeoutMs: any;
|
|
71
|
+
agent: any;
|
|
72
|
+
}, redirectCount?: number): Promise<any>;
|
|
73
|
+
export function getWAUploadToServer({ customUploadHosts, fetchAgent, logger, options }: {
|
|
74
|
+
customUploadHosts: any;
|
|
75
|
+
fetchAgent: any;
|
|
76
|
+
logger: any;
|
|
77
|
+
options: any;
|
|
78
|
+
}, refreshMediaConn: any): (filePath: any, { mediaType, fileEncSha256B64, timeoutMs, newsletter }: {
|
|
79
|
+
mediaType: any;
|
|
80
|
+
fileEncSha256B64: any;
|
|
81
|
+
timeoutMs: any;
|
|
82
|
+
newsletter: any;
|
|
83
|
+
}) => Promise<{
|
|
84
|
+
mediaUrl: any;
|
|
85
|
+
directPath: any;
|
|
86
|
+
meta_hmac: any;
|
|
87
|
+
fbid: any;
|
|
88
|
+
ts: any;
|
|
89
|
+
thumbnailDirectPath: any;
|
|
90
|
+
thumbnailSha256: any;
|
|
91
|
+
}>;
|
|
92
|
+
export function encryptMediaRetryRequest(key: any, mediaKey: any, meId: any): {
|
|
93
|
+
tag: string;
|
|
94
|
+
attrs: {
|
|
95
|
+
id: any;
|
|
96
|
+
to: string;
|
|
97
|
+
type: string;
|
|
98
|
+
};
|
|
99
|
+
content: ({
|
|
100
|
+
tag: string;
|
|
101
|
+
attrs: {
|
|
102
|
+
jid?: undefined;
|
|
103
|
+
from_me?: undefined;
|
|
104
|
+
participant?: undefined;
|
|
105
|
+
};
|
|
106
|
+
content: {
|
|
107
|
+
tag: string;
|
|
108
|
+
attrs: {};
|
|
109
|
+
content: any;
|
|
110
|
+
}[];
|
|
111
|
+
} | {
|
|
112
|
+
tag: string;
|
|
113
|
+
attrs: {
|
|
114
|
+
jid: any;
|
|
115
|
+
from_me: string;
|
|
116
|
+
participant: any;
|
|
117
|
+
};
|
|
118
|
+
content?: undefined;
|
|
119
|
+
})[];
|
|
120
|
+
};
|
|
121
|
+
export function decodeMediaRetryNode(node: any): {
|
|
122
|
+
key: {
|
|
123
|
+
id: any;
|
|
124
|
+
remoteJid: any;
|
|
125
|
+
fromMe: boolean;
|
|
126
|
+
participant: any;
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
export function decryptMediaRetryData({ ciphertext, iv }: {
|
|
130
|
+
ciphertext: any;
|
|
131
|
+
iv: any;
|
|
132
|
+
}, mediaKey: any, msgId: any): proto.MediaRetryNotification & proto.MediaRetryNotification.$Properties;
|
|
133
|
+
export function getStatusCodeForMediaRetry(code: any): any;
|
|
134
|
+
import { proto } from '../../WAProto/index.js';
|