@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 @@
|
|
|
1
|
+
export function encodeWAM(binaryInfo: any): any;
|
|
@@ -0,0 +1,162 @@
|
|
|
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 encode_exports = {};
|
|
19
|
+
__export(encode_exports, {
|
|
20
|
+
encodeWAM: () => encodeWAM
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(encode_exports);
|
|
23
|
+
var import_BinaryInfo = require("./BinaryInfo.js");
|
|
24
|
+
var import_constants = require("./constants.js");
|
|
25
|
+
const getHeaderBitLength = (key) => key < 256 ? 2 : 3;
|
|
26
|
+
const encodeWAM = (binaryInfo) => {
|
|
27
|
+
binaryInfo.buffer = [];
|
|
28
|
+
encodeWAMHeader(binaryInfo);
|
|
29
|
+
encodeEvents(binaryInfo);
|
|
30
|
+
const totalSize = binaryInfo.buffer.map((a) => a.length).reduce((a, b) => a + b);
|
|
31
|
+
const buffer = Buffer.alloc(totalSize);
|
|
32
|
+
let offset = 0;
|
|
33
|
+
for (const buffer_ of binaryInfo.buffer) {
|
|
34
|
+
buffer_.copy(buffer, offset);
|
|
35
|
+
offset += buffer_.length;
|
|
36
|
+
}
|
|
37
|
+
return buffer;
|
|
38
|
+
};
|
|
39
|
+
function encodeWAMHeader(binaryInfo) {
|
|
40
|
+
const headerBuffer = Buffer.alloc(8);
|
|
41
|
+
headerBuffer.write("WAM", 0, "utf8");
|
|
42
|
+
headerBuffer.writeUInt8(binaryInfo.protocolVersion, 3);
|
|
43
|
+
headerBuffer.writeUInt8(1, 4);
|
|
44
|
+
headerBuffer.writeUInt16BE(binaryInfo.sequence, 5);
|
|
45
|
+
headerBuffer.writeUInt8(0, 7);
|
|
46
|
+
binaryInfo.buffer.push(headerBuffer);
|
|
47
|
+
}
|
|
48
|
+
function encodeGlobalAttributes(binaryInfo, globals) {
|
|
49
|
+
for (const [key, _value] of Object.entries(globals)) {
|
|
50
|
+
const id = import_constants.WEB_GLOBALS.find((a) => a?.name === key).id;
|
|
51
|
+
let value = _value;
|
|
52
|
+
if (typeof value === "boolean") {
|
|
53
|
+
value = value ? 1 : 0;
|
|
54
|
+
}
|
|
55
|
+
binaryInfo.buffer.push(serializeData(id, value, import_constants.FLAG_GLOBAL));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function encodeEvents(binaryInfo) {
|
|
59
|
+
for (const [name, { props, globals }] of binaryInfo.events.map((a) => Object.entries(a)[0])) {
|
|
60
|
+
encodeGlobalAttributes(binaryInfo, globals);
|
|
61
|
+
const event = import_constants.WEB_EVENTS.find((a) => a.name === name);
|
|
62
|
+
const props_ = Object.entries(props);
|
|
63
|
+
let extended = false;
|
|
64
|
+
for (const [, value] of props_) {
|
|
65
|
+
extended || (extended = value !== null);
|
|
66
|
+
}
|
|
67
|
+
const eventFlag = extended ? import_constants.FLAG_EVENT : import_constants.FLAG_EVENT | import_constants.FLAG_EXTENDED;
|
|
68
|
+
binaryInfo.buffer.push(serializeData(event.id, -event.weight, eventFlag));
|
|
69
|
+
for (let i = 0; i < props_.length; i++) {
|
|
70
|
+
const [key, _value] = props_[i];
|
|
71
|
+
const id = event.props[key]?.[0];
|
|
72
|
+
extended = i < props_.length - 1;
|
|
73
|
+
let value = _value;
|
|
74
|
+
if (typeof value === "boolean") {
|
|
75
|
+
value = value ? 1 : 0;
|
|
76
|
+
}
|
|
77
|
+
const fieldFlag = extended ? import_constants.FLAG_EVENT : import_constants.FLAG_FIELD | import_constants.FLAG_EXTENDED;
|
|
78
|
+
binaryInfo.buffer.push(serializeData(id, value, fieldFlag));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function serializeData(key, value, flag) {
|
|
83
|
+
const bufferLength = getHeaderBitLength(key);
|
|
84
|
+
let buffer;
|
|
85
|
+
let offset = 0;
|
|
86
|
+
if (value === null) {
|
|
87
|
+
if (flag === import_constants.FLAG_GLOBAL) {
|
|
88
|
+
buffer = Buffer.alloc(bufferLength);
|
|
89
|
+
offset = serializeHeader(buffer, offset, key, flag);
|
|
90
|
+
return buffer;
|
|
91
|
+
}
|
|
92
|
+
} else if (typeof value === "number" && Number.isInteger(value)) {
|
|
93
|
+
if (value === 0 || value === 1) {
|
|
94
|
+
buffer = Buffer.alloc(bufferLength);
|
|
95
|
+
offset = serializeHeader(buffer, offset, key, flag | value + 1 << 4);
|
|
96
|
+
return buffer;
|
|
97
|
+
} else if (-128 <= value && value < 128) {
|
|
98
|
+
buffer = Buffer.alloc(bufferLength + 1);
|
|
99
|
+
offset = serializeHeader(buffer, offset, key, flag | 3 << 4);
|
|
100
|
+
buffer.writeInt8(value, offset);
|
|
101
|
+
return buffer;
|
|
102
|
+
} else if (-32768 <= value && value < 32768) {
|
|
103
|
+
buffer = Buffer.alloc(bufferLength + 2);
|
|
104
|
+
offset = serializeHeader(buffer, offset, key, flag | 4 << 4);
|
|
105
|
+
buffer.writeInt16LE(value, offset);
|
|
106
|
+
return buffer;
|
|
107
|
+
} else if (-2147483648 <= value && value < 2147483648) {
|
|
108
|
+
buffer = Buffer.alloc(bufferLength + 4);
|
|
109
|
+
offset = serializeHeader(buffer, offset, key, flag | 5 << 4);
|
|
110
|
+
buffer.writeInt32LE(value, offset);
|
|
111
|
+
return buffer;
|
|
112
|
+
} else {
|
|
113
|
+
buffer = Buffer.alloc(bufferLength + 8);
|
|
114
|
+
offset = serializeHeader(buffer, offset, key, flag | 7 << 4);
|
|
115
|
+
buffer.writeDoubleLE(value, offset);
|
|
116
|
+
return buffer;
|
|
117
|
+
}
|
|
118
|
+
} else if (typeof value === "number") {
|
|
119
|
+
buffer = Buffer.alloc(bufferLength + 8);
|
|
120
|
+
offset = serializeHeader(buffer, offset, key, flag | 7 << 4);
|
|
121
|
+
buffer.writeDoubleLE(value, offset);
|
|
122
|
+
return buffer;
|
|
123
|
+
} else if (typeof value === "string") {
|
|
124
|
+
const utf8Bytes = Buffer.byteLength(value, "utf8");
|
|
125
|
+
if (utf8Bytes < 256) {
|
|
126
|
+
buffer = Buffer.alloc(bufferLength + 1 + utf8Bytes);
|
|
127
|
+
offset = serializeHeader(buffer, offset, key, flag | 8 << 4);
|
|
128
|
+
buffer.writeUint8(utf8Bytes, offset++);
|
|
129
|
+
} else if (utf8Bytes < 65536) {
|
|
130
|
+
buffer = Buffer.alloc(bufferLength + 2 + utf8Bytes);
|
|
131
|
+
offset = serializeHeader(buffer, offset, key, flag | 9 << 4);
|
|
132
|
+
buffer.writeUInt16LE(utf8Bytes, offset);
|
|
133
|
+
offset += 2;
|
|
134
|
+
} else {
|
|
135
|
+
buffer = Buffer.alloc(bufferLength + 4 + utf8Bytes);
|
|
136
|
+
offset = serializeHeader(buffer, offset, key, flag | 10 << 4);
|
|
137
|
+
buffer.writeUInt32LE(utf8Bytes, offset);
|
|
138
|
+
offset += 4;
|
|
139
|
+
}
|
|
140
|
+
buffer.write(value, offset, "utf8");
|
|
141
|
+
return buffer;
|
|
142
|
+
}
|
|
143
|
+
throw "missing";
|
|
144
|
+
}
|
|
145
|
+
function serializeHeader(buffer, offset, key, flag) {
|
|
146
|
+
if (key < 256) {
|
|
147
|
+
buffer.writeUInt8(flag, offset);
|
|
148
|
+
offset += 1;
|
|
149
|
+
buffer.writeUInt8(key, offset);
|
|
150
|
+
offset += 1;
|
|
151
|
+
} else {
|
|
152
|
+
buffer.writeUInt8(flag | import_constants.FLAG_BYTE, offset);
|
|
153
|
+
offset += 1;
|
|
154
|
+
buffer.writeUInt16LE(key, offset);
|
|
155
|
+
offset += 2;
|
|
156
|
+
}
|
|
157
|
+
return offset;
|
|
158
|
+
}
|
|
159
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
160
|
+
0 && (module.exports = {
|
|
161
|
+
encodeWAM
|
|
162
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
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("./constants.js"), module.exports);
|
|
18
|
+
__reExport(index_exports, require("./encode.js"), module.exports);
|
|
19
|
+
__reExport(index_exports, require("./BinaryInfo.js"), module.exports);
|
|
20
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
21
|
+
0 && (module.exports = {
|
|
22
|
+
...require("./constants.js"),
|
|
23
|
+
...require("./encode.js"),
|
|
24
|
+
...require("./BinaryInfo.js")
|
|
25
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export class USyncContactProtocol {
|
|
2
|
+
name: string;
|
|
3
|
+
getQueryElement(): {
|
|
4
|
+
tag: string;
|
|
5
|
+
attrs: {};
|
|
6
|
+
};
|
|
7
|
+
getUserElement(user: any): {
|
|
8
|
+
tag: string;
|
|
9
|
+
attrs: {
|
|
10
|
+
type?: undefined;
|
|
11
|
+
};
|
|
12
|
+
content: any;
|
|
13
|
+
} | {
|
|
14
|
+
tag: string;
|
|
15
|
+
attrs: {
|
|
16
|
+
lid?: any;
|
|
17
|
+
pin?: any;
|
|
18
|
+
username: any;
|
|
19
|
+
type?: undefined;
|
|
20
|
+
};
|
|
21
|
+
content?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
tag: string;
|
|
24
|
+
attrs: {
|
|
25
|
+
type: any;
|
|
26
|
+
};
|
|
27
|
+
content?: undefined;
|
|
28
|
+
} | {
|
|
29
|
+
tag: string;
|
|
30
|
+
attrs: {
|
|
31
|
+
type?: undefined;
|
|
32
|
+
};
|
|
33
|
+
content?: undefined;
|
|
34
|
+
};
|
|
35
|
+
parser(node: any): boolean;
|
|
36
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
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 USyncContactProtocol_exports = {};
|
|
19
|
+
__export(USyncContactProtocol_exports, {
|
|
20
|
+
USyncContactProtocol: () => USyncContactProtocol
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(USyncContactProtocol_exports);
|
|
23
|
+
var import_WABinary = require("../../WABinary/index.js");
|
|
24
|
+
var import_USyncUser = require("../USyncUser.js");
|
|
25
|
+
class USyncContactProtocol {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.name = "contact";
|
|
28
|
+
}
|
|
29
|
+
getQueryElement() {
|
|
30
|
+
return {
|
|
31
|
+
tag: "contact",
|
|
32
|
+
attrs: {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
getUserElement(user) {
|
|
36
|
+
if (user.phone) {
|
|
37
|
+
return {
|
|
38
|
+
tag: "contact",
|
|
39
|
+
attrs: {},
|
|
40
|
+
content: user.phone
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (user.username) {
|
|
44
|
+
return {
|
|
45
|
+
tag: "contact",
|
|
46
|
+
attrs: {
|
|
47
|
+
username: user.username,
|
|
48
|
+
...user.usernameKey ? { pin: user.usernameKey } : {},
|
|
49
|
+
...user.lid ? { lid: user.lid } : {}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (user.type) {
|
|
54
|
+
return {
|
|
55
|
+
tag: "contact",
|
|
56
|
+
attrs: {
|
|
57
|
+
type: user.type
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
tag: "contact",
|
|
63
|
+
attrs: {}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
parser(node) {
|
|
67
|
+
if (node.tag === "contact") {
|
|
68
|
+
(0, import_WABinary.assertNodeErrorFree)(node);
|
|
69
|
+
return node?.attrs?.type === "in";
|
|
70
|
+
}
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
USyncContactProtocol
|
|
77
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export class USyncDeviceProtocol {
|
|
2
|
+
name: string;
|
|
3
|
+
getQueryElement(): {
|
|
4
|
+
tag: string;
|
|
5
|
+
attrs: {
|
|
6
|
+
version: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
getUserElement(): null;
|
|
10
|
+
parser(node: any): {
|
|
11
|
+
deviceList: {
|
|
12
|
+
id: number;
|
|
13
|
+
keyIndex: number;
|
|
14
|
+
isHosted: boolean;
|
|
15
|
+
}[];
|
|
16
|
+
keyIndex: {
|
|
17
|
+
timestamp: number;
|
|
18
|
+
signedKeyIndex: any;
|
|
19
|
+
expectedTimestamp: number | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
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 USyncDeviceProtocol_exports = {};
|
|
19
|
+
__export(USyncDeviceProtocol_exports, {
|
|
20
|
+
USyncDeviceProtocol: () => USyncDeviceProtocol
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(USyncDeviceProtocol_exports);
|
|
23
|
+
var import_WABinary = require("../../WABinary/index.js");
|
|
24
|
+
class USyncDeviceProtocol {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.name = "devices";
|
|
27
|
+
}
|
|
28
|
+
getQueryElement() {
|
|
29
|
+
return {
|
|
30
|
+
tag: "devices",
|
|
31
|
+
attrs: {
|
|
32
|
+
version: "2"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
getUserElement() {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
parser(node) {
|
|
40
|
+
const deviceList = [];
|
|
41
|
+
let keyIndex = void 0;
|
|
42
|
+
if (node.tag === "devices") {
|
|
43
|
+
(0, import_WABinary.assertNodeErrorFree)(node);
|
|
44
|
+
const deviceListNode = (0, import_WABinary.getBinaryNodeChild)(node, "device-list");
|
|
45
|
+
const keyIndexNode = (0, import_WABinary.getBinaryNodeChild)(node, "key-index-list");
|
|
46
|
+
if (Array.isArray(deviceListNode?.content)) {
|
|
47
|
+
for (const { tag, attrs } of deviceListNode.content) {
|
|
48
|
+
const id = +attrs.id;
|
|
49
|
+
const keyIndex2 = +attrs["key-index"];
|
|
50
|
+
if (tag === "device") {
|
|
51
|
+
deviceList.push({
|
|
52
|
+
id,
|
|
53
|
+
keyIndex: keyIndex2,
|
|
54
|
+
isHosted: !!(attrs["is_hosted"] && attrs["is_hosted"] === "true")
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (keyIndexNode?.tag === "key-index-list") {
|
|
60
|
+
keyIndex = {
|
|
61
|
+
timestamp: +keyIndexNode.attrs["ts"],
|
|
62
|
+
signedKeyIndex: keyIndexNode?.content,
|
|
63
|
+
expectedTimestamp: keyIndexNode.attrs["expected_ts"] ? +keyIndexNode.attrs["expected_ts"] : void 0
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
deviceList,
|
|
69
|
+
keyIndex
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
74
|
+
0 && (module.exports = {
|
|
75
|
+
USyncDeviceProtocol
|
|
76
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
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 USyncDisappearingModeProtocol_exports = {};
|
|
19
|
+
__export(USyncDisappearingModeProtocol_exports, {
|
|
20
|
+
USyncDisappearingModeProtocol: () => USyncDisappearingModeProtocol
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(USyncDisappearingModeProtocol_exports);
|
|
23
|
+
var import_WABinary = require("../../WABinary/index.js");
|
|
24
|
+
class USyncDisappearingModeProtocol {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.name = "disappearing_mode";
|
|
27
|
+
}
|
|
28
|
+
getQueryElement() {
|
|
29
|
+
return {
|
|
30
|
+
tag: "disappearing_mode",
|
|
31
|
+
attrs: {}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
getUserElement() {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
parser(node) {
|
|
38
|
+
if (node.tag === "disappearing_mode") {
|
|
39
|
+
(0, import_WABinary.assertNodeErrorFree)(node);
|
|
40
|
+
const duration = +node?.attrs.duration;
|
|
41
|
+
const setAt = new Date(+(node?.attrs.t || 0) * 1e3);
|
|
42
|
+
return {
|
|
43
|
+
duration,
|
|
44
|
+
setAt
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {
|
|
51
|
+
USyncDisappearingModeProtocol
|
|
52
|
+
});
|
|
@@ -0,0 +1,61 @@
|
|
|
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 USyncStatusProtocol_exports = {};
|
|
19
|
+
__export(USyncStatusProtocol_exports, {
|
|
20
|
+
USyncStatusProtocol: () => USyncStatusProtocol
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(USyncStatusProtocol_exports);
|
|
23
|
+
var import_WABinary = require("../../WABinary/index.js");
|
|
24
|
+
class USyncStatusProtocol {
|
|
25
|
+
constructor() {
|
|
26
|
+
this.name = "status";
|
|
27
|
+
}
|
|
28
|
+
getQueryElement() {
|
|
29
|
+
return {
|
|
30
|
+
tag: "status",
|
|
31
|
+
attrs: {}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
getUserElement() {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
parser(node) {
|
|
38
|
+
if (node.tag === "status") {
|
|
39
|
+
(0, import_WABinary.assertNodeErrorFree)(node);
|
|
40
|
+
let status = node?.content?.toString() ?? null;
|
|
41
|
+
const setAt = new Date(+(node?.attrs.t || 0) * 1e3);
|
|
42
|
+
if (!status) {
|
|
43
|
+
if (node.attrs?.code && +node.attrs.code === 401) {
|
|
44
|
+
status = "";
|
|
45
|
+
} else {
|
|
46
|
+
status = null;
|
|
47
|
+
}
|
|
48
|
+
} else if (typeof status === "string" && status.length === 0) {
|
|
49
|
+
status = null;
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
status,
|
|
53
|
+
setAt
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
59
|
+
0 && (module.exports = {
|
|
60
|
+
USyncStatusProtocol
|
|
61
|
+
});
|
|
@@ -0,0 +1,50 @@
|
|
|
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 USyncUsernameProtocol_exports = {};
|
|
19
|
+
__export(USyncUsernameProtocol_exports, {
|
|
20
|
+
USyncUsernameProtocol: () => USyncUsernameProtocol
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(USyncUsernameProtocol_exports);
|
|
23
|
+
var import_WABinary = require("../../WABinary/index.js");
|
|
24
|
+
var import_USyncUser = require("../USyncUser.js");
|
|
25
|
+
class USyncUsernameProtocol {
|
|
26
|
+
constructor() {
|
|
27
|
+
this.name = "username";
|
|
28
|
+
}
|
|
29
|
+
getQueryElement() {
|
|
30
|
+
return {
|
|
31
|
+
tag: "username",
|
|
32
|
+
attrs: {}
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
getUserElement(user) {
|
|
36
|
+
void user;
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
parser(node) {
|
|
40
|
+
if (node.tag === "username") {
|
|
41
|
+
(0, import_WABinary.assertNodeErrorFree)(node);
|
|
42
|
+
return typeof node.content === "string" ? node.content : null;
|
|
43
|
+
}
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
+
0 && (module.exports = {
|
|
49
|
+
USyncUsernameProtocol
|
|
50
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export class USyncBotProfileProtocol {
|
|
2
|
+
name: string;
|
|
3
|
+
getQueryElement(): {
|
|
4
|
+
tag: string;
|
|
5
|
+
attrs: {};
|
|
6
|
+
content: {
|
|
7
|
+
tag: string;
|
|
8
|
+
attrs: {
|
|
9
|
+
v: string;
|
|
10
|
+
};
|
|
11
|
+
}[];
|
|
12
|
+
};
|
|
13
|
+
getUserElement(user: any): {
|
|
14
|
+
tag: string;
|
|
15
|
+
attrs: {};
|
|
16
|
+
content: {
|
|
17
|
+
tag: string;
|
|
18
|
+
attrs: {
|
|
19
|
+
persona_id: any;
|
|
20
|
+
};
|
|
21
|
+
}[];
|
|
22
|
+
};
|
|
23
|
+
parser(node: any): {
|
|
24
|
+
isDefault: boolean;
|
|
25
|
+
jid: any;
|
|
26
|
+
name: any;
|
|
27
|
+
attributes: any;
|
|
28
|
+
description: any;
|
|
29
|
+
category: any;
|
|
30
|
+
personaId: any;
|
|
31
|
+
commandsDescription: any;
|
|
32
|
+
commands: {
|
|
33
|
+
name: any;
|
|
34
|
+
description: any;
|
|
35
|
+
}[];
|
|
36
|
+
prompts: string[];
|
|
37
|
+
};
|
|
38
|
+
}
|