lordceaser-baileys 2.0.38 → 2.0.39
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 +1 -1
- package/README.md +660 -1073
- package/WAProto/GenerateStatics.sh +4 -3
- package/WAProto/WAProto.proto +359 -2494
- package/WAProto/index.d.ts +31460 -8461
- package/WAProto/index.js +96236 -92883
- package/WASignalGroup/GroupProtocol.js +1697 -0
- package/WASignalGroup/ciphertext_message.js +16 -0
- package/WASignalGroup/group_cipher.js +120 -0
- package/WASignalGroup/group_session_builder.js +46 -0
- package/WASignalGroup/index.js +5 -0
- package/WASignalGroup/keyhelper.js +21 -0
- package/WASignalGroup/protobufs.js +3 -0
- package/WASignalGroup/queue_job.js +69 -0
- package/WASignalGroup/sender_chain_key.js +50 -0
- package/WASignalGroup/sender_key_distribution_message.js +78 -0
- package/WASignalGroup/sender_key_message.js +92 -0
- package/WASignalGroup/sender_key_name.js +70 -0
- package/WASignalGroup/sender_key_record.js +56 -0
- package/WASignalGroup/sender_key_state.js +129 -0
- package/{lib/Signal/Group/sender-message-key.js → WASignalGroup/sender_message_key.js} +16 -3
- package/index.js +417 -18
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +245 -37
- package/lib/Defaults/index.js +74 -82
- package/lib/Defaults/phonenumber-mcc.json +223 -0
- package/lib/Signal/libsignal.d.ts +3 -5
- package/lib/Signal/libsignal.js +80 -359
- package/lib/Socket/Client/{types.d.ts → abstract-socket-client.d.ts} +5 -4
- package/lib/Socket/Client/abstract-socket-client.js +13 -0
- package/lib/Socket/Client/index.d.ts +3 -3
- package/lib/Socket/Client/index.js +19 -3
- package/lib/Socket/Client/mobile-socket-client.d.ts +13 -0
- package/lib/Socket/Client/mobile-socket-client.js +65 -0
- package/lib/Socket/Client/{websocket.d.ts → web-socket-client.d.ts} +2 -3
- package/lib/Socket/Client/web-socket-client.js +62 -0
- package/lib/Socket/business.d.ts +87 -156
- package/lib/Socket/business.js +43 -162
- package/lib/Socket/chats.d.ts +40 -82
- package/lib/Socket/chats.js +284 -603
- package/lib/Socket/groups.d.ts +58 -96
- package/lib/Socket/groups.js +82 -115
- package/lib/Socket/index.d.ts +94 -204
- package/lib/Socket/index.js +9 -11
- package/lib/Socket/messages-recv.d.ts +77 -145
- package/lib/Socket/messages-recv.js +400 -1305
- package/lib/Socket/messages-send.d.ts +70 -141
- package/lib/Socket/messages-send.js +249 -717
- package/lib/Socket/registration.d.ts +242 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +18 -34
- package/lib/Socket/socket.js +206 -557
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +10 -0
- package/lib/Store/make-cache-manager-store.d.ts +14 -0
- package/lib/Store/make-cache-manager-store.js +83 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +422 -0
- package/lib/Store/make-ordered-dictionary.d.ts +13 -0
- package/lib/Store/make-ordered-dictionary.js +81 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +27 -0
- package/lib/Types/Auth.d.ts +12 -19
- package/lib/Types/Auth.js +2 -2
- package/lib/Types/Call.d.ts +1 -3
- package/lib/Types/Call.js +2 -2
- package/lib/Types/Chat.d.ts +14 -31
- package/lib/Types/Chat.js +4 -8
- package/lib/Types/Contact.d.ts +1 -8
- package/lib/Types/Contact.js +2 -2
- package/lib/Types/Events.d.ts +17 -101
- package/lib/Types/Events.js +2 -2
- package/lib/Types/GroupMetadata.d.ts +3 -18
- package/lib/Types/GroupMetadata.js +2 -2
- package/lib/Types/Label.d.ts +0 -1
- package/lib/Types/Label.js +5 -3
- package/lib/Types/LabelAssociation.d.ts +0 -1
- package/lib/Types/LabelAssociation.js +5 -3
- package/lib/Types/Message.d.ts +29 -81
- package/lib/Types/Message.js +9 -11
- package/lib/Types/Product.d.ts +1 -2
- package/lib/Types/Product.js +2 -2
- package/lib/Types/Signal.d.ts +2 -32
- package/lib/Types/Signal.js +2 -2
- package/lib/Types/Socket.d.ts +26 -46
- package/lib/Types/Socket.js +2 -3
- package/lib/Types/State.d.ts +2 -72
- package/lib/Types/State.js +2 -56
- package/lib/Types/index.d.ts +13 -16
- package/lib/Types/index.js +30 -15
- package/lib/Utils/auth-utils.d.ts +6 -12
- package/lib/Utils/auth-utils.js +143 -239
- package/lib/Utils/baileys-event-stream.d.ts +16 -0
- package/lib/Utils/baileys-event-stream.js +63 -0
- package/lib/Utils/business.d.ts +2 -3
- package/lib/Utils/business.js +69 -66
- package/lib/Utils/chat-utils.d.ts +23 -52
- package/lib/Utils/chat-utils.js +248 -380
- package/lib/Utils/crypto.d.ts +21 -17
- package/lib/Utils/crypto.js +92 -57
- package/lib/Utils/decode-wa-message.d.ts +8 -54
- package/lib/Utils/decode-wa-message.js +57 -186
- package/lib/Utils/event-buffer.d.ts +8 -9
- package/lib/Utils/event-buffer.js +76 -178
- package/lib/Utils/generics.d.ts +23 -26
- package/lib/Utils/generics.js +166 -165
- package/lib/Utils/history.d.ts +11 -16
- package/lib/Utils/history.js +53 -93
- package/lib/Utils/index.d.ts +17 -22
- package/lib/Utils/index.js +33 -22
- package/lib/Utils/link-preview.d.ts +5 -5
- package/lib/Utils/link-preview.js +24 -16
- package/lib/Utils/logger.d.ts +3 -11
- package/lib/Utils/logger.js +7 -3
- package/lib/Utils/lt-hash.d.ts +12 -8
- package/lib/Utils/lt-hash.js +46 -3
- package/lib/Utils/make-mutex.d.ts +2 -4
- package/lib/Utils/make-mutex.js +34 -24
- package/lib/Utils/messages-media.d.ts +35 -61
- package/lib/Utils/messages-media.js +301 -415
- package/lib/Utils/messages.d.ts +18 -32
- package/lib/Utils/messages.js +261 -396
- package/lib/Utils/noise-handler.d.ts +13 -12
- package/lib/Utils/noise-handler.js +98 -144
- package/lib/Utils/process-message.d.ts +12 -30
- package/lib/Utils/process-message.js +163 -439
- package/lib/Utils/signal.d.ts +5 -20
- package/lib/Utils/signal.js +74 -114
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
- package/lib/Utils/use-multi-file-auth-state.js +33 -61
- package/lib/Utils/validate-connection.d.ts +6 -6
- package/lib/Utils/validate-connection.js +114 -119
- package/lib/WABinary/constants.d.ts +4 -5
- package/lib/WABinary/constants.js +20 -1281
- package/lib/WABinary/decode.d.ts +4 -4
- package/lib/WABinary/decode.js +43 -51
- package/lib/WABinary/encode.d.ts +3 -3
- package/lib/WABinary/encode.js +44 -32
- package/lib/WABinary/generic-utils.d.ts +6 -6
- package/lib/WABinary/generic-utils.js +43 -46
- package/lib/WABinary/index.d.ts +5 -6
- package/lib/WABinary/index.js +21 -6
- package/lib/WABinary/jid-utils.d.ts +6 -23
- package/lib/WABinary/jid-utils.js +39 -73
- package/lib/WABinary/types.d.ts +1 -2
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +11 -3
- package/lib/WAM/BinaryInfo.js +5 -2
- package/lib/WAM/constants.d.ts +3 -5
- package/lib/WAM/constants.js +11958 -19461
- package/lib/WAM/encode.d.ts +3 -3
- package/lib/WAM/encode.js +22 -17
- package/lib/WAM/index.d.ts +3 -4
- package/lib/WAM/index.js +19 -4
- package/lib/index.d.ts +8 -9
- package/lib/index.js +30 -11
- package/package.json +2 -2
- package/WAProto/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/WAProto/WAProto.proto +0 -5479
- package/WAProto/WAProto/fix-imports.js +0 -85
- package/WAProto/WAProto/index.d.ts +0 -14017
- package/WAProto/WAProto/index.js +0 -97691
- package/WAProto/fix-imports.js +0 -85
- package/lib/Defaults/index.d.ts.map +0 -1
- package/lib/Defaults/index.js.map +0 -1
- package/lib/Signal/Group/ciphertext-message.d.ts +0 -10
- package/lib/Signal/Group/ciphertext-message.d.ts.map +0 -1
- package/lib/Signal/Group/ciphertext-message.js +0 -12
- package/lib/Signal/Group/ciphertext-message.js.map +0 -1
- package/lib/Signal/Group/group-session-builder.d.ts +0 -15
- package/lib/Signal/Group/group-session-builder.d.ts.map +0 -1
- package/lib/Signal/Group/group-session-builder.js +0 -30
- package/lib/Signal/Group/group-session-builder.js.map +0 -1
- package/lib/Signal/Group/group_cipher.d.ts +0 -17
- package/lib/Signal/Group/group_cipher.d.ts.map +0 -1
- package/lib/Signal/Group/group_cipher.js +0 -82
- package/lib/Signal/Group/group_cipher.js.map +0 -1
- package/lib/Signal/Group/index.d.ts +0 -12
- package/lib/Signal/Group/index.d.ts.map +0 -1
- package/lib/Signal/Group/index.js +0 -12
- package/lib/Signal/Group/index.js.map +0 -1
- package/lib/Signal/Group/keyhelper.d.ts +0 -11
- package/lib/Signal/Group/keyhelper.d.ts.map +0 -1
- package/lib/Signal/Group/keyhelper.js +0 -18
- package/lib/Signal/Group/keyhelper.js.map +0 -1
- package/lib/Signal/Group/sender-chain-key.d.ts +0 -14
- package/lib/Signal/Group/sender-chain-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-chain-key.js +0 -26
- package/lib/Signal/Group/sender-chain-key.js.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +0 -17
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-distribution-message.js +0 -63
- package/lib/Signal/Group/sender-key-distribution-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-message.d.ts +0 -19
- package/lib/Signal/Group/sender-key-message.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-message.js +0 -66
- package/lib/Signal/Group/sender-key-message.js.map +0 -1
- package/lib/Signal/Group/sender-key-name.d.ts +0 -18
- package/lib/Signal/Group/sender-key-name.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-name.js +0 -48
- package/lib/Signal/Group/sender-key-name.js.map +0 -1
- package/lib/Signal/Group/sender-key-record.d.ts +0 -31
- package/lib/Signal/Group/sender-key-record.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-record.js +0 -41
- package/lib/Signal/Group/sender-key-record.js.map +0 -1
- package/lib/Signal/Group/sender-key-state.d.ts +0 -39
- package/lib/Signal/Group/sender-key-state.d.ts.map +0 -1
- package/lib/Signal/Group/sender-key-state.js +0 -84
- package/lib/Signal/Group/sender-key-state.js.map +0 -1
- package/lib/Signal/Group/sender-message-key.d.ts +0 -12
- package/lib/Signal/Group/sender-message-key.d.ts.map +0 -1
- package/lib/Signal/Group/sender-message-key.js.map +0 -1
- package/lib/Signal/libsignal.d.ts.map +0 -1
- package/lib/Signal/libsignal.js.map +0 -1
- package/lib/Signal/lid-mapping.d.ts +0 -23
- package/lib/Signal/lid-mapping.d.ts.map +0 -1
- package/lib/Signal/lid-mapping.js +0 -277
- package/lib/Signal/lid-mapping.js.map +0 -1
- package/lib/Socket/Client/index.d.ts.map +0 -1
- package/lib/Socket/Client/index.js.map +0 -1
- package/lib/Socket/Client/types.d.ts.map +0 -1
- package/lib/Socket/Client/types.js +0 -11
- package/lib/Socket/Client/types.js.map +0 -1
- package/lib/Socket/Client/websocket.d.ts.map +0 -1
- package/lib/Socket/Client/websocket.js +0 -54
- package/lib/Socket/Client/websocket.js.map +0 -1
- package/lib/Socket/business.d.ts.map +0 -1
- package/lib/Socket/business.js.map +0 -1
- package/lib/Socket/chats.d.ts.map +0 -1
- package/lib/Socket/chats.js.map +0 -1
- package/lib/Socket/communities.d.ts +0 -273
- package/lib/Socket/communities.d.ts.map +0 -1
- package/lib/Socket/communities.js +0 -431
- package/lib/Socket/communities.js.map +0 -1
- package/lib/Socket/groups.d.ts.map +0 -1
- package/lib/Socket/groups.js.map +0 -1
- package/lib/Socket/index.d.ts.map +0 -1
- package/lib/Socket/index.js.map +0 -1
- package/lib/Socket/messages-recv.d.ts.map +0 -1
- package/lib/Socket/messages-recv.js.map +0 -1
- package/lib/Socket/messages-send.d.ts.map +0 -1
- package/lib/Socket/messages-send.js.map +0 -1
- package/lib/Socket/mex.d.ts +0 -3
- package/lib/Socket/mex.d.ts.map +0 -1
- package/lib/Socket/mex.js +0 -42
- package/lib/Socket/mex.js.map +0 -1
- package/lib/Socket/newsletter.d.ts +0 -170
- package/lib/Socket/newsletter.d.ts.map +0 -1
- package/lib/Socket/newsletter.js +0 -181
- package/lib/Socket/newsletter.js.map +0 -1
- package/lib/Socket/socket.d.ts.map +0 -1
- package/lib/Socket/socket.js.map +0 -1
- package/lib/Types/Auth.d.ts.map +0 -1
- package/lib/Types/Auth.js.map +0 -1
- package/lib/Types/Bussines.d.ts +0 -25
- package/lib/Types/Bussines.d.ts.map +0 -1
- package/lib/Types/Bussines.js +0 -2
- package/lib/Types/Bussines.js.map +0 -1
- package/lib/Types/Call.d.ts.map +0 -1
- package/lib/Types/Call.js.map +0 -1
- package/lib/Types/Chat.d.ts.map +0 -1
- package/lib/Types/Chat.js.map +0 -1
- package/lib/Types/Contact.d.ts.map +0 -1
- package/lib/Types/Contact.js.map +0 -1
- package/lib/Types/Events.d.ts.map +0 -1
- package/lib/Types/Events.js.map +0 -1
- package/lib/Types/GroupMetadata.d.ts.map +0 -1
- package/lib/Types/GroupMetadata.js.map +0 -1
- package/lib/Types/Label.d.ts.map +0 -1
- package/lib/Types/Label.js.map +0 -1
- package/lib/Types/LabelAssociation.d.ts.map +0 -1
- package/lib/Types/LabelAssociation.js.map +0 -1
- package/lib/Types/Message.d.ts.map +0 -1
- package/lib/Types/Message.js.map +0 -1
- package/lib/Types/Mex.d.ts +0 -141
- package/lib/Types/Mex.d.ts.map +0 -1
- package/lib/Types/Mex.js +0 -37
- package/lib/Types/Mex.js.map +0 -1
- package/lib/Types/Product.d.ts.map +0 -1
- package/lib/Types/Product.js.map +0 -1
- package/lib/Types/Signal.d.ts.map +0 -1
- package/lib/Types/Signal.js.map +0 -1
- package/lib/Types/Socket.d.ts.map +0 -1
- package/lib/Types/Socket.js.map +0 -1
- package/lib/Types/State.d.ts.map +0 -1
- package/lib/Types/State.js.map +0 -1
- package/lib/Types/USync.d.ts +0 -26
- package/lib/Types/USync.d.ts.map +0 -1
- package/lib/Types/USync.js +0 -2
- package/lib/Types/USync.js.map +0 -1
- package/lib/Types/index.d.ts.map +0 -1
- package/lib/Types/index.js.map +0 -1
- package/lib/Utils/auth-utils.d.ts.map +0 -1
- package/lib/Utils/auth-utils.js.map +0 -1
- package/lib/Utils/browser-utils.d.ts +0 -4
- package/lib/Utils/browser-utils.d.ts.map +0 -1
- package/lib/Utils/browser-utils.js +0 -29
- package/lib/Utils/browser-utils.js.map +0 -1
- package/lib/Utils/business.d.ts.map +0 -1
- package/lib/Utils/business.js.map +0 -1
- package/lib/Utils/chat-utils.d.ts.map +0 -1
- package/lib/Utils/chat-utils.js.map +0 -1
- package/lib/Utils/companion-reg-client-utils.d.ts +0 -17
- package/lib/Utils/companion-reg-client-utils.d.ts.map +0 -1
- package/lib/Utils/companion-reg-client-utils.js +0 -35
- package/lib/Utils/companion-reg-client-utils.js.map +0 -1
- package/lib/Utils/crypto.d.ts.map +0 -1
- package/lib/Utils/crypto.js.map +0 -1
- package/lib/Utils/decode-wa-message.d.ts.map +0 -1
- package/lib/Utils/decode-wa-message.js.map +0 -1
- package/lib/Utils/event-buffer.d.ts.map +0 -1
- package/lib/Utils/event-buffer.js.map +0 -1
- package/lib/Utils/generics.d.ts.map +0 -1
- package/lib/Utils/generics.js.map +0 -1
- package/lib/Utils/history.d.ts.map +0 -1
- package/lib/Utils/history.js.map +0 -1
- package/lib/Utils/identity-change-handler.d.ts +0 -44
- package/lib/Utils/identity-change-handler.d.ts.map +0 -1
- package/lib/Utils/identity-change-handler.js +0 -50
- package/lib/Utils/identity-change-handler.js.map +0 -1
- package/lib/Utils/index.d.ts.map +0 -1
- package/lib/Utils/index.js.map +0 -1
- package/lib/Utils/link-preview.d.ts.map +0 -1
- package/lib/Utils/link-preview.js.map +0 -1
- package/lib/Utils/logger.d.ts.map +0 -1
- package/lib/Utils/logger.js.map +0 -1
- package/lib/Utils/lt-hash.d.ts.map +0 -1
- package/lib/Utils/lt-hash.js.map +0 -1
- package/lib/Utils/make-mutex.d.ts.map +0 -1
- package/lib/Utils/make-mutex.js.map +0 -1
- package/lib/Utils/message-retry-manager.d.ts +0 -115
- package/lib/Utils/message-retry-manager.d.ts.map +0 -1
- package/lib/Utils/message-retry-manager.js +0 -265
- package/lib/Utils/message-retry-manager.js.map +0 -1
- package/lib/Utils/messages-media.d.ts.map +0 -1
- package/lib/Utils/messages-media.js.map +0 -1
- package/lib/Utils/messages.d.ts.map +0 -1
- package/lib/Utils/messages.js.map +0 -1
- package/lib/Utils/noise-handler.d.ts.map +0 -1
- package/lib/Utils/noise-handler.js.map +0 -1
- package/lib/Utils/offline-node-processor.d.ts +0 -17
- package/lib/Utils/offline-node-processor.d.ts.map +0 -1
- package/lib/Utils/offline-node-processor.js +0 -40
- package/lib/Utils/offline-node-processor.js.map +0 -1
- package/lib/Utils/pre-key-manager.d.ts +0 -28
- package/lib/Utils/pre-key-manager.d.ts.map +0 -1
- package/lib/Utils/pre-key-manager.js +0 -106
- package/lib/Utils/pre-key-manager.js.map +0 -1
- package/lib/Utils/process-message.d.ts.map +0 -1
- package/lib/Utils/process-message.js.map +0 -1
- package/lib/Utils/reporting-utils.d.ts +0 -11
- package/lib/Utils/reporting-utils.d.ts.map +0 -1
- package/lib/Utils/reporting-utils.js +0 -258
- package/lib/Utils/reporting-utils.js.map +0 -1
- package/lib/Utils/signal.d.ts.map +0 -1
- package/lib/Utils/signal.js.map +0 -1
- package/lib/Utils/stanza-ack.d.ts +0 -11
- package/lib/Utils/stanza-ack.d.ts.map +0 -1
- package/lib/Utils/stanza-ack.js +0 -38
- package/lib/Utils/stanza-ack.js.map +0 -1
- package/lib/Utils/sync-action-utils.d.ts +0 -19
- package/lib/Utils/sync-action-utils.d.ts.map +0 -1
- package/lib/Utils/sync-action-utils.js +0 -49
- package/lib/Utils/sync-action-utils.js.map +0 -1
- package/lib/Utils/tc-token-utils.d.ts +0 -37
- package/lib/Utils/tc-token-utils.d.ts.map +0 -1
- package/lib/Utils/tc-token-utils.js +0 -164
- package/lib/Utils/tc-token-utils.js.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +0 -1
- package/lib/Utils/use-multi-file-auth-state.js.map +0 -1
- package/lib/Utils/validate-connection.d.ts.map +0 -1
- package/lib/Utils/validate-connection.js.map +0 -1
- package/lib/WABinary/constants.d.ts.map +0 -1
- package/lib/WABinary/constants.js.map +0 -1
- package/lib/WABinary/decode.d.ts.map +0 -1
- package/lib/WABinary/decode.js.map +0 -1
- package/lib/WABinary/encode.d.ts.map +0 -1
- package/lib/WABinary/encode.js.map +0 -1
- package/lib/WABinary/generic-utils.d.ts.map +0 -1
- package/lib/WABinary/generic-utils.js.map +0 -1
- package/lib/WABinary/index.d.ts.map +0 -1
- package/lib/WABinary/index.js.map +0 -1
- package/lib/WABinary/jid-utils.d.ts.map +0 -1
- package/lib/WABinary/jid-utils.js.map +0 -1
- package/lib/WABinary/types.d.ts.map +0 -1
- package/lib/WABinary/types.js.map +0 -1
- package/lib/WAM/BinaryInfo.d.ts.map +0 -1
- package/lib/WAM/BinaryInfo.js.map +0 -1
- package/lib/WAM/constants.d.ts.map +0 -1
- package/lib/WAM/constants.js.map +0 -1
- package/lib/WAM/encode.d.ts.map +0 -1
- package/lib/WAM/encode.js.map +0 -1
- package/lib/WAM/index.d.ts.map +0 -1
- package/lib/WAM/index.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +0 -52
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +0 -23
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +0 -54
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +0 -13
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +0 -27
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +0 -13
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +0 -38
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +0 -25
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +0 -26
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +0 -51
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +0 -10
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +0 -29
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/index.d.ts +0 -6
- package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/index.js +0 -6
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts +0 -30
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js +0 -98
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts +0 -17
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js +0 -31
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts +0 -4
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js +0 -4
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js.map +0 -1
package/lib/WABinary/decode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
3
|
+
export declare const decompressingIfRequired: (buffer: Buffer) => Promise<Buffer>;
|
|
4
|
+
export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, 'DOUBLE_BYTE_TOKENS' | 'SINGLE_BYTE_TOKENS' | 'TAGS'>, indexRef?: {
|
|
4
5
|
index: number;
|
|
5
6
|
}) => BinaryNode;
|
|
6
7
|
export declare const decodeBinaryNode: (buff: Buffer) => Promise<BinaryNode>;
|
|
7
|
-
//# sourceMappingURL=decode.d.ts.map
|
package/lib/WABinary/decode.js
CHANGED
|
@@ -1,19 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.decodeBinaryNode = exports.decodeDecompressedBinaryNode = exports.decompressingIfRequired = void 0;
|
|
27
|
+
const util_1 = require("util");
|
|
28
|
+
const zlib_1 = require("zlib");
|
|
29
|
+
const constants = __importStar(require("./constants"));
|
|
30
|
+
const jid_utils_1 = require("./jid-utils");
|
|
31
|
+
const inflatePromise = (0, util_1.promisify)(zlib_1.inflate);
|
|
32
|
+
const decompressingIfRequired = async (buffer) => {
|
|
7
33
|
if (2 & buffer.readUInt8()) {
|
|
8
34
|
buffer = await inflatePromise(buffer.slice(1));
|
|
9
35
|
}
|
|
10
|
-
else {
|
|
11
|
-
// nodes with no compression have a 0x00 prefix, we remove that
|
|
36
|
+
else { // nodes with no compression have a 0x00 prefix, we remove that
|
|
12
37
|
buffer = buffer.slice(1);
|
|
13
38
|
}
|
|
14
39
|
return buffer;
|
|
15
40
|
};
|
|
16
|
-
|
|
41
|
+
exports.decompressingIfRequired = decompressingIfRequired;
|
|
42
|
+
const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0 }) => {
|
|
17
43
|
const { DOUBLE_BYTE_TOKENS, SINGLE_BYTE_TOKENS, TAGS } = opts;
|
|
18
44
|
const checkEOS = (length) => {
|
|
19
45
|
if (indexRef.index + length > buffer.length) {
|
|
@@ -120,41 +146,10 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
120
146
|
throw new Error('invalid jid pair: ' + i + ', ' + j);
|
|
121
147
|
};
|
|
122
148
|
const readAdJid = () => {
|
|
123
|
-
const
|
|
124
|
-
const domainType = Number(rawDomainType);
|
|
149
|
+
const agent = readByte();
|
|
125
150
|
const device = readByte();
|
|
126
151
|
const user = readString(readByte());
|
|
127
|
-
|
|
128
|
-
if (domainType === WAJIDDomains.LID) {
|
|
129
|
-
server = 'lid';
|
|
130
|
-
}
|
|
131
|
-
else if (domainType === WAJIDDomains.HOSTED) {
|
|
132
|
-
server = 'hosted';
|
|
133
|
-
}
|
|
134
|
-
else if (domainType === WAJIDDomains.HOSTED_LID) {
|
|
135
|
-
server = 'hosted.lid';
|
|
136
|
-
}
|
|
137
|
-
return jidEncode(user, server, device);
|
|
138
|
-
};
|
|
139
|
-
const readFbJid = () => {
|
|
140
|
-
const user = readString(readByte());
|
|
141
|
-
const device = readInt(2);
|
|
142
|
-
const server = readString(readByte());
|
|
143
|
-
return `${user}:${device}@${server}`;
|
|
144
|
-
};
|
|
145
|
-
const readInteropJid = () => {
|
|
146
|
-
const user = readString(readByte());
|
|
147
|
-
const device = readInt(2);
|
|
148
|
-
const integrator = readInt(2);
|
|
149
|
-
let server = 'interop';
|
|
150
|
-
const beforeServer = indexRef.index;
|
|
151
|
-
try {
|
|
152
|
-
server = readString(readByte());
|
|
153
|
-
}
|
|
154
|
-
catch (err) {
|
|
155
|
-
indexRef.index = beforeServer;
|
|
156
|
-
}
|
|
157
|
-
return `${integrator}-${user}:${device}@${server}`;
|
|
152
|
+
return (0, jid_utils_1.jidEncode)(user, agent === 0 ? 's.whatsapp.net' : 'lid', device);
|
|
158
153
|
};
|
|
159
154
|
const readString = (tag) => {
|
|
160
155
|
if (tag >= 1 && tag < SINGLE_BYTE_TOKENS.length) {
|
|
@@ -176,10 +171,6 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
176
171
|
return readStringFromChars(readInt(4));
|
|
177
172
|
case TAGS.JID_PAIR:
|
|
178
173
|
return readJidPair();
|
|
179
|
-
case TAGS.FB_JID:
|
|
180
|
-
return readFbJid();
|
|
181
|
-
case TAGS.INTEROP_JID:
|
|
182
|
-
return readInteropJid();
|
|
183
174
|
case TAGS.AD_JID:
|
|
184
175
|
return readAdJid();
|
|
185
176
|
case TAGS.HEX_8:
|
|
@@ -193,7 +184,7 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
193
184
|
const items = [];
|
|
194
185
|
const size = readListSize(tag);
|
|
195
186
|
for (let i = 0; i < size; i++) {
|
|
196
|
-
items.push(decodeDecompressedBinaryNode(buffer, opts, indexRef));
|
|
187
|
+
items.push((0, exports.decodeDecompressedBinaryNode)(buffer, opts, indexRef));
|
|
197
188
|
}
|
|
198
189
|
return items;
|
|
199
190
|
};
|
|
@@ -255,8 +246,9 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
255
246
|
content: data
|
|
256
247
|
};
|
|
257
248
|
};
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
249
|
+
exports.decodeDecompressedBinaryNode = decodeDecompressedBinaryNode;
|
|
250
|
+
const decodeBinaryNode = async (buff) => {
|
|
251
|
+
const decompBuff = await (0, exports.decompressingIfRequired)(buff);
|
|
252
|
+
return (0, exports.decodeDecompressedBinaryNode)(decompBuff, constants);
|
|
261
253
|
};
|
|
262
|
-
|
|
254
|
+
exports.decodeBinaryNode = decodeBinaryNode;
|
package/lib/WABinary/encode.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
3
|
+
export declare const encodeBinaryNode: (node: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, 'TAGS' | 'TOKEN_MAP'>, buffer?: number[]) => Buffer;
|
package/lib/WABinary/encode.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.encodeBinaryNode = void 0;
|
|
27
|
+
const constants = __importStar(require("./constants"));
|
|
28
|
+
const jid_utils_1 = require("./jid-utils");
|
|
29
|
+
const encodeBinaryNode = (node, opts = constants, buffer = [0]) => {
|
|
4
30
|
const encoded = encodeBinaryNodeInner(node, opts, buffer);
|
|
5
31
|
return Buffer.from(encoded);
|
|
6
32
|
};
|
|
33
|
+
exports.encodeBinaryNode = encodeBinaryNode;
|
|
7
34
|
const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
8
35
|
const { TAGS, TOKEN_MAP } = opts;
|
|
9
36
|
const pushByte = (value) => buffer.push(value & 0xff);
|
|
@@ -13,15 +40,11 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
13
40
|
buffer.push((value >> (curShift * 8)) & 0xff);
|
|
14
41
|
}
|
|
15
42
|
};
|
|
16
|
-
const pushBytes = (bytes) =>
|
|
17
|
-
for (const b of bytes) {
|
|
18
|
-
buffer.push(b);
|
|
19
|
-
}
|
|
20
|
-
};
|
|
43
|
+
const pushBytes = (bytes) => (bytes.forEach(b => buffer.push(b)));
|
|
21
44
|
const pushInt16 = (value) => {
|
|
22
45
|
pushBytes([(value >> 8) & 0xff, value & 0xff]);
|
|
23
46
|
};
|
|
24
|
-
const pushInt20 = (value) => pushBytes([(value >> 16) & 0x0f, (value >> 8) & 0xff, value & 0xff]);
|
|
47
|
+
const pushInt20 = (value) => (pushBytes([(value >> 16) & 0x0f, (value >> 8) & 0xff, value & 0xff]));
|
|
25
48
|
const writeByteLength = (length) => {
|
|
26
49
|
if (length >= 4294967296) {
|
|
27
50
|
throw new Error('string too large to encode: ' + length);
|
|
@@ -116,10 +139,11 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
116
139
|
}
|
|
117
140
|
};
|
|
118
141
|
const isNibble = (str) => {
|
|
119
|
-
if (
|
|
142
|
+
if (str.length > TAGS.PACKED_MAX) {
|
|
120
143
|
return false;
|
|
121
144
|
}
|
|
122
|
-
for (
|
|
145
|
+
for (let i = 0; i < str.length; i++) {
|
|
146
|
+
const char = str[i];
|
|
123
147
|
const isInNibbleRange = char >= '0' && char <= '9';
|
|
124
148
|
if (!isInNibbleRange && char !== '-' && char !== '.') {
|
|
125
149
|
return false;
|
|
@@ -128,26 +152,19 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
128
152
|
return true;
|
|
129
153
|
};
|
|
130
154
|
const isHex = (str) => {
|
|
131
|
-
if (
|
|
155
|
+
if (str.length > TAGS.PACKED_MAX) {
|
|
132
156
|
return false;
|
|
133
157
|
}
|
|
134
|
-
for (
|
|
158
|
+
for (let i = 0; i < str.length; i++) {
|
|
159
|
+
const char = str[i];
|
|
135
160
|
const isInNibbleRange = char >= '0' && char <= '9';
|
|
136
|
-
if (!isInNibbleRange && !(char >= 'A' && char <= 'F')) {
|
|
161
|
+
if (!isInNibbleRange && !(char >= 'A' && char <= 'F') && !(char >= 'a' && char <= 'f')) {
|
|
137
162
|
return false;
|
|
138
163
|
}
|
|
139
164
|
}
|
|
140
165
|
return true;
|
|
141
166
|
};
|
|
142
167
|
const writeString = (str) => {
|
|
143
|
-
if (str === undefined || str === null) {
|
|
144
|
-
pushByte(TAGS.LIST_EMPTY);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (str === '') {
|
|
148
|
-
writeStringRaw(str);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
168
|
const tokenIndex = TOKEN_MAP[str];
|
|
152
169
|
if (tokenIndex) {
|
|
153
170
|
if (typeof tokenIndex.dict === 'number') {
|
|
@@ -161,8 +178,8 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
161
178
|
else if (isHex(str)) {
|
|
162
179
|
writePackedBytes(str, 'hex');
|
|
163
180
|
}
|
|
164
|
-
else {
|
|
165
|
-
const decodedJid = jidDecode(str);
|
|
181
|
+
else if (str) {
|
|
182
|
+
const decodedJid = (0, jid_utils_1.jidDecode)(str);
|
|
166
183
|
if (decodedJid) {
|
|
167
184
|
writeJid(decodedJid);
|
|
168
185
|
}
|
|
@@ -183,10 +200,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
183
200
|
pushInt16(listSize);
|
|
184
201
|
}
|
|
185
202
|
};
|
|
186
|
-
|
|
187
|
-
throw new Error('Invalid node: tag cannot be undefined');
|
|
188
|
-
}
|
|
189
|
-
const validAttributes = Object.keys(attrs || {}).filter(k => typeof attrs[k] !== 'undefined' && attrs[k] !== null);
|
|
203
|
+
const validAttributes = Object.keys(attrs).filter(k => (typeof attrs[k] !== 'undefined' && attrs[k] !== null));
|
|
190
204
|
writeListStart(2 * validAttributes.length + 1 + (typeof content !== 'undefined' ? 1 : 0));
|
|
191
205
|
writeString(tag);
|
|
192
206
|
for (const key of validAttributes) {
|
|
@@ -203,9 +217,8 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
203
217
|
pushBytes(content);
|
|
204
218
|
}
|
|
205
219
|
else if (Array.isArray(content)) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
for (const item of validContent) {
|
|
220
|
+
writeListStart(content.length);
|
|
221
|
+
for (const item of content) {
|
|
209
222
|
encodeBinaryNodeInner(item, opts, buffer);
|
|
210
223
|
}
|
|
211
224
|
}
|
|
@@ -217,4 +230,3 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
217
230
|
}
|
|
218
231
|
return buffer;
|
|
219
232
|
};
|
|
220
|
-
//# sourceMappingURL=encode.js.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { proto } from '../../WAProto';
|
|
3
|
+
import { BinaryNode } from './types';
|
|
3
4
|
export declare const getBinaryNodeChildren: (node: BinaryNode | undefined, childTag: string) => BinaryNode[];
|
|
4
|
-
export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
|
|
5
5
|
export declare const getAllBinaryNodeChildren: ({ content }: BinaryNode) => BinaryNode[];
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
|
|
7
|
+
export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => Uint8Array | Buffer | undefined;
|
|
7
8
|
export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) => string | undefined;
|
|
8
9
|
export declare const getBinaryNodeChildUInt: (node: BinaryNode, childTag: string, length: number) => number | undefined;
|
|
9
10
|
export declare const assertNodeErrorFree: (node: BinaryNode) => void;
|
|
@@ -11,5 +12,4 @@ export declare const reduceBinaryNodeToDictionary: (node: BinaryNode, tag: strin
|
|
|
11
12
|
[_: string]: string;
|
|
12
13
|
};
|
|
13
14
|
export declare const getBinaryNodeMessages: ({ content }: BinaryNode) => proto.WebMessageInfo[];
|
|
14
|
-
export declare function binaryNodeToString(node: BinaryNode | BinaryNode['content'], i?: number):
|
|
15
|
-
//# sourceMappingURL=generic-utils.d.ts.map
|
|
15
|
+
export declare function binaryNodeToString(node: BinaryNode | BinaryNode['content'], i?: number): any;
|
|
@@ -1,43 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.binaryNodeToString = exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
|
|
4
|
+
const boom_1 = require("@hapi/boom");
|
|
5
|
+
const WAProto_1 = require("../../WAProto");
|
|
4
6
|
// some extra useful utilities
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return [];
|
|
9
|
-
let index = indexCache.get(node);
|
|
10
|
-
// Build the index once per node
|
|
11
|
-
if (!index) {
|
|
12
|
-
index = new Map();
|
|
13
|
-
for (const child of node.content) {
|
|
14
|
-
let arr = index.get(child.tag);
|
|
15
|
-
if (!arr)
|
|
16
|
-
index.set(child.tag, (arr = []));
|
|
17
|
-
arr.push(child);
|
|
18
|
-
}
|
|
19
|
-
indexCache.set(node, index);
|
|
7
|
+
const getBinaryNodeChildren = (node, childTag) => {
|
|
8
|
+
if (Array.isArray(node === null || node === void 0 ? void 0 : node.content)) {
|
|
9
|
+
return node.content.filter(item => item.tag === childTag);
|
|
20
10
|
}
|
|
21
|
-
|
|
22
|
-
return index.get(childTag) || [];
|
|
23
|
-
};
|
|
24
|
-
export const getBinaryNodeChild = (node, childTag) => {
|
|
25
|
-
return getBinaryNodeChildren(node, childTag)[0];
|
|
11
|
+
return [];
|
|
26
12
|
};
|
|
27
|
-
|
|
13
|
+
exports.getBinaryNodeChildren = getBinaryNodeChildren;
|
|
14
|
+
const getAllBinaryNodeChildren = ({ content }) => {
|
|
28
15
|
if (Array.isArray(content)) {
|
|
29
16
|
return content;
|
|
30
17
|
}
|
|
31
18
|
return [];
|
|
32
19
|
};
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
exports.getAllBinaryNodeChildren = getAllBinaryNodeChildren;
|
|
21
|
+
const getBinaryNodeChild = (node, childTag) => {
|
|
22
|
+
if (Array.isArray(node === null || node === void 0 ? void 0 : node.content)) {
|
|
23
|
+
return node === null || node === void 0 ? void 0 : node.content.find(item => item.tag === childTag);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.getBinaryNodeChild = getBinaryNodeChild;
|
|
27
|
+
const getBinaryNodeChildBuffer = (node, childTag) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const child = (_a = (0, exports.getBinaryNodeChild)(node, childTag)) === null || _a === void 0 ? void 0 : _a.content;
|
|
35
30
|
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
36
31
|
return child;
|
|
37
32
|
}
|
|
38
33
|
};
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
exports.getBinaryNodeChildBuffer = getBinaryNodeChildBuffer;
|
|
35
|
+
const getBinaryNodeChildString = (node, childTag) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const child = (_a = (0, exports.getBinaryNodeChild)(node, childTag)) === null || _a === void 0 ? void 0 : _a.content;
|
|
41
38
|
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
42
39
|
return Buffer.from(child).toString('utf-8');
|
|
43
40
|
}
|
|
@@ -45,42 +42,42 @@ export const getBinaryNodeChildString = (node, childTag) => {
|
|
|
45
42
|
return child;
|
|
46
43
|
}
|
|
47
44
|
};
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
exports.getBinaryNodeChildString = getBinaryNodeChildString;
|
|
46
|
+
const getBinaryNodeChildUInt = (node, childTag, length) => {
|
|
47
|
+
const buff = (0, exports.getBinaryNodeChildBuffer)(node, childTag);
|
|
50
48
|
if (buff) {
|
|
51
49
|
return bufferToUInt(buff, length);
|
|
52
50
|
}
|
|
53
51
|
};
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
exports.getBinaryNodeChildUInt = getBinaryNodeChildUInt;
|
|
53
|
+
const assertNodeErrorFree = (node) => {
|
|
54
|
+
const errNode = (0, exports.getBinaryNodeChild)(node, 'error');
|
|
56
55
|
if (errNode) {
|
|
57
|
-
throw new Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code });
|
|
56
|
+
throw new boom_1.Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code });
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
exports.assertNodeErrorFree = assertNodeErrorFree;
|
|
60
|
+
const reduceBinaryNodeToDictionary = (node, tag) => {
|
|
61
|
+
const nodes = (0, exports.getBinaryNodeChildren)(node, tag);
|
|
62
62
|
const dict = nodes.reduce((dict, { attrs }) => {
|
|
63
|
-
|
|
64
|
-
dict[attrs.name] = attrs.value || attrs.config_value;
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
dict[attrs.config_code] = attrs.value || attrs.config_value;
|
|
68
|
-
}
|
|
63
|
+
dict[attrs.name || attrs.config_code] = attrs.value || attrs.config_value;
|
|
69
64
|
return dict;
|
|
70
65
|
}, {});
|
|
71
66
|
return dict;
|
|
72
67
|
};
|
|
73
|
-
|
|
68
|
+
exports.reduceBinaryNodeToDictionary = reduceBinaryNodeToDictionary;
|
|
69
|
+
const getBinaryNodeMessages = ({ content }) => {
|
|
74
70
|
const msgs = [];
|
|
75
71
|
if (Array.isArray(content)) {
|
|
76
72
|
for (const item of content) {
|
|
77
73
|
if (item.tag === 'message') {
|
|
78
|
-
msgs.push(proto.WebMessageInfo.decode(item.content)
|
|
74
|
+
msgs.push(WAProto_1.proto.WebMessageInfo.decode(item.content));
|
|
79
75
|
}
|
|
80
76
|
}
|
|
81
77
|
}
|
|
82
78
|
return msgs;
|
|
83
79
|
};
|
|
80
|
+
exports.getBinaryNodeMessages = getBinaryNodeMessages;
|
|
84
81
|
function bufferToUInt(e, t) {
|
|
85
82
|
let a = 0;
|
|
86
83
|
for (let i = 0; i < t; i++) {
|
|
@@ -89,7 +86,7 @@ function bufferToUInt(e, t) {
|
|
|
89
86
|
return a;
|
|
90
87
|
}
|
|
91
88
|
const tabs = (n) => '\t'.repeat(n);
|
|
92
|
-
|
|
89
|
+
function binaryNodeToString(node, i = 0) {
|
|
93
90
|
if (!node) {
|
|
94
91
|
return node;
|
|
95
92
|
}
|
|
@@ -100,7 +97,7 @@ export function binaryNodeToString(node, i = 0) {
|
|
|
100
97
|
return tabs(i) + Buffer.from(node).toString('hex');
|
|
101
98
|
}
|
|
102
99
|
if (Array.isArray(node)) {
|
|
103
|
-
return node.map(x => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n');
|
|
100
|
+
return node.map((x) => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n');
|
|
104
101
|
}
|
|
105
102
|
const children = binaryNodeToString(node.content, i + 1);
|
|
106
103
|
const tag = `<${node.tag} ${Object.entries(node.attrs || {})
|
|
@@ -110,4 +107,4 @@ export function binaryNodeToString(node, i = 0) {
|
|
|
110
107
|
const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
|
|
111
108
|
return tag + content;
|
|
112
109
|
}
|
|
113
|
-
|
|
110
|
+
exports.binaryNodeToString = binaryNodeToString;
|
package/lib/WABinary/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export * from './encode
|
|
2
|
-
export * from './decode
|
|
3
|
-
export * from './generic-utils
|
|
4
|
-
export * from './jid-utils
|
|
5
|
-
export * from './types
|
|
6
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from './encode';
|
|
2
|
+
export * from './decode';
|
|
3
|
+
export * from './generic-utils';
|
|
4
|
+
export * from './jid-utils';
|
|
5
|
+
export * from './types';
|
package/lib/WABinary/index.js
CHANGED
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./encode"), exports);
|
|
18
|
+
__exportStar(require("./decode"), exports);
|
|
19
|
+
__exportStar(require("./generic-utils"), exports);
|
|
20
|
+
__exportStar(require("./jid-utils"), exports);
|
|
21
|
+
__exportStar(require("./types"), exports);
|
|
@@ -3,46 +3,29 @@ export declare const OFFICIAL_BIZ_JID = "16505361212@c.us";
|
|
|
3
3
|
export declare const SERVER_JID = "server@c.us";
|
|
4
4
|
export declare const PSA_WID = "0@c.us";
|
|
5
5
|
export declare const STORIES_JID = "status@broadcast";
|
|
6
|
-
export
|
|
7
|
-
export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call' | 'lid' | 'newsletter' | 'bot' | 'hosted' | 'hosted.lid';
|
|
8
|
-
export declare enum WAJIDDomains {
|
|
9
|
-
WHATSAPP = 0,
|
|
10
|
-
LID = 1,
|
|
11
|
-
HOSTED = 128,
|
|
12
|
-
HOSTED_LID = 129
|
|
13
|
-
}
|
|
6
|
+
export type JidServer = 'c.us' | 'g.us' | 'broadcast' | 's.whatsapp.net' | 'call' | 'lid';
|
|
14
7
|
export type JidWithDevice = {
|
|
15
8
|
user: string;
|
|
16
9
|
device?: number;
|
|
17
10
|
};
|
|
18
11
|
export type FullJid = JidWithDevice & {
|
|
19
|
-
server: JidServer;
|
|
12
|
+
server: JidServer | string;
|
|
20
13
|
domainType?: number;
|
|
21
14
|
};
|
|
22
|
-
export declare const getServerFromDomainType: (initialServer: string, domainType?: WAJIDDomains) => JidServer;
|
|
23
15
|
export declare const jidEncode: (user: string | number | null, server: JidServer, device?: number, agent?: number) => string;
|
|
24
16
|
export declare const jidDecode: (jid: string | undefined) => FullJid | undefined;
|
|
25
17
|
/** is the jid a user */
|
|
26
18
|
export declare const areJidsSameUser: (jid1: string | undefined, jid2: string | undefined) => boolean;
|
|
27
|
-
/** is the jid
|
|
28
|
-
export declare const
|
|
29
|
-
/** is the jid a
|
|
30
|
-
export declare const isPnUser: (jid: string | undefined) => boolean | undefined;
|
|
31
|
-
/** is the jid a LID */
|
|
19
|
+
/** is the jid a user */
|
|
20
|
+
export declare const isJidUser: (jid: string | undefined) => boolean | undefined;
|
|
21
|
+
/** is the jid a group */
|
|
32
22
|
export declare const isLidUser: (jid: string | undefined) => boolean | undefined;
|
|
33
23
|
/** is the jid a broadcast */
|
|
34
24
|
export declare const isJidBroadcast: (jid: string | undefined) => boolean | undefined;
|
|
35
25
|
/** is the jid a group */
|
|
36
26
|
export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
|
|
37
27
|
/** is the jid the status broadcast */
|
|
38
|
-
export declare const isJidStatusBroadcast: (jid: string) =>
|
|
28
|
+
export declare const isJidStatusBroadcast: (jid: string) => boolean;
|
|
39
29
|
/** is the jid a newsletter */
|
|
40
30
|
export declare const isJidNewsletter: (jid: string | undefined) => boolean | undefined;
|
|
41
|
-
/** is the jid a hosted PN */
|
|
42
|
-
export declare const isHostedPnUser: (jid: string | undefined) => boolean | undefined;
|
|
43
|
-
/** is the jid a hosted LID */
|
|
44
|
-
export declare const isHostedLidUser: (jid: string | undefined) => boolean | undefined;
|
|
45
|
-
export declare const isJidBot: (jid: string | undefined) => boolean | "" | undefined;
|
|
46
31
|
export declare const jidNormalizedUser: (jid: string | undefined) => string;
|
|
47
|
-
export declare const transferDevice: (fromJid: string, toJid: string) => string;
|
|
48
|
-
//# sourceMappingURL=jid-utils.d.ts.map
|