@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,73 @@
|
|
|
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 identity_change_handler_exports = {};
|
|
19
|
+
__export(identity_change_handler_exports, {
|
|
20
|
+
handleIdentityChange: () => handleIdentityChange
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(identity_change_handler_exports);
|
|
23
|
+
var import_WABinary = require("../WABinary/index.js");
|
|
24
|
+
var import_generics = require("./generics.js");
|
|
25
|
+
async function handleIdentityChange(node, ctx) {
|
|
26
|
+
const from = node.attrs.from;
|
|
27
|
+
if (!from) {
|
|
28
|
+
return { action: "invalid_notification" };
|
|
29
|
+
}
|
|
30
|
+
const identityNode = (0, import_WABinary.getBinaryNodeChild)(node, "identity");
|
|
31
|
+
if (!identityNode) {
|
|
32
|
+
return { action: "no_identity_node" };
|
|
33
|
+
}
|
|
34
|
+
ctx.logger.info({ jid: from }, "identity changed");
|
|
35
|
+
const decoded = (0, import_WABinary.jidDecode)(from);
|
|
36
|
+
if (decoded?.device && decoded.device !== 0) {
|
|
37
|
+
ctx.logger.debug({ jid: from, device: decoded.device }, "ignoring identity change from companion device");
|
|
38
|
+
return { action: "skipped_companion_device", device: decoded.device };
|
|
39
|
+
}
|
|
40
|
+
const isSelfPrimary = ctx.meId && ((0, import_WABinary.areJidsSameUser)(from, ctx.meId) || ctx.meLid && (0, import_WABinary.areJidsSameUser)(from, ctx.meLid));
|
|
41
|
+
if (isSelfPrimary) {
|
|
42
|
+
ctx.logger.info({ jid: from }, "self primary identity changed");
|
|
43
|
+
return { action: "skipped_self_primary" };
|
|
44
|
+
}
|
|
45
|
+
if (ctx.debounceCache.get(from)) {
|
|
46
|
+
ctx.logger.debug({ jid: from }, "skipping identity assert (debounced)");
|
|
47
|
+
return { action: "debounced" };
|
|
48
|
+
}
|
|
49
|
+
ctx.debounceCache.set(from, true);
|
|
50
|
+
const isOfflineNotification = !(0, import_generics.isStringNullOrEmpty)(node.attrs.offline);
|
|
51
|
+
const hasExistingSession = await ctx.validateSession(from);
|
|
52
|
+
if (!hasExistingSession.exists) {
|
|
53
|
+
ctx.logger.debug({ jid: from }, "no old session, skipping session refresh");
|
|
54
|
+
return { action: "skipped_no_session" };
|
|
55
|
+
}
|
|
56
|
+
ctx.logger.debug({ jid: from }, "old session exists, will refresh session");
|
|
57
|
+
if (isOfflineNotification) {
|
|
58
|
+
ctx.logger.debug({ jid: from }, "skipping session refresh during offline processing");
|
|
59
|
+
return { action: "skipped_offline" };
|
|
60
|
+
}
|
|
61
|
+
ctx.onBeforeSessionRefresh?.(from);
|
|
62
|
+
try {
|
|
63
|
+
await ctx.assertSessions([from], true);
|
|
64
|
+
return { action: "session_refreshed" };
|
|
65
|
+
} catch (error) {
|
|
66
|
+
ctx.logger.warn({ error, jid: from }, "failed to assert sessions after identity change");
|
|
67
|
+
return { action: "session_refresh_failed", error };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
handleIdentityChange
|
|
73
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from "./generics.js";
|
|
2
|
+
export * from "./decode-wa-message.js";
|
|
3
|
+
export * from "./messages.js";
|
|
4
|
+
export * from "./messages-media.js";
|
|
5
|
+
export * from "./validate-connection.js";
|
|
6
|
+
export * from "./crypto.js";
|
|
7
|
+
export * from "./signal.js";
|
|
8
|
+
export * from "./noise-handler.js";
|
|
9
|
+
export * from "./history.js";
|
|
10
|
+
export * from "./chat-utils.js";
|
|
11
|
+
export * from "./lt-hash.js";
|
|
12
|
+
export * from "./auth-utils.js";
|
|
13
|
+
export * from "./use-multi-file-auth-state.js";
|
|
14
|
+
export * from "./use-single-file-auth-state.js";
|
|
15
|
+
export * from "./use-sqlite-auth-state.js";
|
|
16
|
+
export * from "./link-preview.js";
|
|
17
|
+
export * from "./event-buffer.js";
|
|
18
|
+
export * from "./process-message.js";
|
|
19
|
+
export * from "./rich-message-utils.js";
|
|
20
|
+
export * from "./message-retry-manager.js";
|
|
21
|
+
export * from "./browser-utils.js";
|
|
22
|
+
export * from "./companion-reg-client-utils.js";
|
|
23
|
+
export * from "./identity-change-handler.js";
|
|
24
|
+
export * from "./stanza-ack.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __copyProps = (to, from, except, desc) => {
|
|
6
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
+
for (let key of __getOwnPropNames(from))
|
|
8
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
+
}
|
|
11
|
+
return to;
|
|
12
|
+
};
|
|
13
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var index_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(index_exports);
|
|
17
|
+
__reExport(index_exports, require("./generics.js"), module.exports);
|
|
18
|
+
__reExport(index_exports, require("./decode-wa-message.js"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./messages.js"), module.exports);
|
|
20
|
+
__reExport(index_exports, require("./messages-media.js"), module.exports);
|
|
21
|
+
__reExport(index_exports, require("./validate-connection.js"), module.exports);
|
|
22
|
+
__reExport(index_exports, require("./crypto.js"), module.exports);
|
|
23
|
+
__reExport(index_exports, require("./signal.js"), module.exports);
|
|
24
|
+
__reExport(index_exports, require("./noise-handler.js"), module.exports);
|
|
25
|
+
__reExport(index_exports, require("./history.js"), module.exports);
|
|
26
|
+
__reExport(index_exports, require("./chat-utils.js"), module.exports);
|
|
27
|
+
__reExport(index_exports, require("./lt-hash.js"), module.exports);
|
|
28
|
+
__reExport(index_exports, require("./auth-utils.js"), module.exports);
|
|
29
|
+
__reExport(index_exports, require("./use-multi-file-auth-state.js"), module.exports);
|
|
30
|
+
__reExport(index_exports, require("./use-single-file-auth-state.js"), module.exports);
|
|
31
|
+
__reExport(index_exports, require("./use-sqlite-auth-state.js"), module.exports);
|
|
32
|
+
__reExport(index_exports, require("./link-preview.js"), module.exports);
|
|
33
|
+
__reExport(index_exports, require("./event-buffer.js"), module.exports);
|
|
34
|
+
__reExport(index_exports, require("./process-message.js"), module.exports);
|
|
35
|
+
__reExport(index_exports, require("./rich-message-utils.js"), module.exports);
|
|
36
|
+
__reExport(index_exports, require("./message-retry-manager.js"), module.exports);
|
|
37
|
+
__reExport(index_exports, require("./browser-utils.js"), module.exports);
|
|
38
|
+
__reExport(index_exports, require("./companion-reg-client-utils.js"), module.exports);
|
|
39
|
+
__reExport(index_exports, require("./identity-change-handler.js"), module.exports);
|
|
40
|
+
__reExport(index_exports, require("./stanza-ack.js"), module.exports);
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
...require("./generics.js"),
|
|
44
|
+
...require("./decode-wa-message.js"),
|
|
45
|
+
...require("./messages.js"),
|
|
46
|
+
...require("./messages-media.js"),
|
|
47
|
+
...require("./validate-connection.js"),
|
|
48
|
+
...require("./crypto.js"),
|
|
49
|
+
...require("./signal.js"),
|
|
50
|
+
...require("./noise-handler.js"),
|
|
51
|
+
...require("./history.js"),
|
|
52
|
+
...require("./chat-utils.js"),
|
|
53
|
+
...require("./lt-hash.js"),
|
|
54
|
+
...require("./auth-utils.js"),
|
|
55
|
+
...require("./use-multi-file-auth-state.js"),
|
|
56
|
+
...require("./use-single-file-auth-state.js"),
|
|
57
|
+
...require("./use-sqlite-auth-state.js"),
|
|
58
|
+
...require("./link-preview.js"),
|
|
59
|
+
...require("./event-buffer.js"),
|
|
60
|
+
...require("./process-message.js"),
|
|
61
|
+
...require("./rich-message-utils.js"),
|
|
62
|
+
...require("./message-retry-manager.js"),
|
|
63
|
+
...require("./browser-utils.js"),
|
|
64
|
+
...require("./companion-reg-client-utils.js"),
|
|
65
|
+
...require("./identity-change-handler.js"),
|
|
66
|
+
...require("./stanza-ack.js")
|
|
67
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export function getUrlInfo(text: any, opts?: {
|
|
2
|
+
thumbnailWidth: number;
|
|
3
|
+
fetchOpts: {
|
|
4
|
+
timeout: number;
|
|
5
|
+
};
|
|
6
|
+
}): Promise<{
|
|
7
|
+
'canonical-url': string;
|
|
8
|
+
'matched-text': any;
|
|
9
|
+
title: any;
|
|
10
|
+
description: any;
|
|
11
|
+
originalThumbnailUrl: any;
|
|
12
|
+
'preview-type': number;
|
|
13
|
+
} | undefined>;
|
|
@@ -0,0 +1,87 @@
|
|
|
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 link_preview_exports = {};
|
|
19
|
+
__export(link_preview_exports, {
|
|
20
|
+
getUrlInfo: () => getUrlInfo
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(link_preview_exports);
|
|
23
|
+
var import_Addon = require("../Addon/index.js");
|
|
24
|
+
var import_messages = require("./messages.js");
|
|
25
|
+
var import_messages_media = require("./messages-media.js");
|
|
26
|
+
const URL_PROTOCOL_REGEX = /^https?:\/\//;
|
|
27
|
+
const THUMBNAIL_WIDTH_PX = 192;
|
|
28
|
+
const getCompressedJpegThumbnail = async (url, { thumbnailWidth, fetchOpts }) => {
|
|
29
|
+
const stream = await (0, import_messages_media.getHttpStream)(url, fetchOpts);
|
|
30
|
+
const result = await (0, import_messages_media.extractImageThumb)(stream, thumbnailWidth);
|
|
31
|
+
return result;
|
|
32
|
+
};
|
|
33
|
+
const getUrlInfo = async (text, opts = {
|
|
34
|
+
thumbnailWidth: THUMBNAIL_WIDTH_PX,
|
|
35
|
+
fetchOpts: { timeout: 3e3 }
|
|
36
|
+
}) => {
|
|
37
|
+
try {
|
|
38
|
+
const previewLink = URL_PROTOCOL_REGEX.test(text) ? text : "https://" + text;
|
|
39
|
+
const info = await (0, import_Addon.getLinkPreview)(previewLink, opts.fetchOpts.timeout);
|
|
40
|
+
if (info?.title) {
|
|
41
|
+
const urlInfo = {
|
|
42
|
+
"canonical-url": info.url,
|
|
43
|
+
"matched-text": text,
|
|
44
|
+
title: info.title,
|
|
45
|
+
description: info.description,
|
|
46
|
+
originalThumbnailUrl: info.image,
|
|
47
|
+
"preview-type": info.video ? 1 : 0
|
|
48
|
+
};
|
|
49
|
+
if (opts.uploadImage) {
|
|
50
|
+
await Promise.all([
|
|
51
|
+
(async () => {
|
|
52
|
+
const { imageMessage } = await (0, import_messages.prepareWAMessageMedia)({ image: { url: info.image } }, {
|
|
53
|
+
upload: opts.uploadImage,
|
|
54
|
+
mediaTypeOverride: "thumbnail-link",
|
|
55
|
+
options: opts.fetchOpts
|
|
56
|
+
});
|
|
57
|
+
urlInfo.jpegThumbnail = imageMessage?.jpegThumbnail ? Buffer.from(imageMessage.jpegThumbnail) : void 0;
|
|
58
|
+
urlInfo.highQualityThumbnail = imageMessage;
|
|
59
|
+
})(),
|
|
60
|
+
info.favicon ? (async () => {
|
|
61
|
+
const { imageMessage } = await (0, import_messages.prepareWAMessageMedia)({ image: { url: info.favicon } }, {
|
|
62
|
+
upload: opts.uploadImage,
|
|
63
|
+
mediaTypeOverride: "thumbnail-link",
|
|
64
|
+
options: opts.fetchOpts
|
|
65
|
+
});
|
|
66
|
+
urlInfo.favicon = imageMessage;
|
|
67
|
+
})() : Promise.resolve()
|
|
68
|
+
]);
|
|
69
|
+
} else {
|
|
70
|
+
try {
|
|
71
|
+
urlInfo.jpegThumbnail = info.image ? (await getCompressedJpegThumbnail(info.image, opts)).buffer : void 0;
|
|
72
|
+
} catch (error) {
|
|
73
|
+
opts.logger?.debug({ err: error.stack, url: previewLink }, "error in generating thumbnail");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return urlInfo;
|
|
77
|
+
}
|
|
78
|
+
} catch (error) {
|
|
79
|
+
if (!error.message.includes("receive a valid")) {
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
getUrlInfo
|
|
87
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export default SILENT_LOGGER;
|
|
2
|
+
declare const SILENT_LOGGER: Readonly<{
|
|
3
|
+
level: "silent";
|
|
4
|
+
debug: () => void;
|
|
5
|
+
info: () => void;
|
|
6
|
+
warn: () => void;
|
|
7
|
+
error: () => void;
|
|
8
|
+
fatal: () => void;
|
|
9
|
+
trace: () => void;
|
|
10
|
+
child: () => Readonly</*elided*/ any>;
|
|
11
|
+
isLevelEnabled: () => false;
|
|
12
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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 logger_exports = {};
|
|
19
|
+
__export(logger_exports, {
|
|
20
|
+
default: () => logger_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(logger_exports);
|
|
23
|
+
const SILENT_LOGGER = Object.freeze({
|
|
24
|
+
level: "silent",
|
|
25
|
+
debug: () => {
|
|
26
|
+
},
|
|
27
|
+
info: () => {
|
|
28
|
+
},
|
|
29
|
+
warn: () => {
|
|
30
|
+
},
|
|
31
|
+
error: () => {
|
|
32
|
+
},
|
|
33
|
+
fatal: () => {
|
|
34
|
+
},
|
|
35
|
+
trace: () => {
|
|
36
|
+
},
|
|
37
|
+
child: () => SILENT_LOGGER,
|
|
38
|
+
isLevelEnabled: () => false
|
|
39
|
+
});
|
|
40
|
+
var logger_default = SILENT_LOGGER;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LT Hash is a summation based hash algorithm that maintains the integrity of a piece of data
|
|
3
|
+
* over a series of mutations. You can add/remove mutations and it'll return a hash equal to
|
|
4
|
+
* if the same series of mutations was made sequentially.
|
|
5
|
+
*/
|
|
6
|
+
export const LT_HASH_ANTI_TAMPERING: any;
|
|
@@ -0,0 +1,28 @@
|
|
|
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 lt_hash_exports = {};
|
|
19
|
+
__export(lt_hash_exports, {
|
|
20
|
+
LT_HASH_ANTI_TAMPERING: () => LT_HASH_ANTI_TAMPERING
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(lt_hash_exports);
|
|
23
|
+
var import_WACrypto = require("../WACrypto/index.js");
|
|
24
|
+
const LT_HASH_ANTI_TAMPERING = new import_WACrypto.LTHashAntiTampering();
|
|
25
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
+
0 && (module.exports = {
|
|
27
|
+
LT_HASH_ANTI_TAMPERING
|
|
28
|
+
});
|
|
@@ -0,0 +1,58 @@
|
|
|
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 make_mutex_exports = {};
|
|
19
|
+
__export(make_mutex_exports, {
|
|
20
|
+
makeKeyedMutex: () => makeKeyedMutex,
|
|
21
|
+
makeMutex: () => makeMutex
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(make_mutex_exports);
|
|
24
|
+
var import_Addon = require("../Addon/index.js");
|
|
25
|
+
const makeMutex = () => {
|
|
26
|
+
const mutex = (0, import_Addon.createMutex)();
|
|
27
|
+
return {
|
|
28
|
+
mutex(code) {
|
|
29
|
+
return mutex.runExclusive(code);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const makeKeyedMutex = () => {
|
|
34
|
+
const map = /* @__PURE__ */ new Map();
|
|
35
|
+
return {
|
|
36
|
+
async mutex(key, task) {
|
|
37
|
+
let entry = map.get(key);
|
|
38
|
+
if (!entry) {
|
|
39
|
+
entry = { mutex: (0, import_Addon.createMutex)(), refCount: 0 };
|
|
40
|
+
map.set(key, entry);
|
|
41
|
+
}
|
|
42
|
+
entry.refCount++;
|
|
43
|
+
try {
|
|
44
|
+
return await entry.mutex.runExclusive(task);
|
|
45
|
+
} finally {
|
|
46
|
+
entry.refCount--;
|
|
47
|
+
if (entry.refCount === 0 && map.get(key) === entry) {
|
|
48
|
+
map.delete(key);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
makeKeyedMutex,
|
|
57
|
+
makeMutex
|
|
58
|
+
});
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export const RetryReason: any;
|
|
2
|
+
export class MessageRetryManager {
|
|
3
|
+
constructor(logger: any, maxMsgRetryCount: any);
|
|
4
|
+
logger: any;
|
|
5
|
+
recentMessagesMap: any;
|
|
6
|
+
messageKeyIndex: Map<any, any>;
|
|
7
|
+
sessionRecreateHistory: any;
|
|
8
|
+
retryCounters: any;
|
|
9
|
+
baseKeys: any;
|
|
10
|
+
pendingPhoneRequests: {};
|
|
11
|
+
maxMsgRetryCount: any;
|
|
12
|
+
statistics: {
|
|
13
|
+
totalRetries: number;
|
|
14
|
+
successfulRetries: number;
|
|
15
|
+
failedRetries: number;
|
|
16
|
+
mediaRetries: number;
|
|
17
|
+
sessionRecreations: number;
|
|
18
|
+
phoneRequests: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Add a recent message to the cache for retry handling
|
|
22
|
+
*/
|
|
23
|
+
addRecentMessage(to: any, id: any, message: any): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get a recent message from the cache
|
|
26
|
+
*/
|
|
27
|
+
getRecentMessage(to: any, id: any): any;
|
|
28
|
+
/**
|
|
29
|
+
* Check if a session should be recreated based on retry count, history, and error code.
|
|
30
|
+
* MAC errors (codes 4 and 7) trigger immediate session recreation regardless of timeout.
|
|
31
|
+
*/
|
|
32
|
+
shouldRecreateSession(jid: any, hasSession: any, errorCode: any): {
|
|
33
|
+
reason: string;
|
|
34
|
+
recreate: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Parse error code from retry receipt's retry node.
|
|
38
|
+
* Returns undefined if no error code is present.
|
|
39
|
+
*/
|
|
40
|
+
parseRetryErrorCode(errorAttr: any): any;
|
|
41
|
+
/**
|
|
42
|
+
* Check if an error code indicates a MAC failure
|
|
43
|
+
*/
|
|
44
|
+
isMacError(errorCode: any): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Increment retry counter for a message
|
|
47
|
+
*/
|
|
48
|
+
incrementRetryCount(messageId: any): any;
|
|
49
|
+
/**
|
|
50
|
+
* Get retry count for a message
|
|
51
|
+
*/
|
|
52
|
+
getRetryCount(messageId: any): any;
|
|
53
|
+
/**
|
|
54
|
+
* Check if message has exceeded maximum retry attempts
|
|
55
|
+
*/
|
|
56
|
+
hasExceededMaxRetries(messageId: any): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Mark retry as successful
|
|
59
|
+
*/
|
|
60
|
+
markRetrySuccess(messageId: any): void;
|
|
61
|
+
/**
|
|
62
|
+
* Mark retry as failed
|
|
63
|
+
*/
|
|
64
|
+
markRetryFailed(messageId: any): void;
|
|
65
|
+
/**
|
|
66
|
+
* Schedule a phone request with delay
|
|
67
|
+
*/
|
|
68
|
+
schedulePhoneRequest(messageId: any, callback: any, delay?: number): void;
|
|
69
|
+
/**
|
|
70
|
+
* Cancel pending phone request
|
|
71
|
+
*/
|
|
72
|
+
cancelPendingPhoneRequest(messageId: any): void;
|
|
73
|
+
clear(): void;
|
|
74
|
+
saveBaseKey(addr: any, msgId: any, baseKey: any): void;
|
|
75
|
+
hasSameBaseKey(addr: any, msgId: any, baseKey: any): boolean;
|
|
76
|
+
deleteBaseKey(addr: any, msgId: any): void;
|
|
77
|
+
keyToString(key: any): string;
|
|
78
|
+
removeRecentMessage(messageId: any): void;
|
|
79
|
+
}
|