lordceaser-baileys 2.0.1 → 2.0.2
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/WAProto/index.js +136901 -78899
- 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 +17 -1
- package/lib/Defaults/baileys-version.json +3 -0
- package/lib/Defaults/index.d.ts +15 -37
- package/lib/Defaults/index.js +60 -81
- 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 +100 -147
- package/lib/Socket/business.js +43 -162
- package/lib/Socket/chats.d.ts +41 -85
- package/lib/Socket/chats.js +321 -569
- package/lib/Socket/groups.d.ts +57 -103
- package/lib/Socket/groups.js +84 -116
- package/lib/Socket/index.d.ts +106 -194
- package/lib/Socket/index.js +9 -11
- package/lib/Socket/messages-recv.d.ts +89 -134
- package/lib/Socket/messages-recv.js +475 -1275
- package/lib/Socket/messages-send.d.ts +97 -141
- package/lib/Socket/messages-send.js +633 -691
- package/lib/Socket/newsletter.d.ts +74 -112
- package/lib/Socket/newsletter.js +202 -147
- package/lib/Socket/registration.d.ts +264 -0
- package/lib/Socket/registration.js +166 -0
- package/lib/Socket/socket.d.ts +19 -34
- package/lib/Socket/socket.js +219 -547
- package/lib/Socket/usync.d.ts +37 -0
- package/lib/Socket/usync.js +70 -0
- 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 +431 -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 +11 -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 +8 -25
- 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 +204 -91
- package/lib/Types/Message.js +9 -11
- package/lib/Types/Newsletter.d.ts +92 -0
- package/lib/Types/Newsletter.js +32 -0
- 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 +24 -44
- 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/USync.d.ts +2 -3
- package/lib/Types/USync.js +2 -2
- package/lib/Types/index.d.ts +16 -16
- package/lib/Types/index.js +31 -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 +3 -4
- package/lib/Utils/business.js +69 -66
- package/lib/Utils/c4-compat.js +0 -8
- package/lib/Utils/chat-utils.d.ts +17 -47
- package/lib/Utils/chat-utils.js +237 -364
- package/lib/Utils/crypto.d.ts +21 -18
- package/lib/Utils/crypto.js +125 -44
- package/lib/Utils/decode-wa-message.d.ts +8 -38
- package/lib/Utils/decode-wa-message.js +90 -173
- package/lib/Utils/event-buffer.d.ts +8 -9
- package/lib/Utils/event-buffer.js +71 -176
- package/lib/Utils/generics.d.ts +22 -26
- package/lib/Utils/generics.js +175 -166
- 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 +34 -22
- package/lib/Utils/link-preview.d.ts +5 -5
- package/lib/Utils/link-preview.js +24 -16
- package/lib/Utils/logger.d.ts +1 -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 +0 -2
- package/lib/Utils/make-mutex.js +34 -24
- package/lib/Utils/messages-media.d.ts +45 -65
- package/lib/Utils/messages-media.js +358 -425
- package/lib/Utils/messages.d.ts +18 -32
- package/lib/Utils/messages.js +720 -392
- package/lib/Utils/noise-handler.d.ts +13 -13
- package/lib/Utils/noise-handler.js +108 -149
- package/lib/Utils/process-message.d.ts +11 -30
- package/lib/Utils/process-message.js +166 -423
- package/lib/Utils/signal.d.ts +6 -20
- package/lib/Utils/signal.js +65 -107
- package/lib/Utils/use-multi-file-auth-state.d.ts +1 -2
- package/lib/Utils/use-multi-file-auth-state.js +103 -57
- package/lib/Utils/use-single-file-auth-state.d.ts +12 -0
- package/lib/Utils/use-single-file-auth-state.js +76 -0
- 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 +3 -4
- package/lib/WABinary/decode.js +53 -51
- package/lib/WABinary/encode.d.ts +1 -2
- package/lib/WABinary/encode.js +44 -12
- package/lib/WABinary/generic-utils.d.ts +6 -7
- 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 +7 -24
- package/lib/WABinary/jid-utils.js +40 -74
- package/lib/WABinary/types.d.ts +1 -2
- package/lib/WABinary/types.js +2 -2
- package/lib/WAM/BinaryInfo.d.ts +1 -2
- 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 +2 -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/WAUSync/Protocols/USyncContactProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +13 -33
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +14 -11
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +12 -9
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +2 -3
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +13 -9
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +3 -4
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +22 -20
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +3 -5
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +8 -13
- package/lib/WAUSync/Protocols/index.d.ts +4 -6
- package/lib/WAUSync/Protocols/index.js +20 -6
- package/lib/WAUSync/USyncQuery.d.ts +4 -6
- package/lib/WAUSync/USyncQuery.js +35 -44
- package/lib/WAUSync/USyncUser.d.ts +4 -11
- package/lib/WAUSync/USyncUser.js +5 -10
- package/lib/WAUSync/index.d.ts +3 -4
- package/lib/WAUSync/index.js +19 -4
- package/lib/index.js +31 -13
- package/package.json +20 -11
- package/WAProto/GenerateStatics.sh +0 -3
- package/WAProto/WAProto.proto +0 -5479
- package/WAProto/fix-imports.js +0 -85
- package/WAProto/index.d.ts +0 -14017
- 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.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +0 -1
- 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.map +0 -1
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +0 -1
- package/lib/WAUSync/Protocols/index.d.ts.map +0 -1
- package/lib/WAUSync/Protocols/index.js.map +0 -1
- package/lib/WAUSync/USyncQuery.d.ts.map +0 -1
- package/lib/WAUSync/USyncQuery.js.map +0 -1
- package/lib/WAUSync/USyncUser.d.ts.map +0 -1
- package/lib/WAUSync/USyncUser.js.map +0 -1
- package/lib/WAUSync/index.d.ts.map +0 -1
- package/lib/WAUSync/index.js.map +0 -1
- package/lib/index.d.ts +0 -12
- 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,6 @@
|
|
|
1
|
-
import type { BinaryNode, BinaryNodeCodingOptions } from './types
|
|
2
|
-
export declare const decompressingIfRequired: (buffer: Buffer) =>
|
|
1
|
+
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
2
|
+
export declare const decompressingIfRequired: (buffer: Buffer) => Buffer;
|
|
3
3
|
export declare const decodeDecompressedBinaryNode: (buffer: Buffer, opts: Pick<BinaryNodeCodingOptions, "DOUBLE_BYTE_TOKENS" | "SINGLE_BYTE_TOKENS" | "TAGS">, indexRef?: {
|
|
4
4
|
index: number;
|
|
5
5
|
}) => BinaryNode;
|
|
6
|
-
export declare const decodeBinaryNode: (buff: Buffer) =>
|
|
7
|
-
//# sourceMappingURL=decode.d.ts.map
|
|
6
|
+
export declare const decodeBinaryNode: (buff: Buffer) => BinaryNode;
|
package/lib/WABinary/decode.js
CHANGED
|
@@ -1,19 +1,55 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.decodeBinaryNode = exports.decodeDecompressedBinaryNode = exports.decompressingIfRequired = void 0;
|
|
37
|
+
const util_1 = require("util");
|
|
38
|
+
const zlib_1 = require("zlib");
|
|
39
|
+
const constants = __importStar(require("./constants"));
|
|
40
|
+
const jid_utils_1 = require("./jid-utils");
|
|
41
|
+
const inflatePromise = (0, util_1.promisify)(zlib_1.inflate);
|
|
42
|
+
const decompressingIfRequired = async (buffer) => {
|
|
7
43
|
if (2 & buffer.readUInt8()) {
|
|
8
44
|
buffer = await inflatePromise(buffer.slice(1));
|
|
9
45
|
}
|
|
10
|
-
else {
|
|
11
|
-
// nodes with no compression have a 0x00 prefix, we remove that
|
|
46
|
+
else { // nodes with no compression have a 0x00 prefix, we remove that
|
|
12
47
|
buffer = buffer.slice(1);
|
|
13
48
|
}
|
|
14
49
|
return buffer;
|
|
15
50
|
};
|
|
16
|
-
|
|
51
|
+
exports.decompressingIfRequired = decompressingIfRequired;
|
|
52
|
+
const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0 }) => {
|
|
17
53
|
const { DOUBLE_BYTE_TOKENS, SINGLE_BYTE_TOKENS, TAGS } = opts;
|
|
18
54
|
const checkEOS = (length) => {
|
|
19
55
|
if (indexRef.index + length > buffer.length) {
|
|
@@ -120,41 +156,10 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
120
156
|
throw new Error('invalid jid pair: ' + i + ', ' + j);
|
|
121
157
|
};
|
|
122
158
|
const readAdJid = () => {
|
|
123
|
-
const
|
|
124
|
-
const domainType = Number(rawDomainType);
|
|
159
|
+
const agent = readByte();
|
|
125
160
|
const device = readByte();
|
|
126
161
|
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}`;
|
|
162
|
+
return (0, jid_utils_1.jidEncode)(user, agent === 0 ? 's.whatsapp.net' : 'lid', device);
|
|
158
163
|
};
|
|
159
164
|
const readString = (tag) => {
|
|
160
165
|
if (tag >= 1 && tag < SINGLE_BYTE_TOKENS.length) {
|
|
@@ -176,10 +181,6 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
176
181
|
return readStringFromChars(readInt(4));
|
|
177
182
|
case TAGS.JID_PAIR:
|
|
178
183
|
return readJidPair();
|
|
179
|
-
case TAGS.FB_JID:
|
|
180
|
-
return readFbJid();
|
|
181
|
-
case TAGS.INTEROP_JID:
|
|
182
|
-
return readInteropJid();
|
|
183
184
|
case TAGS.AD_JID:
|
|
184
185
|
return readAdJid();
|
|
185
186
|
case TAGS.HEX_8:
|
|
@@ -193,7 +194,7 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
193
194
|
const items = [];
|
|
194
195
|
const size = readListSize(tag);
|
|
195
196
|
for (let i = 0; i < size; i++) {
|
|
196
|
-
items.push(decodeDecompressedBinaryNode(buffer, opts, indexRef));
|
|
197
|
+
items.push((0, exports.decodeDecompressedBinaryNode)(buffer, opts, indexRef));
|
|
197
198
|
}
|
|
198
199
|
return items;
|
|
199
200
|
};
|
|
@@ -255,8 +256,9 @@ export const decodeDecompressedBinaryNode = (buffer, opts, indexRef = { index: 0
|
|
|
255
256
|
content: data
|
|
256
257
|
};
|
|
257
258
|
};
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
259
|
+
exports.decodeDecompressedBinaryNode = decodeDecompressedBinaryNode;
|
|
260
|
+
const decodeBinaryNode = async (buff) => {
|
|
261
|
+
const decompBuff = await (0, exports.decompressingIfRequired)(buff);
|
|
262
|
+
return (0, exports.decodeDecompressedBinaryNode)(decompBuff, constants);
|
|
261
263
|
};
|
|
262
|
-
|
|
264
|
+
exports.decodeBinaryNode = decodeBinaryNode;
|
package/lib/WABinary/encode.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import type { BinaryNode, BinaryNodeCodingOptions } from './types
|
|
1
|
+
import type { BinaryNode, BinaryNodeCodingOptions } from './types';
|
|
2
2
|
export declare const encodeBinaryNode: (node: BinaryNode, opts?: Pick<BinaryNodeCodingOptions, "TAGS" | "TOKEN_MAP">, buffer?: number[]) => Buffer;
|
|
3
|
-
//# sourceMappingURL=encode.d.ts.map
|
package/lib/WABinary/encode.js
CHANGED
|
@@ -1,9 +1,46 @@
|
|
|
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 () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.encodeBinaryNode = void 0;
|
|
37
|
+
const constants = __importStar(require("./constants"));
|
|
38
|
+
const jid_utils_1 = require("./jid-utils");
|
|
39
|
+
const encodeBinaryNode = (node, opts = constants, buffer = [0]) => {
|
|
4
40
|
const encoded = encodeBinaryNodeInner(node, opts, buffer);
|
|
5
41
|
return Buffer.from(encoded);
|
|
6
42
|
};
|
|
43
|
+
exports.encodeBinaryNode = encodeBinaryNode;
|
|
7
44
|
const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
8
45
|
const { TAGS, TOKEN_MAP } = opts;
|
|
9
46
|
const pushByte = (value) => buffer.push(value & 0xff);
|
|
@@ -21,7 +58,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
21
58
|
const pushInt16 = (value) => {
|
|
22
59
|
pushBytes([(value >> 8) & 0xff, value & 0xff]);
|
|
23
60
|
};
|
|
24
|
-
const pushInt20 = (value) => pushBytes([(value >> 16) & 0x0f, (value >> 8) & 0xff, value & 0xff]);
|
|
61
|
+
const pushInt20 = (value) => (pushBytes([(value >> 16) & 0x0f, (value >> 8) & 0xff, value & 0xff]));
|
|
25
62
|
const writeByteLength = (length) => {
|
|
26
63
|
if (length >= 4294967296) {
|
|
27
64
|
throw new Error('string too large to encode: ' + length);
|
|
@@ -144,10 +181,6 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
144
181
|
pushByte(TAGS.LIST_EMPTY);
|
|
145
182
|
return;
|
|
146
183
|
}
|
|
147
|
-
if (str === '') {
|
|
148
|
-
writeStringRaw(str);
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
184
|
const tokenIndex = TOKEN_MAP[str];
|
|
152
185
|
if (tokenIndex) {
|
|
153
186
|
if (typeof tokenIndex.dict === 'number') {
|
|
@@ -161,8 +194,8 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
161
194
|
else if (isHex(str)) {
|
|
162
195
|
writePackedBytes(str, 'hex');
|
|
163
196
|
}
|
|
164
|
-
else {
|
|
165
|
-
const decodedJid = jidDecode(str);
|
|
197
|
+
else if (str) {
|
|
198
|
+
const decodedJid = (0, jid_utils_1.jidDecode)(str);
|
|
166
199
|
if (decodedJid) {
|
|
167
200
|
writeJid(decodedJid);
|
|
168
201
|
}
|
|
@@ -186,7 +219,7 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
186
219
|
if (!tag) {
|
|
187
220
|
throw new Error('Invalid node: tag cannot be undefined');
|
|
188
221
|
}
|
|
189
|
-
const validAttributes = Object.keys(attrs || {}).filter(k => typeof attrs[k] !== 'undefined' && attrs[k] !== null);
|
|
222
|
+
const validAttributes = Object.keys(attrs || {}).filter(k => (typeof attrs[k] !== 'undefined' && attrs[k] !== null));
|
|
190
223
|
writeListStart(2 * validAttributes.length + 1 + (typeof content !== 'undefined' ? 1 : 0));
|
|
191
224
|
writeString(tag);
|
|
192
225
|
for (const key of validAttributes) {
|
|
@@ -217,4 +250,3 @@ const encodeBinaryNodeInner = ({ tag, attrs, content }, opts, buffer) => {
|
|
|
217
250
|
}
|
|
218
251
|
return buffer;
|
|
219
252
|
};
|
|
220
|
-
//# sourceMappingURL=encode.js.map
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { proto } from '../../WAProto
|
|
2
|
-
import {
|
|
1
|
+
import { proto } from '../../WAProto';
|
|
2
|
+
import { BinaryNode } from './types';
|
|
3
3
|
export declare const getBinaryNodeChildren: (node: BinaryNode | undefined, childTag: string) => BinaryNode[];
|
|
4
|
-
export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
|
|
5
4
|
export declare const getAllBinaryNodeChildren: ({ content }: BinaryNode) => BinaryNode[];
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
5
|
+
export declare const getBinaryNodeChild: (node: BinaryNode | undefined, childTag: string) => BinaryNode | undefined;
|
|
6
|
+
export declare const getBinaryNodeChildBuffer: (node: BinaryNode | undefined, childTag: string) => string | Uint8Array<ArrayBufferLike> | BinaryNode[] | undefined;
|
|
7
|
+
export declare const getBinaryNodeChildString: (node: BinaryNode | undefined, childTag: string) => any;
|
|
8
8
|
export declare const getBinaryNodeChildUInt: (node: BinaryNode, childTag: string, length: number) => number | undefined;
|
|
9
9
|
export declare const assertNodeErrorFree: (node: BinaryNode) => void;
|
|
10
10
|
export declare const reduceBinaryNodeToDictionary: (node: BinaryNode, tag: string) => {
|
|
11
11
|
[_: string]: string;
|
|
12
12
|
};
|
|
13
13
|
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
|
|
14
|
+
export declare function binaryNodeToString(node: BinaryNode | BinaryNode['content'], i?: number): any;
|
|
@@ -1,43 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBinaryNodeMessages = exports.reduceBinaryNodeToDictionary = exports.assertNodeErrorFree = exports.getBinaryNodeChildUInt = exports.getBinaryNodeChildString = exports.getBinaryNodeChildBuffer = exports.getBinaryNodeChild = exports.getAllBinaryNodeChildren = exports.getBinaryNodeChildren = void 0;
|
|
4
|
+
exports.binaryNodeToString = binaryNodeToString;
|
|
5
|
+
const boom_1 = require("@hapi/boom");
|
|
6
|
+
const WAProto_1 = require("../../WAProto");
|
|
4
7
|
// 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);
|
|
8
|
+
const getBinaryNodeChildren = (node, childTag) => {
|
|
9
|
+
if (Array.isArray(node === null || node === void 0 ? void 0 : node.content)) {
|
|
10
|
+
return node.content.filter(item => item.tag === childTag);
|
|
20
11
|
}
|
|
21
|
-
|
|
22
|
-
return index.get(childTag) || [];
|
|
23
|
-
};
|
|
24
|
-
export const getBinaryNodeChild = (node, childTag) => {
|
|
25
|
-
return getBinaryNodeChildren(node, childTag)[0];
|
|
12
|
+
return [];
|
|
26
13
|
};
|
|
27
|
-
|
|
14
|
+
exports.getBinaryNodeChildren = getBinaryNodeChildren;
|
|
15
|
+
const getAllBinaryNodeChildren = ({ content }) => {
|
|
28
16
|
if (Array.isArray(content)) {
|
|
29
17
|
return content;
|
|
30
18
|
}
|
|
31
19
|
return [];
|
|
32
20
|
};
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
exports.getAllBinaryNodeChildren = getAllBinaryNodeChildren;
|
|
22
|
+
const getBinaryNodeChild = (node, childTag) => {
|
|
23
|
+
if (Array.isArray(node === null || node === void 0 ? void 0 : node.content)) {
|
|
24
|
+
return node === null || node === void 0 ? void 0 : node.content.find(item => item.tag === childTag);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.getBinaryNodeChild = getBinaryNodeChild;
|
|
28
|
+
const getBinaryNodeChildBuffer = (node, childTag) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const child = (_a = (0, exports.getBinaryNodeChild)(node, childTag)) === null || _a === void 0 ? void 0 : _a.content;
|
|
35
31
|
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
36
32
|
return child;
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
|
-
|
|
40
|
-
|
|
35
|
+
exports.getBinaryNodeChildBuffer = getBinaryNodeChildBuffer;
|
|
36
|
+
const getBinaryNodeChildString = (node, childTag) => {
|
|
37
|
+
var _a;
|
|
38
|
+
const child = (_a = (0, exports.getBinaryNodeChild)(node, childTag)) === null || _a === void 0 ? void 0 : _a.content;
|
|
41
39
|
if (Buffer.isBuffer(child) || child instanceof Uint8Array) {
|
|
42
40
|
return Buffer.from(child).toString('utf-8');
|
|
43
41
|
}
|
|
@@ -45,42 +43,42 @@ export const getBinaryNodeChildString = (node, childTag) => {
|
|
|
45
43
|
return child;
|
|
46
44
|
}
|
|
47
45
|
};
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
exports.getBinaryNodeChildString = getBinaryNodeChildString;
|
|
47
|
+
const getBinaryNodeChildUInt = (node, childTag, length) => {
|
|
48
|
+
const buff = (0, exports.getBinaryNodeChildBuffer)(node, childTag);
|
|
50
49
|
if (buff) {
|
|
51
50
|
return bufferToUInt(buff, length);
|
|
52
51
|
}
|
|
53
52
|
};
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
exports.getBinaryNodeChildUInt = getBinaryNodeChildUInt;
|
|
54
|
+
const assertNodeErrorFree = (node) => {
|
|
55
|
+
const errNode = (0, exports.getBinaryNodeChild)(node, 'error');
|
|
56
56
|
if (errNode) {
|
|
57
|
-
throw new Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code });
|
|
57
|
+
throw new boom_1.Boom(errNode.attrs.text || 'Unknown error', { data: +errNode.attrs.code });
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
exports.assertNodeErrorFree = assertNodeErrorFree;
|
|
61
|
+
const reduceBinaryNodeToDictionary = (node, tag) => {
|
|
62
|
+
const nodes = (0, exports.getBinaryNodeChildren)(node, tag);
|
|
62
63
|
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
|
-
}
|
|
64
|
+
dict[attrs.name || attrs.config_code] = attrs.value || attrs.config_value;
|
|
69
65
|
return dict;
|
|
70
66
|
}, {});
|
|
71
67
|
return dict;
|
|
72
68
|
};
|
|
73
|
-
|
|
69
|
+
exports.reduceBinaryNodeToDictionary = reduceBinaryNodeToDictionary;
|
|
70
|
+
const getBinaryNodeMessages = ({ content }) => {
|
|
74
71
|
const msgs = [];
|
|
75
72
|
if (Array.isArray(content)) {
|
|
76
73
|
for (const item of content) {
|
|
77
74
|
if (item.tag === 'message') {
|
|
78
|
-
msgs.push(proto.WebMessageInfo.decode(item.content)
|
|
75
|
+
msgs.push(WAProto_1.proto.WebMessageInfo.decode(item.content));
|
|
79
76
|
}
|
|
80
77
|
}
|
|
81
78
|
}
|
|
82
79
|
return msgs;
|
|
83
80
|
};
|
|
81
|
+
exports.getBinaryNodeMessages = getBinaryNodeMessages;
|
|
84
82
|
function bufferToUInt(e, t) {
|
|
85
83
|
let a = 0;
|
|
86
84
|
for (let i = 0; i < t; i++) {
|
|
@@ -89,7 +87,7 @@ function bufferToUInt(e, t) {
|
|
|
89
87
|
return a;
|
|
90
88
|
}
|
|
91
89
|
const tabs = (n) => '\t'.repeat(n);
|
|
92
|
-
|
|
90
|
+
function binaryNodeToString(node, i = 0) {
|
|
93
91
|
if (!node) {
|
|
94
92
|
return node;
|
|
95
93
|
}
|
|
@@ -100,7 +98,7 @@ export function binaryNodeToString(node, i = 0) {
|
|
|
100
98
|
return tabs(i) + Buffer.from(node).toString('hex');
|
|
101
99
|
}
|
|
102
100
|
if (Array.isArray(node)) {
|
|
103
|
-
return node.map(x => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n');
|
|
101
|
+
return node.map((x) => tabs(i + 1) + binaryNodeToString(x, i + 1)).join('\n');
|
|
104
102
|
}
|
|
105
103
|
const children = binaryNodeToString(node.content, i + 1);
|
|
106
104
|
const tag = `<${node.tag} ${Object.entries(node.attrs || {})
|
|
@@ -110,4 +108,3 @@ export function binaryNodeToString(node, i = 0) {
|
|
|
110
108
|
const content = children ? `>\n${children}\n${tabs(i)}</${node.tag}>` : '/>';
|
|
111
109
|
return tag + content;
|
|
112
110
|
}
|
|
113
|
-
//# sourceMappingURL=generic-utils.js.map
|
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,32 +3,22 @@ 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' | 'newsletter';
|
|
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;
|
|
@@ -36,13 +26,6 @@ export declare const isJidBroadcast: (jid: string | undefined) => boolean | unde
|
|
|
36
26
|
export declare const isJidGroup: (jid: string | undefined) => boolean | undefined;
|
|
37
27
|
/** is the jid the status broadcast */
|
|
38
28
|
export declare const isJidStatusBroadcast: (jid: string) => jid is "status@broadcast";
|
|
39
|
-
/** is the jid
|
|
40
|
-
export declare const
|
|
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;
|
|
29
|
+
/** is the jid the newsletter */
|
|
30
|
+
export declare const isJidNewsLetter: (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
|