@neelegirl/baileys 1.5.2 → 1.5.4
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/README.md +26 -18
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +291 -665
- package/WAProto/fix-imports.js +29 -0
- package/WAProto/index.d.ts +2297 -48040
- package/WAProto/index.js +45500 -140101
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +58 -64
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +74 -96
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
- package/lib/Signal/Group/ciphertext-message.js +12 -0
- package/lib/Signal/Group/ciphertext-message.js.map +1 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
- package/lib/Signal/Group/group-session-builder.js +30 -0
- package/lib/Signal/Group/group-session-builder.js.map +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
- package/lib/Signal/Group/group_cipher.js +82 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.d.ts.map +1 -0
- package/lib/Signal/Group/index.js +12 -0
- package/lib/Signal/Group/index.js.map +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
- package/lib/Signal/Group/keyhelper.js +18 -0
- package/lib/Signal/Group/keyhelper.js.map +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-chain-key.js +26 -0
- package/lib/Signal/Group/sender-chain-key.js.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-message.js +66 -0
- package/lib/Signal/Group/sender-key-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-name.js +48 -0
- package/lib/Signal/Group/sender-key-name.js.map +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-record.js +41 -0
- package/lib/Signal/Group/sender-key-record.js.map +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-state.js +84 -0
- package/lib/Signal/Group/sender-key-state.js.map +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
- package/lib/Signal/{WASignalGroup/sender_message_key.js → Group/sender-message-key.js} +3 -16
- package/lib/Signal/Group/sender-message-key.js.map +1 -0
- package/lib/Signal/libsignal.d.ts +5 -4
- package/lib/Signal/libsignal.d.ts.map +1 -0
- package/lib/Signal/libsignal.js +292 -112
- package/lib/Signal/libsignal.js.map +1 -0
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -0
- package/lib/Signal/lid-mapping.js +171 -0
- package/lib/Signal/lid-mapping.js.map +1 -0
- package/lib/Socket/Client/index.d.ts +3 -2
- package/lib/Socket/Client/index.d.ts.map +1 -0
- package/lib/Socket/Client/index.js +3 -22
- package/lib/Socket/Client/index.js.map +1 -0
- package/lib/Socket/Client/types.d.ts +15 -15
- package/lib/Socket/Client/types.d.ts.map +1 -0
- package/lib/Socket/Client/types.js +8 -15
- package/lib/Socket/Client/types.js.map +1 -0
- package/lib/Socket/Client/websocket.d.ts +12 -12
- package/lib/Socket/Client/websocket.d.ts.map +1 -0
- package/lib/Socket/Client/websocket.js +24 -36
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +178 -177
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +179 -71
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +93 -93
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +474 -625
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +83 -62
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +412 -414
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/groups.d.ts +118 -112
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +146 -171
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +222 -182
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +12 -17
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/messages-recv.d.ts +165 -169
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +1185 -1721
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +161 -159
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +650 -991
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.d.ts.map +1 -0
- package/lib/Socket/mex.js +4 -9
- package/lib/Socket/mex.js.map +1 -0
- package/lib/Socket/newsletter.d.ts +139 -139
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +153 -258
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +42 -36
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +623 -507
- package/lib/Socket/socket.js.map +1 -0
- package/lib/Types/Auth.d.ts +87 -96
- package/lib/Types/Auth.d.ts.map +1 -0
- package/lib/Types/Auth.js +2 -3
- package/lib/Types/Auth.js.map +1 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.d.ts.map +1 -0
- package/lib/Types/Bussines.js +2 -0
- package/lib/Types/Bussines.js.map +1 -0
- package/lib/Types/Call.d.ts +13 -13
- package/lib/Types/Call.d.ts.map +1 -0
- package/lib/Types/Call.js +2 -3
- package/lib/Types/Call.js.map +1 -0
- package/lib/Types/Chat.d.ts +79 -94
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +8 -9
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Contact.d.ts +13 -9
- package/lib/Types/Contact.d.ts.map +1 -0
- package/lib/Types/Contact.js +2 -3
- package/lib/Types/Contact.js.map +1 -0
- package/lib/Types/Events.d.ts +152 -179
- package/lib/Types/Events.d.ts.map +1 -0
- package/lib/Types/Events.js +2 -3
- package/lib/Types/Events.js.map +1 -0
- package/lib/Types/GroupMetadata.d.ts +49 -48
- package/lib/Types/GroupMetadata.d.ts.map +1 -0
- package/lib/Types/GroupMetadata.js +2 -3
- package/lib/Types/GroupMetadata.js.map +1 -0
- package/lib/Types/Label.d.ts +13 -14
- package/lib/Types/Label.d.ts.map +1 -0
- package/lib/Types/Label.js +24 -30
- package/lib/Types/Label.js.map +1 -0
- package/lib/Types/LabelAssociation.d.ts +15 -20
- package/lib/Types/LabelAssociation.d.ts.map +1 -0
- package/lib/Types/LabelAssociation.js +6 -12
- package/lib/Types/LabelAssociation.js.map +1 -0
- package/lib/Types/Message.d.ts +234 -404
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +11 -13
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Newsletter.d.ts +130 -104
- package/lib/Types/Newsletter.d.ts.map +1 -0
- package/lib/Types/Newsletter.js +31 -40
- package/lib/Types/Newsletter.js.map +1 -0
- package/lib/Types/Product.d.ts +58 -71
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +2 -3
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/Signal.d.ts +63 -55
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +2 -3
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +78 -65
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +3 -3
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +17 -19
- package/lib/Types/State.d.ts.map +1 -0
- package/lib/Types/State.js +13 -14
- package/lib/Types/State.js.map +1 -0
- package/lib/Types/USync.d.ts +8 -8
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +2 -3
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +47 -61
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +26 -48
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +8 -10
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +206 -154
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/baileys-event-stream.d.ts +6 -7
- package/lib/Utils/baileys-event-stream.d.ts.map +1 -0
- package/lib/Utils/baileys-event-stream.js +29 -43
- package/lib/Utils/baileys-event-stream.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/browser-utils.js.map +1 -0
- package/lib/Utils/business.d.ts +14 -20
- package/lib/Utils/business.d.ts.map +1 -0
- package/lib/Utils/business.js +110 -134
- package/lib/Utils/business.js.map +1 -0
- package/lib/Utils/chat-utils.d.ts +57 -69
- package/lib/Utils/chat-utils.d.ts.map +1 -0
- package/lib/Utils/chat-utils.js +362 -380
- package/lib/Utils/chat-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +30 -45
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +141 -178
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/decode-wa-message.d.ts +42 -35
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +176 -150
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +12 -17
- package/lib/Utils/event-buffer.d.ts.map +1 -0
- package/lib/Utils/event-buffer.js +269 -286
- package/lib/Utils/event-buffer.js.map +1 -0
- package/lib/Utils/generics.d.ts +60 -99
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +244 -487
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +18 -22
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +54 -80
- package/lib/Utils/history.js.map +1 -0
- package/lib/Utils/index.d.ts +20 -19
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +19 -39
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +12 -14
- package/lib/Utils/link-preview.d.ts.map +1 -0
- package/lib/Utils/link-preview.js +40 -75
- package/lib/Utils/link-preview.js.map +1 -0
- package/lib/Utils/logger.d.ts +10 -11
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +3 -7
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/lt-hash.d.ts +12 -13
- package/lib/Utils/lt-hash.d.ts.map +1 -0
- package/lib/Utils/lt-hash.js +27 -37
- package/lib/Utils/lt-hash.js.map +1 -0
- package/lib/Utils/make-mutex.d.ts +6 -7
- package/lib/Utils/make-mutex.d.ts.map +1 -0
- package/lib/Utils/make-mutex.js +20 -29
- package/lib/Utils/make-mutex.js.map +1 -0
- package/lib/Utils/message-retry-manager.d.ts +82 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +149 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +87 -102
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +427 -570
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +37 -64
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +511 -1270
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +18 -18
- package/lib/Utils/noise-handler.d.ts.map +1 -0
- package/lib/Utils/noise-handler.js +101 -109
- package/lib/Utils/noise-handler.js.map +1 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +106 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-message.d.ts +25 -32
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +266 -281
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/signal.d.ts +24 -32
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +98 -105
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +5 -10
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +69 -186
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +11 -13
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +124 -116
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +25 -27
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +1277 -1292
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +7 -9
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +139 -189
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +105 -154
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/generic-utils.d.ts +14 -27
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +62 -102
- package/lib/WABinary/generic-utils.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -5
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +6 -25
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +41 -46
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +84 -80
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +10 -13
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +2 -3
- package/lib/WABinary/types.js.map +1 -0
- package/lib/WAM/BinaryInfo.d.ts +8 -15
- package/lib/WAM/BinaryInfo.d.ts.map +1 -0
- package/lib/WAM/BinaryInfo.js +7 -14
- package/lib/WAM/BinaryInfo.js.map +1 -0
- package/lib/WAM/constants.d.ts +30 -37
- package/lib/WAM/constants.d.ts.map +1 -0
- package/lib/WAM/constants.js +19193 -11711
- package/lib/WAM/constants.js.map +1 -0
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.d.ts.map +1 -0
- package/lib/WAM/encode.js +95 -110
- package/lib/WAM/encode.js.map +1 -0
- package/lib/WAM/index.d.ts +4 -3
- package/lib/WAM/index.d.ts.map +1 -0
- package/lib/WAM/index.js +4 -23
- package/lib/WAM/index.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +9 -9
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +12 -19
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +19 -22
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +18 -26
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +11 -12
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -20
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +11 -12
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +16 -24
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -6
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +5 -26
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +26 -28
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +64 -62
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +11 -10
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +12 -19
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -3
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +4 -23
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +10 -11
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -33
- package/lib/index.js.map +1 -0
- package/package.json +48 -43
- package/lib/Defaults/baileys-version.json +0 -3
- package/lib/Defaults/phonenumber-mcc.json +0 -223
- package/lib/Signal/WASignalGroup/GroupProtocol.js +0 -1909
- package/lib/Signal/WASignalGroup/ciphertext_message.js +0 -16
- package/lib/Signal/WASignalGroup/generate-proto.sh +0 -1
- package/lib/Signal/WASignalGroup/group.proto +0 -42
- package/lib/Signal/WASignalGroup/group_cipher.js +0 -120
- package/lib/Signal/WASignalGroup/group_session_builder.js +0 -46
- package/lib/Signal/WASignalGroup/index.js +0 -6
- package/lib/Signal/WASignalGroup/keyhelper.js +0 -21
- package/lib/Signal/WASignalGroup/protobufs.js +0 -3
- package/lib/Signal/WASignalGroup/queue_job.js +0 -69
- package/lib/Signal/WASignalGroup/readme.md +0 -6
- package/lib/Signal/WASignalGroup/sender_chain_key.js +0 -50
- package/lib/Signal/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/lib/Signal/WASignalGroup/sender_key_message.js +0 -92
- package/lib/Signal/WASignalGroup/sender_key_name.js +0 -70
- package/lib/Signal/WASignalGroup/sender_key_record.js +0 -56
- package/lib/Signal/WASignalGroup/sender_key_state.js +0 -129
- package/lib/Socket/Client/abstract-socket-client.d.ts +0 -15
- package/lib/Socket/Client/abstract-socket-client.js +0 -13
- package/lib/Socket/Client/mobile-socket-client.d.ts +0 -12
- package/lib/Socket/Client/mobile-socket-client.js +0 -65
- package/lib/Socket/registration.d.ts +0 -266
- package/lib/Socket/registration.js +0 -166
- package/lib/Socket/usync.d.ts +0 -37
- package/lib/Socket/usync.js +0 -83
- package/lib/Store/index.d.ts +0 -4
- package/lib/Store/index.js +0 -24
- package/lib/Store/make-cache-manager-store.d.ts +0 -14
- package/lib/Store/make-cache-manager-store.js +0 -90
- package/lib/Store/make-in-memory-store.d.ts +0 -123
- package/lib/Store/make-in-memory-store.js +0 -429
- package/lib/Store/make-ordered-dictionary.d.ts +0 -12
- package/lib/Store/make-ordered-dictionary.js +0 -86
- package/lib/Store/object-repository.d.ts +0 -10
- package/lib/Store/object-repository.js +0 -31
- package/lib/Types/MexUpdates.d.ts +0 -9
- package/lib/Types/MexUpdates.js +0 -18
- package/lib/Utils/use-mongo-file-auth-state.d.ts +0 -6
- package/lib/Utils/use-mongo-file-auth-state.js +0 -84
- package/lib/Utils/use-single-file-auth-state.d.ts +0 -13
- package/lib/Utils/use-single-file-auth-state.js +0 -80
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.d.ts +0 -28
- package/lib/WAUSync/Protocols/USyncBotProfileProtocol.js +0 -69
- package/lib/WAUSync/Protocols/USyncLIDProtocol.d.ts +0 -9
- package/lib/WAUSync/Protocols/USyncLIDProtocol.js +0 -30
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
const SenderChainKey = require('./sender_chain_key');
|
|
2
|
-
const SenderMessageKey = require('./sender_message_key');
|
|
3
|
-
|
|
4
|
-
const protobufs = require('./protobufs');
|
|
5
|
-
|
|
6
|
-
class SenderKeyState {
|
|
7
|
-
MAX_MESSAGE_KEYS = 2000;
|
|
8
|
-
|
|
9
|
-
constructor(
|
|
10
|
-
id = null,
|
|
11
|
-
iteration = null,
|
|
12
|
-
chainKey = null,
|
|
13
|
-
signatureKeyPair = null,
|
|
14
|
-
signatureKeyPublic = null,
|
|
15
|
-
signatureKeyPrivate = null,
|
|
16
|
-
senderKeyStateStructure = null
|
|
17
|
-
) {
|
|
18
|
-
if (senderKeyStateStructure) {
|
|
19
|
-
this.senderKeyStateStructure = senderKeyStateStructure;
|
|
20
|
-
} else {
|
|
21
|
-
if (signatureKeyPair) {
|
|
22
|
-
signatureKeyPublic = signatureKeyPair.public;
|
|
23
|
-
signatureKeyPrivate = signatureKeyPair.private;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
chainKey = typeof chainKey === 'string' ? Buffer.from(chainKey, 'base64') : chainKey;
|
|
27
|
-
this.senderKeyStateStructure = protobufs.SenderKeyStateStructure.create();
|
|
28
|
-
const senderChainKeyStructure = protobufs.SenderChainKey.create();
|
|
29
|
-
senderChainKeyStructure.iteration = iteration;
|
|
30
|
-
senderChainKeyStructure.seed = chainKey;
|
|
31
|
-
this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure;
|
|
32
|
-
|
|
33
|
-
const signingKeyStructure = protobufs.SenderSigningKey.create();
|
|
34
|
-
signingKeyStructure.public =
|
|
35
|
-
typeof signatureKeyPublic === 'string' ?
|
|
36
|
-
Buffer.from(signatureKeyPublic, 'base64') :
|
|
37
|
-
signatureKeyPublic;
|
|
38
|
-
if (signatureKeyPrivate) {
|
|
39
|
-
signingKeyStructure.private =
|
|
40
|
-
typeof signatureKeyPrivate === 'string' ?
|
|
41
|
-
Buffer.from(signatureKeyPrivate, 'base64') :
|
|
42
|
-
signatureKeyPrivate;
|
|
43
|
-
}
|
|
44
|
-
this.senderKeyStateStructure.senderKeyId = id;
|
|
45
|
-
this.senderChainKey = senderChainKeyStructure;
|
|
46
|
-
this.senderKeyStateStructure.senderSigningKey = signingKeyStructure;
|
|
47
|
-
}
|
|
48
|
-
this.senderKeyStateStructure.senderMessageKeys =
|
|
49
|
-
this.senderKeyStateStructure.senderMessageKeys || [];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
SenderKeyState(senderKeyStateStructure) {
|
|
53
|
-
this.senderKeyStateStructure = senderKeyStateStructure;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
getKeyId() {
|
|
57
|
-
return this.senderKeyStateStructure.senderKeyId;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getSenderChainKey() {
|
|
61
|
-
return new SenderChainKey(
|
|
62
|
-
this.senderKeyStateStructure.senderChainKey.iteration,
|
|
63
|
-
this.senderKeyStateStructure.senderChainKey.seed
|
|
64
|
-
);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
setSenderChainKey(chainKey) {
|
|
68
|
-
const senderChainKeyStructure = protobufs.SenderChainKey.create({
|
|
69
|
-
iteration: chainKey.getIteration(),
|
|
70
|
-
seed: chainKey.getSeed(),
|
|
71
|
-
});
|
|
72
|
-
this.senderKeyStateStructure.senderChainKey = senderChainKeyStructure;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
getSigningKeyPublic() {
|
|
76
|
-
return typeof this.senderKeyStateStructure.senderSigningKey.public === 'string' ?
|
|
77
|
-
Buffer.from(this.senderKeyStateStructure.senderSigningKey.public, 'base64') :
|
|
78
|
-
this.senderKeyStateStructure.senderSigningKey.public;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
getSigningKeyPrivate() {
|
|
82
|
-
return typeof this.senderKeyStateStructure.senderSigningKey.private === 'string' ?
|
|
83
|
-
Buffer.from(this.senderKeyStateStructure.senderSigningKey.private, 'base64') :
|
|
84
|
-
this.senderKeyStateStructure.senderSigningKey.private;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
hasSenderMessageKey(iteration) {
|
|
88
|
-
const list = this.senderKeyStateStructure.senderMessageKeys;
|
|
89
|
-
for (let o = 0; o < list.length; o++) {
|
|
90
|
-
const senderMessageKey = list[o];
|
|
91
|
-
if (senderMessageKey.iteration === iteration) return true;
|
|
92
|
-
}
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
addSenderMessageKey(senderMessageKey) {
|
|
97
|
-
const senderMessageKeyStructure = protobufs.SenderKeyStateStructure.create({
|
|
98
|
-
iteration: senderMessageKey.getIteration(),
|
|
99
|
-
seed: senderMessageKey.getSeed(),
|
|
100
|
-
});
|
|
101
|
-
this.senderKeyStateStructure.senderMessageKeys.push(senderMessageKeyStructure);
|
|
102
|
-
|
|
103
|
-
if (this.senderKeyStateStructure.senderMessageKeys.length > this.MAX_MESSAGE_KEYS) {
|
|
104
|
-
this.senderKeyStateStructure.senderMessageKeys.shift();
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
removeSenderMessageKey(iteration) {
|
|
109
|
-
let result = null;
|
|
110
|
-
|
|
111
|
-
this.senderKeyStateStructure.senderMessageKeys = this.senderKeyStateStructure.senderMessageKeys.filter(
|
|
112
|
-
senderMessageKey => {
|
|
113
|
-
if (senderMessageKey.iteration === iteration) result = senderMessageKey;
|
|
114
|
-
return senderMessageKey.iteration !== iteration;
|
|
115
|
-
}
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
if (result != null) {
|
|
119
|
-
return new SenderMessageKey(result.iteration, result.seed);
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
getStructure() {
|
|
125
|
-
return this.senderKeyStateStructure;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
module.exports = SenderKeyState;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from 'events';
|
|
2
|
-
import { URL } from 'url';
|
|
3
|
-
import { SocketConfig } from '../../Types';
|
|
4
|
-
export declare abstract class AbstractSocketClient extends EventEmitter {
|
|
5
|
-
url: URL;
|
|
6
|
-
config: SocketConfig;
|
|
7
|
-
abstract get isOpen(): boolean;
|
|
8
|
-
abstract get isClosed(): boolean;
|
|
9
|
-
abstract get isClosing(): boolean;
|
|
10
|
-
abstract get isConnecting(): boolean;
|
|
11
|
-
constructor(url: URL, config: SocketConfig);
|
|
12
|
-
abstract connect(): Promise<void>;
|
|
13
|
-
abstract close(): Promise<void>;
|
|
14
|
-
abstract send(str: Uint8Array | string, cb?: (err?: Error) => void): boolean;
|
|
15
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AbstractSocketClient = void 0;
|
|
4
|
-
const events_1 = require("events");
|
|
5
|
-
class AbstractSocketClient extends events_1.EventEmitter {
|
|
6
|
-
constructor(url, config) {
|
|
7
|
-
super();
|
|
8
|
-
this.url = url;
|
|
9
|
-
this.config = config;
|
|
10
|
-
this.setMaxListeners(0);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
exports.AbstractSocketClient = AbstractSocketClient;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Socket } from 'net';
|
|
2
|
-
import { AbstractSocketClient } from './abstract-socket-client';
|
|
3
|
-
export declare class MobileSocketClient extends AbstractSocketClient {
|
|
4
|
-
protected socket: Socket | null;
|
|
5
|
-
get isOpen(): boolean;
|
|
6
|
-
get isClosed(): boolean;
|
|
7
|
-
get isClosing(): boolean;
|
|
8
|
-
get isConnecting(): boolean;
|
|
9
|
-
connect(): Promise<void>;
|
|
10
|
-
close(): Promise<void>;
|
|
11
|
-
send(str: string | Uint8Array, cb?: (err?: Error) => void): boolean;
|
|
12
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MobileSocketClient = void 0;
|
|
4
|
-
const net_1 = require("net");
|
|
5
|
-
const abstract_socket_client_1 = require("./abstract-socket-client");
|
|
6
|
-
class MobileSocketClient extends abstract_socket_client_1.AbstractSocketClient {
|
|
7
|
-
constructor() {
|
|
8
|
-
super(...arguments);
|
|
9
|
-
this.socket = null;
|
|
10
|
-
}
|
|
11
|
-
get isOpen() {
|
|
12
|
-
var _a;
|
|
13
|
-
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'open';
|
|
14
|
-
}
|
|
15
|
-
get isClosed() {
|
|
16
|
-
var _a;
|
|
17
|
-
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
18
|
-
}
|
|
19
|
-
get isClosing() {
|
|
20
|
-
var _a;
|
|
21
|
-
return this.socket === null || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'closed';
|
|
22
|
-
}
|
|
23
|
-
get isConnecting() {
|
|
24
|
-
var _a;
|
|
25
|
-
return ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.readyState) === 'opening';
|
|
26
|
-
}
|
|
27
|
-
async connect() {
|
|
28
|
-
var _a;
|
|
29
|
-
if (this.socket) {
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
if (this.config.agent) {
|
|
33
|
-
throw new Error('There are not support for proxy agent for mobile connection');
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
this.socket = (0, net_1.connect)({
|
|
37
|
-
host: this.url.hostname,
|
|
38
|
-
port: Number(this.url.port) || 443
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
this.socket.setMaxListeners(0);
|
|
42
|
-
const events = ['close', 'connect', 'data', 'drain', 'end', 'error', 'lookup', 'ready', 'timeout'];
|
|
43
|
-
for (const event of events) {
|
|
44
|
-
(_a = this.socket) === null || _a === void 0 ? void 0 : _a.on(event, (...args) => this.emit(event, ...args));
|
|
45
|
-
}
|
|
46
|
-
this.socket.on('data', (...args) => this.emit('message', ...args));
|
|
47
|
-
this.socket.on('ready', (...args) => this.emit('open', ...args));
|
|
48
|
-
}
|
|
49
|
-
async close() {
|
|
50
|
-
if (!this.socket) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
return new Promise(resolve => {
|
|
54
|
-
this.socket.end(resolve);
|
|
55
|
-
this.socket = null;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
send(str, cb) {
|
|
59
|
-
if (this.socket === null) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
return this.socket.write(str, undefined, cb);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
exports.MobileSocketClient = MobileSocketClient;
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { AxiosRequestConfig } from 'axios';
|
|
2
|
-
import { KeyPair, SignedKeyPair, SocketConfig } from '../Types';
|
|
3
|
-
export declare const makeRegistrationSocket: (config: SocketConfig) => {
|
|
4
|
-
register: (code: string) => Promise<ExistsResponse>;
|
|
5
|
-
requestRegistrationCode: (registrationOptions?: RegistrationOptions) => Promise<ExistsResponse>;
|
|
6
|
-
logger: import("../Utils/logger").ILogger;
|
|
7
|
-
getOrderDetails: (orderId: string, tokenBase64: string) => Promise<import("../Types").OrderDetails>;
|
|
8
|
-
getCatalog: ({ jid, limit, cursor }: import("../Types").GetCatalogOptions) => Promise<{
|
|
9
|
-
products: import("../Types").Product[];
|
|
10
|
-
nextPageCursor: string | undefined;
|
|
11
|
-
}>;
|
|
12
|
-
getCollections: (jid?: string, limit?: number) => Promise<{
|
|
13
|
-
collections: import("../Types").CatalogCollection[];
|
|
14
|
-
}>;
|
|
15
|
-
productCreate: (create: import("../Types").ProductCreate) => Promise<import("../Types").Product>;
|
|
16
|
-
productDelete: (productIds: string[]) => Promise<{
|
|
17
|
-
deleted: number;
|
|
18
|
-
}>;
|
|
19
|
-
productUpdate: (productId: string, update: import("../Types").ProductUpdate) => Promise<import("../Types").Product>;
|
|
20
|
-
sendMessageAck: ({ tag, attrs, content }: import("../WABinary").BinaryNode, errorCode?: number) => Promise<void>;
|
|
21
|
-
sendRetryRequest: (node: import("../WABinary").BinaryNode, forceIncludeKeys?: boolean) => Promise<void>;
|
|
22
|
-
rejectCall: (callId: string, callFrom: string) => Promise<void>;
|
|
23
|
-
offerCall: (toJid: string, isVideo?: boolean) => Promise<{
|
|
24
|
-
callId: string;
|
|
25
|
-
toJid: string;
|
|
26
|
-
isVideo: boolean;
|
|
27
|
-
}>;
|
|
28
|
-
fetchMessageHistory: (count: number, oldestMsgKey: import("../Types").WAMessageKey, oldestMsgTimestamp: number | Long) => Promise<string>;
|
|
29
|
-
requestPlaceholderResend: (messageKey: import("../Types").WAMessageKey) => Promise<"RESOLVED" | string | undefined>;
|
|
30
|
-
getPrivacyTokens: (jids: string[]) => Promise<any>;
|
|
31
|
-
assertSessions: (jids: string[], force: boolean) => Promise<boolean>;
|
|
32
|
-
relayMessage: (jid: string, message: import("../Types").WAProto.IMessage, { messageId: msgId, participant, additionalAttributes, additionalNodes, useUserDevicesCache, useCachedGroupMetadata, statusJidList }: import("../Types").MessageRelayOptions) => Promise<string>;
|
|
33
|
-
sendReceipt: (jid: string, participant: string | undefined, messageIds: string[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
34
|
-
sendReceipts: (keys: import("../Types").WAMessageKey[], type: import("../Types").MessageReceiptType) => Promise<void>;
|
|
35
|
-
readMessages: (keys: import("../Types").WAMessageKey[]) => Promise<void>;
|
|
36
|
-
refreshMediaConn: (forceGet?: boolean) => Promise<import("../Types").MediaConnInfo>;
|
|
37
|
-
waUploadToServer: import("../Types").WAMediaUploadFunction;
|
|
38
|
-
fetchPrivacySettings: (force?: boolean) => Promise<{
|
|
39
|
-
[_: string]: string;
|
|
40
|
-
}>;
|
|
41
|
-
getUSyncDevices: (jids: string[], useCache: boolean, ignoreZeroDevices: boolean) => Promise<import("../WABinary").JidWithDevice[]>;
|
|
42
|
-
createParticipantNodes: (jids: string[], message: import("../Types").WAProto.IMessage, extraAttrs?: import("../WABinary").BinaryNode["attrs"]) => Promise<{
|
|
43
|
-
nodes: import("../WABinary").BinaryNode[];
|
|
44
|
-
shouldIncludeDeviceIdentity: boolean;
|
|
45
|
-
}>;
|
|
46
|
-
sendPeerDataOperationMessage: (pdoMessage: import("../Types").WAProto.Message.IPeerDataOperationRequestMessage) => Promise<string>;
|
|
47
|
-
updateMediaMessage: (message: import("../Types").WAProto.IWebMessageInfo) => Promise<import("../Types").WAProto.IWebMessageInfo>;
|
|
48
|
-
sendMessage: (jid: string, content: import("../Types").AnyMessageContent, options?: import("../Types").MiscMessageGenerationOptions) => Promise<import("../Types").WAProto.WebMessageInfo | undefined>;
|
|
49
|
-
subscribeNewsletterUpdates: (jid: string) => Promise<{
|
|
50
|
-
duration: string;
|
|
51
|
-
}>;
|
|
52
|
-
newsletterReactionMode: (jid: string, mode: import("../Types").NewsletterReactionMode) => Promise<void>;
|
|
53
|
-
newsletterUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
54
|
-
newsletterUpdateName: (jid: string, name: string) => Promise<void>;
|
|
55
|
-
newsletterUpdatePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
56
|
-
newsletterRemovePicture: (jid: string) => Promise<void>;
|
|
57
|
-
newsletterUnfollow: (jid: string) => Promise<void>;
|
|
58
|
-
newsletterFollow: (jid: string) => Promise<void>;
|
|
59
|
-
newsletterUnmute: (jid: string) => Promise<void>;
|
|
60
|
-
newsletterMute: (jid: string) => Promise<void>;
|
|
61
|
-
newsletterCreate: (name: string, description?: string, picture?: import("../Types").WAMediaUpload) => Promise<import("../Types").NewsletterMetadata>;
|
|
62
|
-
newsletterMetadata: (type: "invite" | "jid", key: string, role?: import("../Types").NewsletterViewRole) => Promise<import("../Types").NewsletterMetadata>;
|
|
63
|
-
newsletterAdminCount: (jid: string) => Promise<number>;
|
|
64
|
-
newsletterChangeOwner: (jid: string, user: string) => Promise<void>;
|
|
65
|
-
newsletterDemote: (jid: string, user: string) => Promise<void>;
|
|
66
|
-
newsletterDelete: (jid: string) => Promise<void>;
|
|
67
|
-
newsletterReactMessage: (jid: string, server_id: string, code?: string) => Promise<void>;
|
|
68
|
-
newsletterFetchMessages: (type: "invite" | "jid", key: string, count: number, after?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
69
|
-
newsletterFetchUpdates: (jid: string, count: number, after?: number, since?: number) => Promise<import("../Types").NewsletterFetchedUpdate[]>;
|
|
70
|
-
groupQuery: (jid: string, type: "get" | "set", content: import("../WABinary").BinaryNode[]) => Promise<any>;
|
|
71
|
-
groupMetadata: (jid: string) => Promise<import("../Types").GroupMetadata>;
|
|
72
|
-
groupCreate: (subject: string, participants: string[]) => Promise<import("../Types").GroupMetadata>;
|
|
73
|
-
groupLeave: (id: string) => Promise<void>;
|
|
74
|
-
groupUpdateSubject: (jid: string, subject: string) => Promise<void>;
|
|
75
|
-
groupRequestParticipantsList: (jid: string) => Promise<{
|
|
76
|
-
[key: string]: string;
|
|
77
|
-
}[]>;
|
|
78
|
-
groupRequestParticipantsUpdate: (jid: string, participants: string[], action: "approve" | "reject") => Promise<{
|
|
79
|
-
status: string;
|
|
80
|
-
jid: string;
|
|
81
|
-
}[]>;
|
|
82
|
-
groupParticipantsUpdate: (jid: string, participants: string[], action: import("../Types").ParticipantAction) => Promise<{
|
|
83
|
-
status: string;
|
|
84
|
-
jid: string;
|
|
85
|
-
content: import("../WABinary").BinaryNode;
|
|
86
|
-
}[]>;
|
|
87
|
-
groupUpdateDescription: (jid: string, description?: string) => Promise<void>;
|
|
88
|
-
groupInviteCode: (jid: string) => Promise<string | undefined>;
|
|
89
|
-
groupRevokeInvite: (jid: string) => Promise<string | undefined>;
|
|
90
|
-
groupAcceptInvite: (code: string) => Promise<string | undefined>;
|
|
91
|
-
groupRevokeInviteV4: (groupJid: string, invitedJid: string) => Promise<boolean>;
|
|
92
|
-
groupAcceptInviteV4: (key: string | import("../Types").WAMessageKey, inviteMessage: import("../Types").WAProto.Message.IGroupInviteMessage) => Promise<any>;
|
|
93
|
-
groupGetInviteInfo: (code: string) => Promise<import("../Types").GroupMetadata>;
|
|
94
|
-
groupToggleEphemeral: (jid: string, ephemeralExpiration: number) => Promise<void>;
|
|
95
|
-
groupSettingUpdate: (jid: string, setting: "announcement" | "not_announcement" | "locked" | "unlocked") => Promise<void>;
|
|
96
|
-
groupMemberAddMode: (jid: string, mode: "admin_add" | "all_member_add") => Promise<void>;
|
|
97
|
-
groupJoinApprovalMode: (jid: string, mode: "on" | "off") => Promise<void>;
|
|
98
|
-
groupFetchAllParticipating: () => Promise<{
|
|
99
|
-
[_: string]: import("../Types").GroupMetadata;
|
|
100
|
-
}>;
|
|
101
|
-
getBotListV2: () => Promise<import("../Types").BotListInfo[]>;
|
|
102
|
-
processingMutex: {
|
|
103
|
-
mutex<T>(code: () => Promise<T> | T): Promise<T>;
|
|
104
|
-
};
|
|
105
|
-
upsertMessage: (msg: import("../Types").WAProto.IWebMessageInfo, type: import("../Types").MessageUpsertType) => Promise<void>;
|
|
106
|
-
appPatch: (patchCreate: import("../Types").WAPatchCreate) => Promise<void>;
|
|
107
|
-
sendPresenceUpdate: (type: import("../Types").WAPresence, toJid?: string) => Promise<void>;
|
|
108
|
-
presenceSubscribe: (toJid: string, tcToken?: Buffer) => Promise<void>;
|
|
109
|
-
profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
|
|
110
|
-
onWhatsApp: (...jids: string[]) => Promise<{
|
|
111
|
-
jid: string;
|
|
112
|
-
exists: unknown;
|
|
113
|
-
lid: unknown;
|
|
114
|
-
}[] | undefined>;
|
|
115
|
-
fetchBlocklist: () => Promise<string[]>;
|
|
116
|
-
fetchDisappearingDuration: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
117
|
-
fetchStatus: (...jids: string[]) => Promise<import("..").USyncQueryResultList[] | undefined>;
|
|
118
|
-
updateProfilePicture: (jid: string, content: import("../Types").WAMediaUpload) => Promise<void>;
|
|
119
|
-
removeProfilePicture: (jid: string) => Promise<void>;
|
|
120
|
-
updateProfileStatus: (status: string) => Promise<void>;
|
|
121
|
-
updateProfileName: (name: string) => Promise<void>;
|
|
122
|
-
updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
|
|
123
|
-
updateCallPrivacy: (value: import("../Types").WAPrivacyCallValue) => Promise<void>;
|
|
124
|
-
updateMessagesPrivacy: (value: import("../Types").WAPrivacyMessagesValue) => Promise<void>;
|
|
125
|
-
updateLastSeenPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
126
|
-
updateOnlinePrivacy: (value: import("../Types").WAPrivacyOnlineValue) => Promise<void>;
|
|
127
|
-
updateProfilePicturePrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
128
|
-
updateStatusPrivacy: (value: import("../Types").WAPrivacyValue) => Promise<void>;
|
|
129
|
-
updateReadReceiptsPrivacy: (value: import("../Types").WAReadReceiptsValue) => Promise<void>;
|
|
130
|
-
updateGroupsAddPrivacy: (value: import("../Types").WAPrivacyGroupAddValue) => Promise<void>;
|
|
131
|
-
updateDefaultDisappearingMode: (duration: number) => Promise<void>;
|
|
132
|
-
getBusinessProfile: (jid: string) => Promise<import("../Types").WABusinessProfile | void>;
|
|
133
|
-
resyncAppState: (collections: readonly ("critical_block" | "critical_unblock_low" | "regular_high" | "regular_low" | "regular")[], isInitialSync: boolean) => Promise<void>;
|
|
134
|
-
chatModify: (mod: import("../Types").ChatModification, jid: string) => Promise<void>;
|
|
135
|
-
cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
|
|
136
|
-
addChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
137
|
-
removeChatLabel: (jid: string, labelId: string) => Promise<void>;
|
|
138
|
-
addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
139
|
-
removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
|
|
140
|
-
star: (jid: string, messages: {
|
|
141
|
-
id: string;
|
|
142
|
-
fromMe?: boolean;
|
|
143
|
-
}[], star: boolean) => Promise<void>;
|
|
144
|
-
executeUSyncQuery: (usyncQuery: import("..").USyncQuery) => Promise<import("..").USyncQueryResult | undefined>;
|
|
145
|
-
type: "md";
|
|
146
|
-
ws: any;
|
|
147
|
-
ev: import("../Types").BaileysEventEmitter & {
|
|
148
|
-
process(handler: (events: Partial<import("../Types").BaileysEventMap>) => void | Promise<void>): (() => void);
|
|
149
|
-
buffer(): void;
|
|
150
|
-
createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): ((...args: A) => Promise<T>);
|
|
151
|
-
flush(force?: boolean): boolean;
|
|
152
|
-
isBuffering(): boolean;
|
|
153
|
-
};
|
|
154
|
-
authState: {
|
|
155
|
-
creds: import("../Types").AuthenticationCreds;
|
|
156
|
-
keys: import("../Types").SignalKeyStoreWithTransaction;
|
|
157
|
-
};
|
|
158
|
-
signalRepository: import("../Types").SignalRepository;
|
|
159
|
-
user: import("../Types").Contact | undefined;
|
|
160
|
-
generateMessageTag: () => string;
|
|
161
|
-
query: (node: import("../WABinary").BinaryNode, timeoutMs?: number) => Promise<any>;
|
|
162
|
-
waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<any>;
|
|
163
|
-
waitForSocketOpen: () => Promise<void>;
|
|
164
|
-
sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
|
|
165
|
-
sendNode: (frame: import("../WABinary").BinaryNode) => Promise<void>;
|
|
166
|
-
logout: (msg?: string) => Promise<void>;
|
|
167
|
-
end: (error: Error | undefined) => void;
|
|
168
|
-
onUnexpectedError: (err: Error | import("@hapi/boom").Boom, msg: string) => void;
|
|
169
|
-
uploadPreKeys: (count?: number) => Promise<void>;
|
|
170
|
-
uploadPreKeysToServerIfRequired: () => Promise<void>;
|
|
171
|
-
requestPairingCode: (phoneNumber: string, pairCode: string) => Promise<string>;
|
|
172
|
-
waitForConnectionUpdate: (check: (u: Partial<import("../Types").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
|
|
173
|
-
sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
|
|
174
|
-
};
|
|
175
|
-
export interface RegistrationData {
|
|
176
|
-
registrationId: number;
|
|
177
|
-
signedPreKey: SignedKeyPair;
|
|
178
|
-
noiseKey: KeyPair;
|
|
179
|
-
signedIdentityKey: KeyPair;
|
|
180
|
-
identityId: Buffer;
|
|
181
|
-
phoneId: string;
|
|
182
|
-
deviceId: string;
|
|
183
|
-
backupToken: Buffer;
|
|
184
|
-
}
|
|
185
|
-
export interface RegistrationOptions {
|
|
186
|
-
/** your phone number */
|
|
187
|
-
phoneNumber?: string;
|
|
188
|
-
/** the country code of your phone number */
|
|
189
|
-
phoneNumberCountryCode: string;
|
|
190
|
-
/** your phone number without country code */
|
|
191
|
-
phoneNumberNationalNumber: string;
|
|
192
|
-
/** the country code of your mobile network
|
|
193
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Country_Code}
|
|
194
|
-
*/
|
|
195
|
-
phoneNumberMobileCountryCode: string;
|
|
196
|
-
/** the network code of your mobile network
|
|
197
|
-
* @see {@link https://de.wikipedia.org/wiki/Mobile_Network_Code}
|
|
198
|
-
*/
|
|
199
|
-
phoneNumberMobileNetworkCode: string;
|
|
200
|
-
/**
|
|
201
|
-
* How to send the one time code
|
|
202
|
-
*/
|
|
203
|
-
method?: 'sms' | 'voice' | 'captcha';
|
|
204
|
-
/**
|
|
205
|
-
* The captcha code if it was requested
|
|
206
|
-
*/
|
|
207
|
-
captcha?: string;
|
|
208
|
-
}
|
|
209
|
-
export type RegistrationParams = RegistrationData & RegistrationOptions;
|
|
210
|
-
export declare function registrationParams(params: RegistrationParams): {
|
|
211
|
-
cc: string;
|
|
212
|
-
in: string;
|
|
213
|
-
Rc: string;
|
|
214
|
-
lg: string;
|
|
215
|
-
lc: string;
|
|
216
|
-
mistyped: string;
|
|
217
|
-
authkey: string;
|
|
218
|
-
e_regid: string;
|
|
219
|
-
e_keytype: string;
|
|
220
|
-
e_ident: string;
|
|
221
|
-
e_skey_id: string;
|
|
222
|
-
e_skey_val: string;
|
|
223
|
-
e_skey_sig: string;
|
|
224
|
-
fdid: string;
|
|
225
|
-
network_ratio_type: string;
|
|
226
|
-
expid: string;
|
|
227
|
-
simnum: string;
|
|
228
|
-
hasinrc: string;
|
|
229
|
-
pid: string;
|
|
230
|
-
id: string;
|
|
231
|
-
backup_token: string;
|
|
232
|
-
token: string;
|
|
233
|
-
fraud_checkpoint_code: string | undefined;
|
|
234
|
-
};
|
|
235
|
-
/**
|
|
236
|
-
* Requests a registration code for the given phone number.
|
|
237
|
-
*/
|
|
238
|
-
export declare function mobileRegisterCode(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
239
|
-
export declare function mobileRegisterExists(params: RegistrationParams, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
240
|
-
/**
|
|
241
|
-
* Registers the phone number on whatsapp with the received OTP code.
|
|
242
|
-
*/
|
|
243
|
-
export declare function mobileRegister(params: RegistrationParams & {
|
|
244
|
-
code: string;
|
|
245
|
-
}, fetchOptions?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
246
|
-
/**
|
|
247
|
-
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
|
248
|
-
*/
|
|
249
|
-
export declare function mobileRegisterEncrypt(data: string): string;
|
|
250
|
-
export declare function mobileRegisterFetch(path: string, opts?: AxiosRequestConfig): Promise<ExistsResponse>;
|
|
251
|
-
export interface ExistsResponse {
|
|
252
|
-
status: 'fail' | 'sent';
|
|
253
|
-
voice_length?: number;
|
|
254
|
-
voice_wait?: number;
|
|
255
|
-
sms_length?: number;
|
|
256
|
-
sms_wait?: number;
|
|
257
|
-
reason?: 'incorrect' | 'missing_param' | 'code_checkpoint';
|
|
258
|
-
login?: string;
|
|
259
|
-
flash_type?: number;
|
|
260
|
-
ab_hash?: string;
|
|
261
|
-
ab_key?: string;
|
|
262
|
-
exp_cfg?: string;
|
|
263
|
-
lid?: string;
|
|
264
|
-
image_blob?: string;
|
|
265
|
-
audio_blob?: string;
|
|
266
|
-
}
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.makeRegistrationSocket = void 0;
|
|
7
|
-
exports.registrationParams = registrationParams;
|
|
8
|
-
exports.mobileRegisterCode = mobileRegisterCode;
|
|
9
|
-
exports.mobileRegisterExists = mobileRegisterExists;
|
|
10
|
-
exports.mobileRegister = mobileRegister;
|
|
11
|
-
exports.mobileRegisterEncrypt = mobileRegisterEncrypt;
|
|
12
|
-
exports.mobileRegisterFetch = mobileRegisterFetch;
|
|
13
|
-
/* eslint-disable camelcase */
|
|
14
|
-
const axios_1 = __importDefault(require("axios"));
|
|
15
|
-
const Defaults_1 = require("../Defaults");
|
|
16
|
-
const crypto_1 = require("../Utils/crypto");
|
|
17
|
-
const WABinary_1 = require("../WABinary");
|
|
18
|
-
const business_1 = require("./business");
|
|
19
|
-
function urlencode(str) {
|
|
20
|
-
return str.replace(/-/g, '%2d').replace(/_/g, '%5f').replace(/~/g, '%7e');
|
|
21
|
-
}
|
|
22
|
-
const validRegistrationOptions = (config) => (config === null || config === void 0 ? void 0 : config.phoneNumberCountryCode) &&
|
|
23
|
-
config.phoneNumberNationalNumber &&
|
|
24
|
-
config.phoneNumberMobileCountryCode;
|
|
25
|
-
const makeRegistrationSocket = (config) => {
|
|
26
|
-
const sock = (0, business_1.makeBusinessSocket)(config);
|
|
27
|
-
const register = async (code) => {
|
|
28
|
-
if (!validRegistrationOptions(config.auth.creds.registration)) {
|
|
29
|
-
throw new Error('please specify the registration options');
|
|
30
|
-
}
|
|
31
|
-
const result = await mobileRegister({ ...sock.authState.creds, ...sock.authState.creds.registration, code }, config.options);
|
|
32
|
-
sock.authState.creds.me = {
|
|
33
|
-
id: (0, WABinary_1.jidEncode)(result.login, 's.whatsapp.net'),
|
|
34
|
-
name: '~'
|
|
35
|
-
};
|
|
36
|
-
sock.authState.creds.registered = true;
|
|
37
|
-
sock.ev.emit('creds.update', sock.authState.creds);
|
|
38
|
-
return result;
|
|
39
|
-
};
|
|
40
|
-
const requestRegistrationCode = async (registrationOptions) => {
|
|
41
|
-
registrationOptions = registrationOptions || config.auth.creds.registration;
|
|
42
|
-
if (!validRegistrationOptions(registrationOptions)) {
|
|
43
|
-
throw new Error('Invalid registration options');
|
|
44
|
-
}
|
|
45
|
-
sock.authState.creds.registration = registrationOptions;
|
|
46
|
-
sock.ev.emit('creds.update', sock.authState.creds);
|
|
47
|
-
return mobileRegisterCode({ ...config.auth.creds, ...registrationOptions }, config.options);
|
|
48
|
-
};
|
|
49
|
-
return {
|
|
50
|
-
...sock,
|
|
51
|
-
register,
|
|
52
|
-
requestRegistrationCode,
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
exports.makeRegistrationSocket = makeRegistrationSocket;
|
|
56
|
-
function convertBufferToUrlHex(buffer) {
|
|
57
|
-
var id = '';
|
|
58
|
-
buffer.forEach((x) => {
|
|
59
|
-
// encode random identity_id buffer as percentage url encoding
|
|
60
|
-
id += `%${x.toString(16).padStart(2, '0').toLowerCase()}`;
|
|
61
|
-
});
|
|
62
|
-
return id;
|
|
63
|
-
}
|
|
64
|
-
function registrationParams(params) {
|
|
65
|
-
const e_regid = Buffer.alloc(4);
|
|
66
|
-
e_regid.writeInt32BE(params.registrationId);
|
|
67
|
-
const e_skey_id = Buffer.alloc(3);
|
|
68
|
-
e_skey_id.writeInt16BE(params.signedPreKey.keyId);
|
|
69
|
-
params.phoneNumberCountryCode = params.phoneNumberCountryCode.replace('+', '').trim();
|
|
70
|
-
params.phoneNumberNationalNumber = params.phoneNumberNationalNumber.replace(/[/-\s)(]/g, '').trim();
|
|
71
|
-
return {
|
|
72
|
-
cc: params.phoneNumberCountryCode,
|
|
73
|
-
in: params.phoneNumberNationalNumber,
|
|
74
|
-
Rc: '0',
|
|
75
|
-
lg: 'en',
|
|
76
|
-
lc: 'GB',
|
|
77
|
-
mistyped: '6',
|
|
78
|
-
authkey: Buffer.from(params.noiseKey.public).toString('base64url'),
|
|
79
|
-
e_regid: e_regid.toString('base64url'),
|
|
80
|
-
e_keytype: 'BQ',
|
|
81
|
-
e_ident: Buffer.from(params.signedIdentityKey.public).toString('base64url'),
|
|
82
|
-
// e_skey_id: e_skey_id.toString('base64url'),
|
|
83
|
-
e_skey_id: 'AAAA',
|
|
84
|
-
e_skey_val: Buffer.from(params.signedPreKey.keyPair.public).toString('base64url'),
|
|
85
|
-
e_skey_sig: Buffer.from(params.signedPreKey.signature).toString('base64url'),
|
|
86
|
-
fdid: params.phoneId,
|
|
87
|
-
network_ratio_type: '1',
|
|
88
|
-
expid: params.deviceId,
|
|
89
|
-
simnum: '1',
|
|
90
|
-
hasinrc: '1',
|
|
91
|
-
pid: Math.floor(Math.random() * 1000).toString(),
|
|
92
|
-
id: convertBufferToUrlHex(params.identityId),
|
|
93
|
-
backup_token: convertBufferToUrlHex(params.backupToken),
|
|
94
|
-
token: (0, crypto_1.md5)(Buffer.concat([Defaults_1.MOBILE_TOKEN, Buffer.from(params.phoneNumberNationalNumber)])).toString('hex'),
|
|
95
|
-
fraud_checkpoint_code: params.captcha,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Requests a registration code for the given phone number.
|
|
100
|
-
*/
|
|
101
|
-
function mobileRegisterCode(params, fetchOptions) {
|
|
102
|
-
return mobileRegisterFetch('/code', {
|
|
103
|
-
params: {
|
|
104
|
-
...registrationParams(params),
|
|
105
|
-
mcc: `${params.phoneNumberMobileCountryCode}`.padStart(3, '0'),
|
|
106
|
-
mnc: `${params.phoneNumberMobileNetworkCode || '001'}`.padStart(3, '0'),
|
|
107
|
-
sim_mcc: '000',
|
|
108
|
-
sim_mnc: '000',
|
|
109
|
-
method: (params === null || params === void 0 ? void 0 : params.method) || 'sms',
|
|
110
|
-
reason: '',
|
|
111
|
-
hasav: '1'
|
|
112
|
-
},
|
|
113
|
-
...fetchOptions,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function mobileRegisterExists(params, fetchOptions) {
|
|
117
|
-
return mobileRegisterFetch('/exist', {
|
|
118
|
-
params: registrationParams(params),
|
|
119
|
-
...fetchOptions
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Registers the phone number on whatsapp with the received OTP code.
|
|
124
|
-
*/
|
|
125
|
-
async function mobileRegister(params, fetchOptions) {
|
|
126
|
-
//const result = await mobileRegisterFetch(`/reg_onboard_abprop?cc=${params.phoneNumberCountryCode}&in=${params.phoneNumberNationalNumber}&rc=0`)
|
|
127
|
-
return mobileRegisterFetch('/register', {
|
|
128
|
-
params: { ...registrationParams(params), code: params.code.replace('-', '') },
|
|
129
|
-
...fetchOptions,
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Encrypts the given string as AEAD aes-256-gcm with the public whatsapp key and a random keypair.
|
|
134
|
-
*/
|
|
135
|
-
function mobileRegisterEncrypt(data) {
|
|
136
|
-
const keypair = crypto_1.Curve.generateKeyPair();
|
|
137
|
-
const key = crypto_1.Curve.sharedKey(keypair.private, Defaults_1.REGISTRATION_PUBLIC_KEY);
|
|
138
|
-
const buffer = (0, crypto_1.aesEncryptGCM)(Buffer.from(data), new Uint8Array(key), Buffer.alloc(12), Buffer.alloc(0));
|
|
139
|
-
return Buffer.concat([Buffer.from(keypair.public), buffer]).toString('base64url');
|
|
140
|
-
}
|
|
141
|
-
async function mobileRegisterFetch(path, opts = {}) {
|
|
142
|
-
let url = `${Defaults_1.MOBILE_REGISTRATION_ENDPOINT}${path}`;
|
|
143
|
-
if (opts.params) {
|
|
144
|
-
const parameter = [];
|
|
145
|
-
for (const param in opts.params) {
|
|
146
|
-
if (opts.params[param] !== null && opts.params[param] !== undefined) {
|
|
147
|
-
parameter.push(param + '=' + urlencode(opts.params[param]));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
url += `?${parameter.join('&')}`;
|
|
151
|
-
delete opts.params;
|
|
152
|
-
}
|
|
153
|
-
if (!opts.headers) {
|
|
154
|
-
opts.headers = {};
|
|
155
|
-
}
|
|
156
|
-
opts.headers['User-Agent'] = Defaults_1.MOBILE_USERAGENT;
|
|
157
|
-
const response = await (0, axios_1.default)(url, opts);
|
|
158
|
-
var json = response.data;
|
|
159
|
-
if (response.status > 300 || json.reason) {
|
|
160
|
-
throw json;
|
|
161
|
-
}
|
|
162
|
-
if (json.status && !['ok', 'sent'].includes(json.status)) {
|
|
163
|
-
throw json;
|
|
164
|
-
}
|
|
165
|
-
return json;
|
|
166
|
-
}
|