@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,241 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _KeyedDB_instances, _KeyedDB_spec, _KeyedDB_idGetter, _KeyedDB_items, _KeyedDB_byId, _KeyedDB_key, _KeyedDB_id, _KeyedDB_lowerBound, _KeyedDB_sameKey, _KeyedDB_insertNew;
|
|
13
|
+
function snapshotProperties(value) {
|
|
14
|
+
if (value === null || (typeof value !== 'object' && typeof value !== 'function')) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
return Object.getOwnPropertyDescriptors(value);
|
|
18
|
+
}
|
|
19
|
+
function restoreProperties(value, snapshot) {
|
|
20
|
+
if (!snapshot) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
24
|
+
if (!Object.prototype.hasOwnProperty.call(snapshot, key)) {
|
|
25
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
26
|
+
if (descriptor?.configurable) {
|
|
27
|
+
Reflect.deleteProperty(value, key);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
Object.defineProperties(value, snapshot);
|
|
32
|
+
}
|
|
33
|
+
export class KeyedDB {
|
|
34
|
+
constructor(key, id) {
|
|
35
|
+
_KeyedDB_instances.add(this);
|
|
36
|
+
_KeyedDB_spec.set(this, void 0);
|
|
37
|
+
_KeyedDB_idGetter.set(this, void 0);
|
|
38
|
+
_KeyedDB_items.set(this, []);
|
|
39
|
+
_KeyedDB_byId.set(this, new Map());
|
|
40
|
+
if (typeof key?.key !== 'function' || typeof key?.compare !== 'function') {
|
|
41
|
+
throw new TypeError('key must provide key(value) and compare(a, b) functions');
|
|
42
|
+
}
|
|
43
|
+
if (id !== undefined && typeof id !== 'function') {
|
|
44
|
+
throw new TypeError('id must be a function');
|
|
45
|
+
}
|
|
46
|
+
__classPrivateFieldSet(this, _KeyedDB_spec, key, "f");
|
|
47
|
+
__classPrivateFieldSet(this, _KeyedDB_idGetter, id, "f");
|
|
48
|
+
}
|
|
49
|
+
clear() {
|
|
50
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").length = 0;
|
|
51
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").clear();
|
|
52
|
+
}
|
|
53
|
+
insertIfAbsent(...values) {
|
|
54
|
+
const inserted = [];
|
|
55
|
+
for (const value of values) {
|
|
56
|
+
if (!value) {
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
const id = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_id).call(this, value);
|
|
60
|
+
if (__classPrivateFieldGet(this, _KeyedDB_byId, "f").has(id)) {
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
const key = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, value);
|
|
64
|
+
const index = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, key);
|
|
65
|
+
if (index < __classPrivateFieldGet(this, _KeyedDB_items, "f").length && __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_sameKey).call(this, __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, __classPrivateFieldGet(this, _KeyedDB_items, "f")[index]), key)) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(index, 0, value);
|
|
69
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").set(id, value);
|
|
70
|
+
inserted.push(value);
|
|
71
|
+
}
|
|
72
|
+
return inserted;
|
|
73
|
+
}
|
|
74
|
+
upsert(...values) {
|
|
75
|
+
const updated = [];
|
|
76
|
+
for (const value of values) {
|
|
77
|
+
if (!value) {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const id = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_id).call(this, value);
|
|
81
|
+
const previous = __classPrivateFieldGet(this, _KeyedDB_byId, "f").get(id);
|
|
82
|
+
const exists = __classPrivateFieldGet(this, _KeyedDB_byId, "f").has(id);
|
|
83
|
+
const key = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, value);
|
|
84
|
+
const index = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, key);
|
|
85
|
+
if (index < __classPrivateFieldGet(this, _KeyedDB_items, "f").length && __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_sameKey).call(this, __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, __classPrivateFieldGet(this, _KeyedDB_items, "f")[index]), key) && __classPrivateFieldGet(this, _KeyedDB_items, "f")[index] !== previous) {
|
|
86
|
+
throw new Error(`duplicate key: ${String(key)}`);
|
|
87
|
+
}
|
|
88
|
+
if (!exists) {
|
|
89
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(index, 0, value);
|
|
90
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").set(id, value);
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
const oldKey = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, previous);
|
|
94
|
+
const oldIndex = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, oldKey);
|
|
95
|
+
if (__classPrivateFieldGet(this, _KeyedDB_items, "f")[oldIndex] !== previous) {
|
|
96
|
+
throw new Error('KeyedDB index is inconsistent');
|
|
97
|
+
}
|
|
98
|
+
if (__classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_sameKey).call(this, oldKey, key)) {
|
|
99
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f")[oldIndex] = value;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(oldIndex, 1);
|
|
103
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(__classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, key), 0, value);
|
|
104
|
+
}
|
|
105
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").set(id, value);
|
|
106
|
+
updated.push(value);
|
|
107
|
+
}
|
|
108
|
+
return updated;
|
|
109
|
+
}
|
|
110
|
+
update(id, callback) {
|
|
111
|
+
if (typeof callback !== 'function') {
|
|
112
|
+
throw new TypeError('update must be a function');
|
|
113
|
+
}
|
|
114
|
+
if (!__classPrivateFieldGet(this, _KeyedDB_byId, "f").has(id)) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const value = __classPrivateFieldGet(this, _KeyedDB_byId, "f").get(id);
|
|
118
|
+
const oldId = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_id).call(this, value);
|
|
119
|
+
const oldKey = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, value);
|
|
120
|
+
const oldIndex = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, oldKey);
|
|
121
|
+
if (__classPrivateFieldGet(this, _KeyedDB_items, "f")[oldIndex] !== value) {
|
|
122
|
+
throw new Error('KeyedDB index is inconsistent');
|
|
123
|
+
}
|
|
124
|
+
const snapshot = snapshotProperties(value);
|
|
125
|
+
let removed = false;
|
|
126
|
+
try {
|
|
127
|
+
callback(value);
|
|
128
|
+
const nextId = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_id).call(this, value);
|
|
129
|
+
const nextKey = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, value);
|
|
130
|
+
if (!Object.is(nextId, oldId) && __classPrivateFieldGet(this, _KeyedDB_byId, "f").has(nextId)) {
|
|
131
|
+
throw new Error(`duplicate ID: ${String(nextId)}`);
|
|
132
|
+
}
|
|
133
|
+
if (__classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_sameKey).call(this, oldKey, nextKey)) {
|
|
134
|
+
if (!Object.is(nextId, oldId)) {
|
|
135
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").delete(oldId);
|
|
136
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").set(nextId, value);
|
|
137
|
+
}
|
|
138
|
+
return 1;
|
|
139
|
+
}
|
|
140
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(oldIndex, 1);
|
|
141
|
+
removed = true;
|
|
142
|
+
const nextIndex = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, nextKey);
|
|
143
|
+
if (nextIndex < __classPrivateFieldGet(this, _KeyedDB_items, "f").length && __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_sameKey).call(this, __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, __classPrivateFieldGet(this, _KeyedDB_items, "f")[nextIndex]), nextKey)) {
|
|
144
|
+
throw new Error(`duplicate key: ${String(nextKey)}`);
|
|
145
|
+
}
|
|
146
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(nextIndex, 0, value);
|
|
147
|
+
removed = false;
|
|
148
|
+
if (!Object.is(nextId, oldId)) {
|
|
149
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").delete(oldId);
|
|
150
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").set(nextId, value);
|
|
151
|
+
}
|
|
152
|
+
return 2;
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
restoreProperties(value, snapshot);
|
|
156
|
+
if (removed) {
|
|
157
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(oldIndex, 0, value);
|
|
158
|
+
}
|
|
159
|
+
throw error;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
get(id) {
|
|
163
|
+
return __classPrivateFieldGet(this, _KeyedDB_byId, "f").get(id);
|
|
164
|
+
}
|
|
165
|
+
deleteById(id, assertPresent = true) {
|
|
166
|
+
if (!__classPrivateFieldGet(this, _KeyedDB_byId, "f").has(id)) {
|
|
167
|
+
if (assertPresent) {
|
|
168
|
+
throw new Error('Value not found');
|
|
169
|
+
}
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
172
|
+
return this.delete(__classPrivateFieldGet(this, _KeyedDB_byId, "f").get(id));
|
|
173
|
+
}
|
|
174
|
+
delete(value) {
|
|
175
|
+
if (value == null) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
const key = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, value);
|
|
179
|
+
const index = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, key);
|
|
180
|
+
if (index >= __classPrivateFieldGet(this, _KeyedDB_items, "f").length || !__classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_sameKey).call(this, __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, __classPrivateFieldGet(this, _KeyedDB_items, "f")[index]), key)) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
const removed = __classPrivateFieldGet(this, _KeyedDB_items, "f").splice(index, 1)[0];
|
|
184
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").delete(__classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_id).call(this, removed));
|
|
185
|
+
return removed;
|
|
186
|
+
}
|
|
187
|
+
filter(predicate = () => true) {
|
|
188
|
+
if (typeof predicate !== 'function') {
|
|
189
|
+
throw new TypeError('predicate must be a function');
|
|
190
|
+
}
|
|
191
|
+
const result = new KeyedDB(__classPrivateFieldGet(this, _KeyedDB_spec, "f"), __classPrivateFieldGet(this, _KeyedDB_idGetter, "f"));
|
|
192
|
+
for (let index = 0; index < __classPrivateFieldGet(this, _KeyedDB_items, "f").length; index++) {
|
|
193
|
+
const value = __classPrivateFieldGet(this, _KeyedDB_items, "f")[index];
|
|
194
|
+
if (predicate(value, index)) {
|
|
195
|
+
__classPrivateFieldGet(result, _KeyedDB_items, "f").push(value);
|
|
196
|
+
__classPrivateFieldGet(result, _KeyedDB_byId, "f").set(__classPrivateFieldGet(result, _KeyedDB_instances, "m", _KeyedDB_id).call(result, value), value);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
return result;
|
|
200
|
+
}
|
|
201
|
+
all() {
|
|
202
|
+
return __classPrivateFieldGet(this, _KeyedDB_items, "f").slice();
|
|
203
|
+
}
|
|
204
|
+
toJSON() {
|
|
205
|
+
return __classPrivateFieldGet(this, _KeyedDB_items, "f");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
_KeyedDB_spec = new WeakMap(), _KeyedDB_idGetter = new WeakMap(), _KeyedDB_items = new WeakMap(), _KeyedDB_byId = new WeakMap(), _KeyedDB_instances = new WeakSet(), _KeyedDB_key = function _KeyedDB_key(value) {
|
|
209
|
+
return __classPrivateFieldGet(this, _KeyedDB_spec, "f").key(value);
|
|
210
|
+
}, _KeyedDB_id = function _KeyedDB_id(value) {
|
|
211
|
+
const id = __classPrivateFieldGet(this, _KeyedDB_idGetter, "f") ? __classPrivateFieldGet(this, _KeyedDB_idGetter, "f").call(this, value) : String(__classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, value));
|
|
212
|
+
if (id == null) {
|
|
213
|
+
throw new TypeError('ID must not be null or undefined');
|
|
214
|
+
}
|
|
215
|
+
return id;
|
|
216
|
+
}, _KeyedDB_lowerBound = function _KeyedDB_lowerBound(key) {
|
|
217
|
+
let low = 0;
|
|
218
|
+
let high = __classPrivateFieldGet(this, _KeyedDB_items, "f").length;
|
|
219
|
+
while (low < high) {
|
|
220
|
+
const mid = low + ((high - low) >>> 1);
|
|
221
|
+
if (__classPrivateFieldGet(this, _KeyedDB_spec, "f").compare(__classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, __classPrivateFieldGet(this, _KeyedDB_items, "f")[mid]), key) < 0) {
|
|
222
|
+
low = mid + 1;
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
high = mid;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return low;
|
|
229
|
+
}, _KeyedDB_sameKey = function _KeyedDB_sameKey(a, b) {
|
|
230
|
+
return __classPrivateFieldGet(this, _KeyedDB_spec, "f").compare(a, b) === 0;
|
|
231
|
+
}, _KeyedDB_insertNew = function _KeyedDB_insertNew(value, id = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_id).call(this, value), key = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, value)) {
|
|
232
|
+
if (__classPrivateFieldGet(this, _KeyedDB_byId, "f").has(id)) {
|
|
233
|
+
throw new Error(`duplicate ID: ${String(id)}`);
|
|
234
|
+
}
|
|
235
|
+
const index = __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_lowerBound).call(this, key);
|
|
236
|
+
if (index < __classPrivateFieldGet(this, _KeyedDB_items, "f").length && __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_sameKey).call(this, __classPrivateFieldGet(this, _KeyedDB_instances, "m", _KeyedDB_key).call(this, __classPrivateFieldGet(this, _KeyedDB_items, "f")[index]), key)) {
|
|
237
|
+
throw new Error(`duplicate key: ${String(key)}`);
|
|
238
|
+
}
|
|
239
|
+
__classPrivateFieldGet(this, _KeyedDB_items, "f").splice(index, 0, value);
|
|
240
|
+
__classPrivateFieldGet(this, _KeyedDB_byId, "f").set(id, value);
|
|
241
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function getLinkPreview(url: any, timeout?: number): Promise<{
|
|
2
|
+
url: string;
|
|
3
|
+
title?: undefined;
|
|
4
|
+
description?: undefined;
|
|
5
|
+
favicon?: undefined;
|
|
6
|
+
image?: undefined;
|
|
7
|
+
video?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
url: string;
|
|
10
|
+
title: any;
|
|
11
|
+
description: any;
|
|
12
|
+
favicon: any;
|
|
13
|
+
image: any;
|
|
14
|
+
video: any;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { TEXT_DECODER } from '../Defaults/index.js';
|
|
2
|
+
import { HttpError } from './http-error.js';
|
|
3
|
+
const MAX = 262144;
|
|
4
|
+
const TAG = /<(meta|link)\b([^>]*)>|<title[^>]*>([^<]*)/gi;
|
|
5
|
+
const ATTR = /([\w:-]+)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/g;
|
|
6
|
+
const ENT = /&(?:#(\d+)|#x([\da-f]+)|(amp|lt|gt|quot|apos));/gi;
|
|
7
|
+
const MAP = { amp: '&', lt: '<', gt: '>', quot: '"', apos: "'" };
|
|
8
|
+
const txt = s => s && s.replace(ENT, (_, d, h, n) => {
|
|
9
|
+
if (n)
|
|
10
|
+
return MAP[n.toLowerCase()];
|
|
11
|
+
const c = d ? +d : parseInt(h, 16);
|
|
12
|
+
return c <= 0x10FFFF ? String.fromCodePoint(c) : '';
|
|
13
|
+
}).replace(/\s+/g, ' ').trim();
|
|
14
|
+
async function readHead(res) {
|
|
15
|
+
let html = '';
|
|
16
|
+
for await (const chunk of res.body) {
|
|
17
|
+
html += TEXT_DECODER.decode(chunk, { stream: true });
|
|
18
|
+
const i = html.search(/<\/head>|<body/i);
|
|
19
|
+
if (i !== -1)
|
|
20
|
+
return html.slice(0, i);
|
|
21
|
+
if (html.length > MAX)
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
return html;
|
|
25
|
+
}
|
|
26
|
+
export async function getLinkPreview(url, timeout = 3000) {
|
|
27
|
+
const res = await fetch(url, {
|
|
28
|
+
signal: AbortSignal.timeout(timeout),
|
|
29
|
+
headers: {
|
|
30
|
+
Accept: 'text/html',
|
|
31
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
32
|
+
'User-Agent': 'Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)'
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
if (!res.ok)
|
|
36
|
+
throw new HttpError(`HTTP ${res.status} ${res.statusText}`);
|
|
37
|
+
if (!/html/i.test(res.headers.get('content-type') ?? '')) {
|
|
38
|
+
await res.body?.cancel();
|
|
39
|
+
return { url: res.url };
|
|
40
|
+
}
|
|
41
|
+
const base = res.url;
|
|
42
|
+
const abs = v => {
|
|
43
|
+
try {
|
|
44
|
+
return v && new URL(v, base).href;
|
|
45
|
+
}
|
|
46
|
+
catch { }
|
|
47
|
+
};
|
|
48
|
+
const m = {};
|
|
49
|
+
let title, icon;
|
|
50
|
+
for (const [, kind, attrs, t] of (await readHead(res)).matchAll(TAG)) {
|
|
51
|
+
if (t !== undefined) {
|
|
52
|
+
title ?? (title = t);
|
|
53
|
+
continue;
|
|
54
|
+
}
|
|
55
|
+
const a = {};
|
|
56
|
+
for (const x of attrs.matchAll(ATTR))
|
|
57
|
+
a[x[1].toLowerCase()] = x[2] ?? x[3] ?? x[4];
|
|
58
|
+
if (kind.toLowerCase() === 'meta') {
|
|
59
|
+
const k = (a.property ?? a.name ?? a.itemprop)?.toLowerCase();
|
|
60
|
+
if (k && a.content)
|
|
61
|
+
m[k] ?? (m[k] = a.content);
|
|
62
|
+
}
|
|
63
|
+
else if (a.href) {
|
|
64
|
+
const r = a.rel?.toLowerCase() ?? '';
|
|
65
|
+
if (/(^|\s)icon(\s|$)/.test(r))
|
|
66
|
+
icon ?? (icon = a.href);
|
|
67
|
+
else if (r === 'image_src')
|
|
68
|
+
m.image_src ?? (m.image_src = a.href);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
url: base,
|
|
73
|
+
title: txt(m['og:title'] ?? m['twitter:title'] ?? title),
|
|
74
|
+
description: txt(m['og:description'] ?? m['twitter:description'] ?? m.description),
|
|
75
|
+
favicon: abs(icon ?? '/favicon.ico'),
|
|
76
|
+
image: abs(m['og:image'] ?? m['og:image:secure_url'] ?? m['twitter:image'] ?? m['twitter:image:src'] ?? m.image ?? m.image_src),
|
|
77
|
+
video: abs(m['og:video'] ?? m['og:video:secure_url'] ?? m['og:video:url'] ?? m['twitter:player:stream'])
|
|
78
|
+
};
|
|
79
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
export const UNAUTHORIZED_CODES: number[];
|
|
2
|
+
export const BIZ_BOT_SUPPORT_PAYLOAD: "{\"version\":1,\"is_ai_message\":true,\"should_upload_client_logs\":false,\"should_show_system_message\":false,\"ticket_id\":\"7004947587700716\",\"citation_items\":[],\"ticket_locale\":\"us\"}";
|
|
3
|
+
export const DEFAULT_ORIGIN: "https://web.whatsapp.com";
|
|
4
|
+
export const CALL_VIDEO_PREFIX: "https://call.whatsapp.com/video/";
|
|
5
|
+
export const CALL_AUDIO_PREFIX: "https://call.whatsapp.com/voice/";
|
|
6
|
+
export const DONATE_URL: "https://saweria.co/itsliaaa";
|
|
7
|
+
export const LIBRARY_NAME: "itsliaaa/baileys";
|
|
8
|
+
export const TEXT_ENCODER: TextEncoder;
|
|
9
|
+
export const TEXT_DECODER: TextDecoder;
|
|
10
|
+
export const DEF_CALLBACK_PREFIX: "CB:";
|
|
11
|
+
export const DEF_TAG_PREFIX: "TAG:";
|
|
12
|
+
export const PHONE_CONNECTION_CB: "CB:Pong";
|
|
13
|
+
export const WA_ADV_ACCOUNT_SIG_PREFIX: any;
|
|
14
|
+
export const WA_ADV_DEVICE_SIG_PREFIX: any;
|
|
15
|
+
export const WA_ADV_HOSTED_ACCOUNT_SIG_PREFIX: any;
|
|
16
|
+
export const WA_ADV_HOSTED_DEVICE_SIG_PREFIX: any;
|
|
17
|
+
export const WA_DEFAULT_EPHEMERAL: number;
|
|
18
|
+
/** Status messages older than 24 hours are considered expired */
|
|
19
|
+
export const STATUS_EXPIRY_SECONDS: number;
|
|
20
|
+
/** WA Web enforces a 14-day maximum age for placeholder resend requests */
|
|
21
|
+
export const PLACEHOLDER_MAX_AGE_SECONDS: number;
|
|
22
|
+
export const NOISE_MODE: "Noise_XX_25519_AESGCM_SHA256\0\0\0\0";
|
|
23
|
+
export const DICT_VERSION: 3;
|
|
24
|
+
export const KEY_BUNDLE_TYPE: any;
|
|
25
|
+
export const NOISE_WA_HEADER: any;
|
|
26
|
+
export const LEXER_REGEX: RegExp;
|
|
27
|
+
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
|
28
|
+
export const URL_REGEX: RegExp;
|
|
29
|
+
export namespace WA_CERT_DETAILS {
|
|
30
|
+
let SERIAL: number;
|
|
31
|
+
let ISSUER: string;
|
|
32
|
+
let PUBLIC_KEY: any;
|
|
33
|
+
}
|
|
34
|
+
export const PROCESSABLE_HISTORY_TYPES: proto.HistorySync.HistorySyncType[];
|
|
35
|
+
export namespace DEFAULT_CACHE_TTLS {
|
|
36
|
+
let SIGNAL_STORE: number;
|
|
37
|
+
let MSG_RETRY: number;
|
|
38
|
+
let CALL_OFFER: number;
|
|
39
|
+
let USER_DEVICES: number;
|
|
40
|
+
}
|
|
41
|
+
export namespace DEFAULT_CONNECTION_CONFIG {
|
|
42
|
+
export { version };
|
|
43
|
+
export let browser: any[];
|
|
44
|
+
export let waWebSocketUrl: string;
|
|
45
|
+
export let connectTimeoutMs: number;
|
|
46
|
+
export let keepAliveIntervalMs: number;
|
|
47
|
+
export let logger: Readonly<{
|
|
48
|
+
level: "silent";
|
|
49
|
+
debug: () => void;
|
|
50
|
+
info: () => void;
|
|
51
|
+
warn: () => void;
|
|
52
|
+
error: () => void;
|
|
53
|
+
fatal: () => void;
|
|
54
|
+
trace: () => void;
|
|
55
|
+
child: () => Readonly</*elided*/ any>;
|
|
56
|
+
isLevelEnabled: () => false;
|
|
57
|
+
}>;
|
|
58
|
+
export let emitOwnEvents: boolean;
|
|
59
|
+
export let defaultQueryTimeoutMs: number;
|
|
60
|
+
export let customUploadHosts: never[];
|
|
61
|
+
export let retryRequestDelayMs: number;
|
|
62
|
+
export let maxMsgRetryCount: number;
|
|
63
|
+
export let fireInitQueries: boolean;
|
|
64
|
+
export let auth: undefined;
|
|
65
|
+
export let markOnlineOnConnect: boolean;
|
|
66
|
+
export let syncFullHistory: boolean;
|
|
67
|
+
export function patchMessageBeforeSending(msg: any): any;
|
|
68
|
+
export function shouldSyncHistoryMessage({ syncType }: {
|
|
69
|
+
syncType: any;
|
|
70
|
+
}): boolean;
|
|
71
|
+
export function shouldIgnoreJid(): boolean;
|
|
72
|
+
export let linkPreviewImageThumbnailWidth: number;
|
|
73
|
+
export namespace transactionOpts {
|
|
74
|
+
let maxCommitRetries: number;
|
|
75
|
+
let delayBetweenTriesMs: number;
|
|
76
|
+
}
|
|
77
|
+
export let generateHighQualityLinkPreview: boolean;
|
|
78
|
+
export let enableAutoSessionRecreation: boolean;
|
|
79
|
+
export let enableRecentMessageCache: boolean;
|
|
80
|
+
export let options: {};
|
|
81
|
+
export namespace appStateMacVerification {
|
|
82
|
+
let patch: boolean;
|
|
83
|
+
let snapshot: boolean;
|
|
84
|
+
}
|
|
85
|
+
export let countryCode: string;
|
|
86
|
+
export function getMessage(): Promise<undefined>;
|
|
87
|
+
export function cachedGroupMetadata(): Promise<undefined>;
|
|
88
|
+
export { makeLibSignalRepository as makeSignalRepository };
|
|
89
|
+
}
|
|
90
|
+
export const MEDIA_PATH_MAP: {
|
|
91
|
+
image: string;
|
|
92
|
+
video: string;
|
|
93
|
+
audio: string;
|
|
94
|
+
document: string;
|
|
95
|
+
sticker: string;
|
|
96
|
+
gif: string;
|
|
97
|
+
ptt: string;
|
|
98
|
+
ptv: string;
|
|
99
|
+
ppic: string;
|
|
100
|
+
'ads-image': string;
|
|
101
|
+
'ads-video': string;
|
|
102
|
+
'biz-cover-photo': string;
|
|
103
|
+
'group-history': string;
|
|
104
|
+
'md-app-state': string;
|
|
105
|
+
'md-msg-hist': string;
|
|
106
|
+
'music-artwork': string;
|
|
107
|
+
'product-catalog-image': string;
|
|
108
|
+
'sticker-pack': string;
|
|
109
|
+
'thumbnail-document': string;
|
|
110
|
+
'thumbnail-image': string;
|
|
111
|
+
'thumbnail-link': string;
|
|
112
|
+
'thumbnail-sticker-pack': string;
|
|
113
|
+
'thumbnail-video': string;
|
|
114
|
+
'maiba-file': string;
|
|
115
|
+
};
|
|
116
|
+
export const NEWSLETTER_MEDIA_PATH_MAP: {
|
|
117
|
+
image: string;
|
|
118
|
+
video: string;
|
|
119
|
+
audio: string;
|
|
120
|
+
document: string;
|
|
121
|
+
sticker: string;
|
|
122
|
+
gif: string;
|
|
123
|
+
ptt: string;
|
|
124
|
+
ptv: string;
|
|
125
|
+
'music-artwork': string;
|
|
126
|
+
'sticker-pack': string;
|
|
127
|
+
'thumbnail-link': string;
|
|
128
|
+
'waffle-image': string;
|
|
129
|
+
'waffle-video': string;
|
|
130
|
+
};
|
|
131
|
+
export const MEDIA_HKDF_KEY_MAPPING: {
|
|
132
|
+
audio: string;
|
|
133
|
+
document: string;
|
|
134
|
+
gif: string;
|
|
135
|
+
history: string;
|
|
136
|
+
image: string;
|
|
137
|
+
product: string;
|
|
138
|
+
ppic: string;
|
|
139
|
+
ptt: string;
|
|
140
|
+
sticker: string;
|
|
141
|
+
video: string;
|
|
142
|
+
'group-history': string;
|
|
143
|
+
'ads-image': string;
|
|
144
|
+
'ads-video': string;
|
|
145
|
+
'sticker-pack': string;
|
|
146
|
+
'thumbnail-sticker-pack': string;
|
|
147
|
+
'thumbnail-document': string;
|
|
148
|
+
'thumbnail-image': string;
|
|
149
|
+
'thumbnail-video': string;
|
|
150
|
+
'thumbnail-link': string;
|
|
151
|
+
'md-msg-hist': string;
|
|
152
|
+
'md-app-state': string;
|
|
153
|
+
'product-catalog-image': string;
|
|
154
|
+
'payment-bg-image': string;
|
|
155
|
+
ptv: string;
|
|
156
|
+
'biz-cover-photo': string;
|
|
157
|
+
'music-artwork': string;
|
|
158
|
+
'maiba-file': string;
|
|
159
|
+
location: string;
|
|
160
|
+
contact: string;
|
|
161
|
+
'voip-token': string;
|
|
162
|
+
};
|
|
163
|
+
export const MEDIA_KEYS: string[];
|
|
164
|
+
/** 120s timeout for history sync stall detection, same as WA Web's handleChunkProgress / restartPausedTimer (g = 120) */
|
|
165
|
+
export const HISTORY_SYNC_PAUSED_TIMEOUT_MS: 120000;
|
|
166
|
+
export const MIN_PREKEY_COUNT: 5;
|
|
167
|
+
export const INITIAL_PREKEY_COUNT: 812;
|
|
168
|
+
export const UPLOAD_TIMEOUT: 30000;
|
|
169
|
+
export namespace TimeMs {
|
|
170
|
+
let Minute: number;
|
|
171
|
+
let Hour: number;
|
|
172
|
+
let Day: number;
|
|
173
|
+
let Week: number;
|
|
174
|
+
}
|
|
175
|
+
export namespace WEBSOCKET_STATES {
|
|
176
|
+
let CONNECTING: number;
|
|
177
|
+
let OPEN: number;
|
|
178
|
+
let CLOSING: number;
|
|
179
|
+
let CLOSED: number;
|
|
180
|
+
}
|
|
181
|
+
import { proto } from '../../WAProto/index.js';
|
|
182
|
+
declare const version: number[];
|
|
183
|
+
import { makeLibSignalRepository } from '../Signal/libsignal.js';
|
|
184
|
+
export {};
|