@bellachu/xteambail 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -0
- package/WAProto/GenerateStatics.sh +3 -0
- package/WAProto/WAProto.proto +5479 -0
- package/WAProto/fix-imports.js +38 -0
- package/WAProto/index.d.ts +14017 -0
- package/WAProto/index.js +2213 -0
- package/engine-requirements.js +10 -0
- package/lib/Defaults/index.d.ts +75 -0
- package/lib/Defaults/index.d.ts.map +1 -0
- package/lib/Defaults/index.js +139 -0
- package/lib/Defaults/index.js.map +1 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
- package/lib/Signal/Group/ciphertext-message.d.ts.map +1 -0
- package/lib/Signal/Group/ciphertext-message.js +19 -0
- package/lib/Signal/Group/ciphertext-message.js.map +1 -0
- package/lib/Signal/Group/group-session-builder.d.ts +15 -0
- package/lib/Signal/Group/group-session-builder.d.ts.map +1 -0
- package/lib/Signal/Group/group-session-builder.js +38 -0
- package/lib/Signal/Group/group-session-builder.js.map +1 -0
- package/lib/Signal/Group/group_cipher.d.ts +17 -0
- package/lib/Signal/Group/group_cipher.d.ts.map +1 -0
- package/lib/Signal/Group/group_cipher.js +87 -0
- package/lib/Signal/Group/group_cipher.js.map +1 -0
- package/lib/Signal/Group/index.d.ts +12 -0
- package/lib/Signal/Group/index.d.ts.map +1 -0
- package/lib/Signal/Group/index.js +79 -0
- package/lib/Signal/Group/index.js.map +1 -0
- package/lib/Signal/Group/keyhelper.d.ts +11 -0
- package/lib/Signal/Group/keyhelper.d.ts.map +1 -0
- package/lib/Signal/Group/keyhelper.js +27 -0
- package/lib/Signal/Group/keyhelper.js.map +1 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
- package/lib/Signal/Group/sender-chain-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-chain-key.js +33 -0
- package/lib/Signal/Group/sender-chain-key.js.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-distribution-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-message.d.ts +19 -0
- package/lib/Signal/Group/sender-key-message.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-message.js +68 -0
- package/lib/Signal/Group/sender-key-message.js.map +1 -0
- package/lib/Signal/Group/sender-key-name.d.ts +18 -0
- package/lib/Signal/Group/sender-key-name.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-name.js +54 -0
- package/lib/Signal/Group/sender-key-name.js.map +1 -0
- package/lib/Signal/Group/sender-key-record.d.ts +31 -0
- package/lib/Signal/Group/sender-key-record.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-record.js +48 -0
- package/lib/Signal/Group/sender-key-record.js.map +1 -0
- package/lib/Signal/Group/sender-key-state.d.ts +39 -0
- package/lib/Signal/Group/sender-key-state.d.ts.map +1 -0
- package/lib/Signal/Group/sender-key-state.js +88 -0
- package/lib/Signal/Group/sender-key-state.js.map +1 -0
- package/lib/Signal/Group/sender-message-key.d.ts +12 -0
- package/lib/Signal/Group/sender-message-key.d.ts.map +1 -0
- package/lib/Signal/Group/sender-message-key.js +33 -0
- package/lib/Signal/Group/sender-message-key.js.map +1 -0
- package/lib/Signal/libsignal.d.ts +5 -0
- package/lib/Signal/libsignal.d.ts.map +1 -0
- package/lib/Signal/libsignal.js +575 -0
- package/lib/Signal/libsignal.js.map +1 -0
- package/lib/Signal/lid-mapping.d.ts +23 -0
- package/lib/Signal/lid-mapping.d.ts.map +1 -0
- package/lib/Signal/lid-mapping.js +309 -0
- package/lib/Signal/lid-mapping.js.map +1 -0
- package/lib/Socket/Client/index.d.ts +3 -0
- package/lib/Socket/Client/index.d.ts.map +1 -0
- package/lib/Socket/Client/index.js +27 -0
- package/lib/Socket/Client/index.js.map +1 -0
- package/lib/Socket/Client/types.d.ts +16 -0
- package/lib/Socket/Client/types.d.ts.map +1 -0
- package/lib/Socket/Client/types.js +18 -0
- package/lib/Socket/Client/types.js.map +1 -0
- package/lib/Socket/Client/websocket.d.ts +13 -0
- package/lib/Socket/Client/websocket.d.ts.map +1 -0
- package/lib/Socket/Client/websocket.js +62 -0
- package/lib/Socket/Client/websocket.js.map +1 -0
- package/lib/Socket/business.d.ts +217 -0
- package/lib/Socket/business.d.ts.map +1 -0
- package/lib/Socket/business.js +368 -0
- package/lib/Socket/business.js.map +1 -0
- package/lib/Socket/chats.d.ts +124 -0
- package/lib/Socket/chats.d.ts.map +1 -0
- package/lib/Socket/chats.js +1340 -0
- package/lib/Socket/chats.js.map +1 -0
- package/lib/Socket/communities.d.ts +273 -0
- package/lib/Socket/communities.d.ts.map +1 -0
- package/lib/Socket/communities.js +522 -0
- package/lib/Socket/communities.js.map +1 -0
- package/lib/Socket/groups.d.ts +161 -0
- package/lib/Socket/groups.d.ts.map +1 -0
- package/lib/Socket/groups.js +430 -0
- package/lib/Socket/groups.js.map +1 -0
- package/lib/Socket/index.d.ts +260 -0
- package/lib/Socket/index.d.ts.map +1 -0
- package/lib/Socket/index.js +11 -0
- package/lib/Socket/index.js.map +1 -0
- package/lib/Socket/luxu.js +422 -0
- package/lib/Socket/messages-recv.d.ts +203 -0
- package/lib/Socket/messages-recv.d.ts.map +1 -0
- package/lib/Socket/messages-recv.js +2374 -0
- package/lib/Socket/messages-recv.js.map +1 -0
- package/lib/Socket/messages-send.d.ts +199 -0
- package/lib/Socket/messages-send.d.ts.map +1 -0
- package/lib/Socket/messages-send.js +1502 -0
- package/lib/Socket/messages-send.js.map +1 -0
- package/lib/Socket/mex.d.ts +3 -0
- package/lib/Socket/mex.d.ts.map +1 -0
- package/lib/Socket/mex.js +55 -0
- package/lib/Socket/mex.js.map +1 -0
- package/lib/Socket/newsletter.d.ts +170 -0
- package/lib/Socket/newsletter.d.ts.map +1 -0
- package/lib/Socket/newsletter.js +238 -0
- package/lib/Socket/newsletter.js.map +1 -0
- package/lib/Socket/socket.d.ts +59 -0
- package/lib/Socket/socket.d.ts.map +1 -0
- package/lib/Socket/socket.js +1022 -0
- package/lib/Socket/socket.js.map +1 -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 +13 -0
- package/lib/Store/make-cache-manager-store.js +82 -0
- package/lib/Store/make-in-memory-store.d.ts +118 -0
- package/lib/Store/make-in-memory-store.js +429 -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 +117 -0
- package/lib/Types/Auth.d.ts.map +1 -0
- package/lib/Types/Auth.js +5 -0
- package/lib/Types/Auth.js.map +1 -0
- package/lib/Types/Bussines.d.ts +25 -0
- package/lib/Types/Bussines.d.ts.map +1 -0
- package/lib/Types/Bussines.js +5 -0
- package/lib/Types/Bussines.js.map +1 -0
- package/lib/Types/Call.d.ts +15 -0
- package/lib/Types/Call.d.ts.map +1 -0
- package/lib/Types/Call.js +5 -0
- package/lib/Types/Call.js.map +1 -0
- package/lib/Types/Chat.d.ts +124 -0
- package/lib/Types/Chat.d.ts.map +1 -0
- package/lib/Types/Chat.js +8 -0
- package/lib/Types/Chat.js.map +1 -0
- package/lib/Types/Contact.d.ts +26 -0
- package/lib/Types/Contact.d.ts.map +1 -0
- package/lib/Types/Contact.js +5 -0
- package/lib/Types/Contact.js.map +1 -0
- package/lib/Types/Events.d.ts +256 -0
- package/lib/Types/Events.d.ts.map +1 -0
- package/lib/Types/Events.js +3 -0
- package/lib/Types/Events.js.map +1 -0
- package/lib/Types/GroupMetadata.d.ts +71 -0
- package/lib/Types/GroupMetadata.d.ts.map +1 -0
- package/lib/Types/GroupMetadata.js +5 -0
- package/lib/Types/GroupMetadata.js.map +1 -0
- package/lib/Types/Label.d.ts +47 -0
- package/lib/Types/Label.d.ts.map +1 -0
- package/lib/Types/Label.js +31 -0
- package/lib/Types/Label.js.map +1 -0
- package/lib/Types/LabelAssociation.d.ts +30 -0
- package/lib/Types/LabelAssociation.d.ts.map +1 -0
- package/lib/Types/LabelAssociation.js +13 -0
- package/lib/Types/LabelAssociation.js.map +1 -0
- package/lib/Types/Message.d.ts +320 -0
- package/lib/Types/Message.d.ts.map +1 -0
- package/lib/Types/Message.js +23 -0
- package/lib/Types/Message.js.map +1 -0
- package/lib/Types/Mex.d.ts +141 -0
- package/lib/Types/Mex.d.ts.map +1 -0
- package/lib/Types/Mex.js +43 -0
- package/lib/Types/Mex.js.map +1 -0
- package/lib/Types/Product.d.ts +79 -0
- package/lib/Types/Product.d.ts.map +1 -0
- package/lib/Types/Product.js +5 -0
- package/lib/Types/Product.js.map +1 -0
- package/lib/Types/Signal.d.ts +87 -0
- package/lib/Types/Signal.d.ts.map +1 -0
- package/lib/Types/Signal.js +3 -0
- package/lib/Types/Signal.js.map +1 -0
- package/lib/Types/Socket.d.ts +136 -0
- package/lib/Types/Socket.d.ts.map +1 -0
- package/lib/Types/Socket.js +4 -0
- package/lib/Types/Socket.js.map +1 -0
- package/lib/Types/State.d.ts +97 -0
- package/lib/Types/State.d.ts.map +1 -0
- package/lib/Types/State.js +62 -0
- package/lib/Types/State.js.map +1 -0
- package/lib/Types/USync.d.ts +26 -0
- package/lib/Types/USync.d.ts.map +1 -0
- package/lib/Types/USync.js +3 -0
- package/lib/Types/USync.js.map +1 -0
- package/lib/Types/index.d.ts +65 -0
- package/lib/Types/index.d.ts.map +1 -0
- package/lib/Types/index.js +167 -0
- package/lib/Types/index.js.map +1 -0
- package/lib/Utils/auth-utils.d.ts +24 -0
- package/lib/Utils/auth-utils.d.ts.map +1 -0
- package/lib/Utils/auth-utils.js +332 -0
- package/lib/Utils/auth-utils.js.map +1 -0
- package/lib/Utils/browser-utils.d.ts +4 -0
- package/lib/Utils/browser-utils.d.ts.map +1 -0
- package/lib/Utils/browser-utils.js +35 -0
- package/lib/Utils/browser-utils.js.map +1 -0
- package/lib/Utils/business.d.ts +23 -0
- package/lib/Utils/business.d.ts.map +1 -0
- package/lib/Utils/business.js +247 -0
- package/lib/Utils/business.js.map +1 -0
- package/lib/Utils/chat-utils.d.ts +100 -0
- package/lib/Utils/chat-utils.d.ts.map +1 -0
- package/lib/Utils/chat-utils.js +971 -0
- package/lib/Utils/chat-utils.js.map +1 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
- package/lib/Utils/companion-reg-client-utils.d.ts.map +1 -0
- package/lib/Utils/companion-reg-client-utils.js +43 -0
- package/lib/Utils/companion-reg-client-utils.js.map +1 -0
- package/lib/Utils/crypto.d.ts +37 -0
- package/lib/Utils/crypto.d.ts.map +1 -0
- package/lib/Utils/crypto.js +160 -0
- package/lib/Utils/crypto.js.map +1 -0
- package/lib/Utils/decode-wa-message.d.ts +66 -0
- package/lib/Utils/decode-wa-message.d.ts.map +1 -0
- package/lib/Utils/decode-wa-message.js +380 -0
- package/lib/Utils/decode-wa-message.js.map +1 -0
- package/lib/Utils/event-buffer.d.ts +36 -0
- package/lib/Utils/event-buffer.d.ts.map +1 -0
- package/lib/Utils/event-buffer.js +666 -0
- package/lib/Utils/event-buffer.js.map +1 -0
- package/lib/Utils/generics.d.ts +91 -0
- package/lib/Utils/generics.d.ts.map +1 -0
- package/lib/Utils/generics.js +449 -0
- package/lib/Utils/generics.js.map +1 -0
- package/lib/Utils/history.d.ts +24 -0
- package/lib/Utils/history.d.ts.map +1 -0
- package/lib/Utils/history.js +160 -0
- package/lib/Utils/history.js.map +1 -0
- package/lib/Utils/identity-change-handler.d.ts +44 -0
- package/lib/Utils/identity-change-handler.d.ts.map +1 -0
- package/lib/Utils/identity-change-handler.js +94 -0
- package/lib/Utils/identity-change-handler.js.map +1 -0
- package/lib/Utils/index.d.ts +22 -0
- package/lib/Utils/index.d.ts.map +1 -0
- package/lib/Utils/index.js +236 -0
- package/lib/Utils/index.js.map +1 -0
- package/lib/Utils/link-preview.d.ts +21 -0
- package/lib/Utils/link-preview.d.ts.map +1 -0
- package/lib/Utils/link-preview.js +102 -0
- package/lib/Utils/link-preview.js.map +1 -0
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.d.ts.map +1 -0
- package/lib/Utils/logger.js +11 -0
- package/lib/Utils/logger.js.map +1 -0
- package/lib/Utils/lt-hash.d.ts +8 -0
- package/lib/Utils/lt-hash.d.ts.map +1 -0
- package/lib/Utils/lt-hash.js +14 -0
- package/lib/Utils/lt-hash.js.map +1 -0
- package/lib/Utils/make-mutex.d.ts +9 -0
- package/lib/Utils/make-mutex.d.ts.map +1 -0
- package/lib/Utils/make-mutex.js +43 -0
- package/lib/Utils/make-mutex.js.map +1 -0
- package/lib/Utils/message-retry-manager.d.ts +115 -0
- package/lib/Utils/message-retry-manager.d.ts.map +1 -0
- package/lib/Utils/message-retry-manager.js +283 -0
- package/lib/Utils/message-retry-manager.js.map +1 -0
- package/lib/Utils/messages-media.d.ts +133 -0
- package/lib/Utils/messages-media.d.ts.map +1 -0
- package/lib/Utils/messages-media.js +914 -0
- package/lib/Utils/messages-media.js.map +1 -0
- package/lib/Utils/messages.d.ts +91 -0
- package/lib/Utils/messages.d.ts.map +1 -0
- package/lib/Utils/messages.js +963 -0
- package/lib/Utils/messages.js.map +1 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.d.ts.map +1 -0
- package/lib/Utils/noise-handler.js +238 -0
- package/lib/Utils/noise-handler.js.map +1 -0
- package/lib/Utils/offline-node-processor.d.ts +17 -0
- package/lib/Utils/offline-node-processor.d.ts.map +1 -0
- package/lib/Utils/offline-node-processor.js +54 -0
- package/lib/Utils/offline-node-processor.js.map +1 -0
- package/lib/Utils/pre-key-manager.d.ts +28 -0
- package/lib/Utils/pre-key-manager.d.ts.map +1 -0
- package/lib/Utils/pre-key-manager.js +109 -0
- package/lib/Utils/pre-key-manager.js.map +1 -0
- package/lib/Utils/process-message.d.ts +60 -0
- package/lib/Utils/process-message.d.ts.map +1 -0
- package/lib/Utils/process-message.js +710 -0
- package/lib/Utils/process-message.js.map +1 -0
- package/lib/Utils/reporting-utils.d.ts +11 -0
- package/lib/Utils/reporting-utils.d.ts.map +1 -0
- package/lib/Utils/reporting-utils.js +586 -0
- package/lib/Utils/reporting-utils.js.map +1 -0
- package/lib/Utils/signal.d.ts +47 -0
- package/lib/Utils/signal.d.ts.map +1 -0
- package/lib/Utils/signal.js +279 -0
- package/lib/Utils/signal.js.map +1 -0
- package/lib/Utils/stanza-ack.d.ts +11 -0
- package/lib/Utils/stanza-ack.d.ts.map +1 -0
- package/lib/Utils/stanza-ack.js +47 -0
- package/lib/Utils/stanza-ack.js.map +1 -0
- package/lib/Utils/sync-action-utils.d.ts +19 -0
- package/lib/Utils/sync-action-utils.d.ts.map +1 -0
- package/lib/Utils/sync-action-utils.js +61 -0
- package/lib/Utils/sync-action-utils.js.map +1 -0
- package/lib/Utils/tc-token-utils.d.ts +37 -0
- package/lib/Utils/tc-token-utils.d.ts.map +1 -0
- package/lib/Utils/tc-token-utils.js +176 -0
- package/lib/Utils/tc-token-utils.js.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts.map +1 -0
- package/lib/Utils/use-multi-file-auth-state.js +124 -0
- package/lib/Utils/use-multi-file-auth-state.js.map +1 -0
- package/lib/Utils/validate-connection.d.ts +11 -0
- package/lib/Utils/validate-connection.d.ts.map +1 -0
- package/lib/Utils/validate-connection.js +229 -0
- package/lib/Utils/validate-connection.js.map +1 -0
- package/lib/WABinary/constants.d.ts +28 -0
- package/lib/WABinary/constants.d.ts.map +1 -0
- package/lib/WABinary/constants.js +42 -0
- package/lib/WABinary/constants.js.map +1 -0
- package/lib/WABinary/decode.d.ts +7 -0
- package/lib/WABinary/decode.d.ts.map +1 -0
- package/lib/WABinary/decode.js +271 -0
- package/lib/WABinary/decode.js.map +1 -0
- package/lib/WABinary/encode.d.ts +3 -0
- package/lib/WABinary/encode.d.ts.map +1 -0
- package/lib/WABinary/encode.js +226 -0
- package/lib/WABinary/encode.js.map +1 -0
- package/lib/WABinary/generic-utils.d.ts +15 -0
- package/lib/WABinary/generic-utils.d.ts.map +1 -0
- package/lib/WABinary/generic-utils.js +219 -0
- package/lib/WABinary/generic-utils.js.map +1 -0
- package/lib/WABinary/index.d.ts +6 -0
- package/lib/WABinary/index.d.ts.map +1 -0
- package/lib/WABinary/index.js +60 -0
- package/lib/WABinary/index.js.map +1 -0
- package/lib/WABinary/jid-utils.d.ts +48 -0
- package/lib/WABinary/jid-utils.d.ts.map +1 -0
- package/lib/WABinary/jid-utils.js +121 -0
- package/lib/WABinary/jid-utils.js.map +1 -0
- package/lib/WABinary/types.d.ts +19 -0
- package/lib/WABinary/types.d.ts.map +1 -0
- package/lib/WABinary/types.js +4 -0
- package/lib/WABinary/types.js.map +1 -0
- package/lib/WAM/BinaryInfo.d.ts +9 -0
- package/lib/WAM/BinaryInfo.d.ts.map +1 -0
- package/lib/WAM/BinaryInfo.js +17 -0
- package/lib/WAM/BinaryInfo.js.map +1 -0
- package/lib/WAM/constants.d.ts +40 -0
- package/lib/WAM/constants.d.ts.map +1 -0
- package/lib/WAM/constants.js +1 -0
- package/lib/WAM/constants.js.map +1 -0
- package/lib/WAM/encode.d.ts +3 -0
- package/lib/WAM/encode.d.ts.map +1 -0
- package/lib/WAM/encode.js +150 -0
- package/lib/WAM/encode.js.map +1 -0
- package/lib/WAM/index.d.ts +4 -0
- package/lib/WAM/index.d.ts.map +1 -0
- package/lib/WAM/index.js +38 -0
- package/lib/WAM/index.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +63 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +65 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +34 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +43 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +32 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +68 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +37 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js.map +1 -0
- package/lib/WAUSync/Protocols/index.d.ts +6 -0
- package/lib/WAUSync/Protocols/index.d.ts.map +1 -0
- package/lib/WAUSync/Protocols/index.js +60 -0
- package/lib/WAUSync/Protocols/index.js.map +1 -0
- package/lib/WAUSync/USyncQuery.d.ts +30 -0
- package/lib/WAUSync/USyncQuery.d.ts.map +1 -0
- package/lib/WAUSync/USyncQuery.js +103 -0
- package/lib/WAUSync/USyncQuery.js.map +1 -0
- package/lib/WAUSync/USyncUser.d.ts +17 -0
- package/lib/WAUSync/USyncUser.d.ts.map +1 -0
- package/lib/WAUSync/USyncUser.js +38 -0
- package/lib/WAUSync/USyncUser.js.map +1 -0
- package/lib/WAUSync/index.d.ts +4 -0
- package/lib/WAUSync/index.d.ts.map +1 -0
- package/lib/WAUSync/index.js +38 -0
- package/lib/WAUSync/index.js.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +133 -0
- package/lib/index.js.map +1 -0
- package/package.json +72 -0
- package/scripts/patch-deps.js +35 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export * from './Auth.js';
|
|
2
|
+
export * from './GroupMetadata.js';
|
|
3
|
+
export * from './Chat.js';
|
|
4
|
+
export * from './Contact.js';
|
|
5
|
+
export * from './State.js';
|
|
6
|
+
export * from './Message.js';
|
|
7
|
+
export * from './Socket.js';
|
|
8
|
+
export * from './Events.js';
|
|
9
|
+
export * from './Product.js';
|
|
10
|
+
export * from './Call.js';
|
|
11
|
+
export * from './Signal.js';
|
|
12
|
+
export * from './Mex.js';
|
|
13
|
+
import type { AuthenticationState } from './Auth.js';
|
|
14
|
+
import type { SocketConfig } from './Socket.js';
|
|
15
|
+
export type UserFacingSocketConfig = Partial<SocketConfig> & {
|
|
16
|
+
auth: AuthenticationState;
|
|
17
|
+
};
|
|
18
|
+
export type BrowsersMap = {
|
|
19
|
+
ubuntu(browser: string): [string, string, string];
|
|
20
|
+
macOS(browser: string): [string, string, string];
|
|
21
|
+
xrl(browser: string): [string, string, string];
|
|
22
|
+
windows(browser: string): [string, string, string];
|
|
23
|
+
appropriate(browser: string): [string, string, string];
|
|
24
|
+
};
|
|
25
|
+
export declare enum DisconnectReason {
|
|
26
|
+
connectionClosed = 428,
|
|
27
|
+
connectionLost = 408,
|
|
28
|
+
connectionReplaced = 440,
|
|
29
|
+
timedOut = 408,
|
|
30
|
+
loggedOut = 401,
|
|
31
|
+
badSession = 500,
|
|
32
|
+
restartRequired = 515,
|
|
33
|
+
multideviceMismatch = 411,
|
|
34
|
+
forbidden = 403,
|
|
35
|
+
unavailableService = 503
|
|
36
|
+
}
|
|
37
|
+
export type WAInitResponse = {
|
|
38
|
+
ref: string;
|
|
39
|
+
ttl: number;
|
|
40
|
+
status: 200;
|
|
41
|
+
};
|
|
42
|
+
export type WABusinessHoursConfig = {
|
|
43
|
+
day_of_week: string;
|
|
44
|
+
mode: string;
|
|
45
|
+
open_time?: number;
|
|
46
|
+
close_time?: number;
|
|
47
|
+
};
|
|
48
|
+
export type WABusinessProfile = {
|
|
49
|
+
description: string;
|
|
50
|
+
email: string | undefined;
|
|
51
|
+
business_hours: {
|
|
52
|
+
timezone?: string;
|
|
53
|
+
config?: WABusinessHoursConfig[];
|
|
54
|
+
business_config?: WABusinessHoursConfig[];
|
|
55
|
+
};
|
|
56
|
+
website: string[];
|
|
57
|
+
category?: string;
|
|
58
|
+
wid?: string;
|
|
59
|
+
address?: string;
|
|
60
|
+
};
|
|
61
|
+
export type CurveKeyPair = {
|
|
62
|
+
private: Uint8Array;
|
|
63
|
+
public: Uint8Array;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,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Z,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,cAAc,EAAE;QACf,QAAQ,CAAC,EAAE,MAAM,CAAA;QACjB,MAAM,CAAC,EAAE,qBAAqB,EAAE,CAAA;QAChC,eAAe,CAAC,EAAE,qBAAqB,EAAE,CAAA;KACzC,CAAA;IACD,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IAAE,OAAO,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAA"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
DisconnectReason: true
|
|
8
|
+
};
|
|
9
|
+
exports.DisconnectReason = void 0;
|
|
10
|
+
var _Auth = require("./Auth.js");
|
|
11
|
+
Object.keys(_Auth).forEach(function (key) {
|
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
|
13
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
14
|
+
if (key in exports && exports[key] === _Auth[key]) return;
|
|
15
|
+
Object.defineProperty(exports, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () {
|
|
18
|
+
return _Auth[key];
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
var _GroupMetadata = require("./GroupMetadata.js");
|
|
23
|
+
Object.keys(_GroupMetadata).forEach(function (key) {
|
|
24
|
+
if (key === "default" || key === "__esModule") return;
|
|
25
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
26
|
+
if (key in exports && exports[key] === _GroupMetadata[key]) return;
|
|
27
|
+
Object.defineProperty(exports, key, {
|
|
28
|
+
enumerable: true,
|
|
29
|
+
get: function () {
|
|
30
|
+
return _GroupMetadata[key];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
var _Chat = require("./Chat.js");
|
|
35
|
+
Object.keys(_Chat).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
38
|
+
if (key in exports && exports[key] === _Chat[key]) return;
|
|
39
|
+
Object.defineProperty(exports, key, {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return _Chat[key];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
var _Contact = require("./Contact.js");
|
|
47
|
+
Object.keys(_Contact).forEach(function (key) {
|
|
48
|
+
if (key === "default" || key === "__esModule") return;
|
|
49
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
50
|
+
if (key in exports && exports[key] === _Contact[key]) return;
|
|
51
|
+
Object.defineProperty(exports, key, {
|
|
52
|
+
enumerable: true,
|
|
53
|
+
get: function () {
|
|
54
|
+
return _Contact[key];
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
var _State = require("./State.js");
|
|
59
|
+
Object.keys(_State).forEach(function (key) {
|
|
60
|
+
if (key === "default" || key === "__esModule") return;
|
|
61
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
62
|
+
if (key in exports && exports[key] === _State[key]) return;
|
|
63
|
+
Object.defineProperty(exports, key, {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () {
|
|
66
|
+
return _State[key];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
var _Message = require("./Message.js");
|
|
71
|
+
Object.keys(_Message).forEach(function (key) {
|
|
72
|
+
if (key === "default" || key === "__esModule") return;
|
|
73
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
74
|
+
if (key in exports && exports[key] === _Message[key]) return;
|
|
75
|
+
Object.defineProperty(exports, key, {
|
|
76
|
+
enumerable: true,
|
|
77
|
+
get: function () {
|
|
78
|
+
return _Message[key];
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
var _Socket = require("./Socket.js");
|
|
83
|
+
Object.keys(_Socket).forEach(function (key) {
|
|
84
|
+
if (key === "default" || key === "__esModule") return;
|
|
85
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
86
|
+
if (key in exports && exports[key] === _Socket[key]) return;
|
|
87
|
+
Object.defineProperty(exports, key, {
|
|
88
|
+
enumerable: true,
|
|
89
|
+
get: function () {
|
|
90
|
+
return _Socket[key];
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
var _Events = require("./Events.js");
|
|
95
|
+
Object.keys(_Events).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
98
|
+
if (key in exports && exports[key] === _Events[key]) return;
|
|
99
|
+
Object.defineProperty(exports, key, {
|
|
100
|
+
enumerable: true,
|
|
101
|
+
get: function () {
|
|
102
|
+
return _Events[key];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
var _Product = require("./Product.js");
|
|
107
|
+
Object.keys(_Product).forEach(function (key) {
|
|
108
|
+
if (key === "default" || key === "__esModule") return;
|
|
109
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
110
|
+
if (key in exports && exports[key] === _Product[key]) return;
|
|
111
|
+
Object.defineProperty(exports, key, {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () {
|
|
114
|
+
return _Product[key];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
var _Call = require("./Call.js");
|
|
119
|
+
Object.keys(_Call).forEach(function (key) {
|
|
120
|
+
if (key === "default" || key === "__esModule") return;
|
|
121
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
122
|
+
if (key in exports && exports[key] === _Call[key]) return;
|
|
123
|
+
Object.defineProperty(exports, key, {
|
|
124
|
+
enumerable: true,
|
|
125
|
+
get: function () {
|
|
126
|
+
return _Call[key];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
var _Signal = require("./Signal.js");
|
|
131
|
+
Object.keys(_Signal).forEach(function (key) {
|
|
132
|
+
if (key === "default" || key === "__esModule") return;
|
|
133
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
134
|
+
if (key in exports && exports[key] === _Signal[key]) return;
|
|
135
|
+
Object.defineProperty(exports, key, {
|
|
136
|
+
enumerable: true,
|
|
137
|
+
get: function () {
|
|
138
|
+
return _Signal[key];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
var _Mex = require("./Mex.js");
|
|
143
|
+
Object.keys(_Mex).forEach(function (key) {
|
|
144
|
+
if (key === "default" || key === "__esModule") return;
|
|
145
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
146
|
+
if (key in exports && exports[key] === _Mex[key]) return;
|
|
147
|
+
Object.defineProperty(exports, key, {
|
|
148
|
+
enumerable: true,
|
|
149
|
+
get: function () {
|
|
150
|
+
return _Mex[key];
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
var DisconnectReason;
|
|
155
|
+
(function (DisconnectReason) {
|
|
156
|
+
DisconnectReason[DisconnectReason["connectionClosed"] = 428] = "connectionClosed";
|
|
157
|
+
DisconnectReason[DisconnectReason["connectionLost"] = 408] = "connectionLost";
|
|
158
|
+
DisconnectReason[DisconnectReason["connectionReplaced"] = 440] = "connectionReplaced";
|
|
159
|
+
DisconnectReason[DisconnectReason["timedOut"] = 408] = "timedOut";
|
|
160
|
+
DisconnectReason[DisconnectReason["loggedOut"] = 401] = "loggedOut";
|
|
161
|
+
DisconnectReason[DisconnectReason["badSession"] = 500] = "badSession";
|
|
162
|
+
DisconnectReason[DisconnectReason["restartRequired"] = 515] = "restartRequired";
|
|
163
|
+
DisconnectReason[DisconnectReason["multideviceMismatch"] = 411] = "multideviceMismatch";
|
|
164
|
+
DisconnectReason[DisconnectReason["forbidden"] = 403] = "forbidden";
|
|
165
|
+
DisconnectReason[DisconnectReason["unavailableService"] = 503] = "unavailableService";
|
|
166
|
+
})(DisconnectReason || (exports.DisconnectReason = DisconnectReason = {}));
|
|
167
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Types/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AAerB,MAAM,CAAN,IAAY,gBAWX;AAXD,WAAY,gBAAgB;IAC3B,iFAAsB,CAAA;IACtB,6EAAoB,CAAA;IACpB,qFAAwB,CAAA;IACxB,iEAAc,CAAA;IACd,mEAAe,CAAA;IACf,qEAAgB,CAAA;IAChB,+EAAqB,CAAA;IACrB,uFAAyB,CAAA;IACzB,mEAAe,CAAA;IACf,qFAAwB,CAAA;AACzB,CAAC,EAXW,gBAAgB,KAAhB,gBAAgB,QAW3B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AuthenticationCreds, CacheStore, SignalKeyStore, SignalKeyStoreWithTransaction, TransactionCapabilityOptions } from '../Types/index.js';
|
|
2
|
+
import type { ILogger } from './logger.js';
|
|
3
|
+
/**
|
|
4
|
+
* Adds caching capability to a SignalKeyStore
|
|
5
|
+
* @param store the store to add caching to
|
|
6
|
+
* @param logger to log trace events
|
|
7
|
+
* @param _cache cache store to use
|
|
8
|
+
*/
|
|
9
|
+
export declare function makeCacheableSignalKeyStore(store: SignalKeyStore, logger?: ILogger, _cache?: CacheStore): SignalKeyStore;
|
|
10
|
+
/**
|
|
11
|
+
* Adds DB-like transaction capability to the SignalKeyStore
|
|
12
|
+
* Uses AsyncLocalStorage for automatic context management
|
|
13
|
+
* @param state the key store to apply this capability to
|
|
14
|
+
* @param logger logger to log events
|
|
15
|
+
* @returns SignalKeyStore with transaction capability
|
|
16
|
+
*/
|
|
17
|
+
export declare const addTransactionCapability: (state: SignalKeyStore, logger: ILogger, { maxCommitRetries, delayBetweenTriesMs }: TransactionCapabilityOptions) => SignalKeyStoreWithTransaction;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the authenticated user's JID, or throws a Boom-401 if creds are not yet authenticated.
|
|
20
|
+
* Use this anywhere we'd otherwise reach for `creds.me!.id` to fail fast with a descriptive error.
|
|
21
|
+
*/
|
|
22
|
+
export declare const assertMeId: (creds: AuthenticationCreds) => string;
|
|
23
|
+
export declare const initAuthCreds: () => AuthenticationCreds;
|
|
24
|
+
//# sourceMappingURL=auth-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-utils.d.ts","sourceRoot":"","sources":["../../src/Utils/auth-utils.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACX,mBAAmB,EACnB,UAAU,EAGV,cAAc,EACd,6BAA6B,EAC7B,4BAA4B,EAC5B,MAAM,UAAU,CAAA;AAGjB,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAA;AAYvC;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAC1C,KAAK,EAAE,cAAc,EACrB,MAAM,CAAC,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,UAAU,GACjB,cAAc,CAkEhB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACpC,OAAO,cAAc,EACrB,QAAQ,OAAO,EACf,2CAA2C,4BAA4B,KACrE,6BAiOF,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,mBAAmB,KAAG,MAOvD,CAAA;AAED,eAAO,MAAM,aAAa,QAAO,mBAsBhC,CAAA"}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.initAuthCreds = exports.assertMeId = exports.addTransactionCapability = void 0;
|
|
7
|
+
exports.makeCacheableSignalKeyStore = makeCacheableSignalKeyStore;
|
|
8
|
+
var _nodeCache = _interopRequireDefault(require("@cacheable/node-cache"));
|
|
9
|
+
var _boom = require("@hapi/boom");
|
|
10
|
+
var _async_hooks = require("async_hooks");
|
|
11
|
+
var _asyncMutex = require("async-mutex");
|
|
12
|
+
var _crypto = require("crypto");
|
|
13
|
+
var _pQueue = _interopRequireDefault(require("p-queue"));
|
|
14
|
+
var _index = require("../Defaults/index.js");
|
|
15
|
+
var _crypto2 = require("./crypto.js");
|
|
16
|
+
var _generics = require("./generics.js");
|
|
17
|
+
var _preKeyManager = require("./pre-key-manager.js");
|
|
18
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
|
+
/**
|
|
20
|
+
* Adds caching capability to a SignalKeyStore
|
|
21
|
+
* @param store the store to add caching to
|
|
22
|
+
* @param logger to log trace events
|
|
23
|
+
* @param _cache cache store to use
|
|
24
|
+
*/
|
|
25
|
+
function makeCacheableSignalKeyStore(store, logger, _cache) {
|
|
26
|
+
const cache = _cache || new _nodeCache.default({
|
|
27
|
+
stdTTL: _index.DEFAULT_CACHE_TTLS.SIGNAL_STORE,
|
|
28
|
+
// 5 minutes
|
|
29
|
+
useClones: false,
|
|
30
|
+
deleteOnExpire: true
|
|
31
|
+
});
|
|
32
|
+
// Mutex for protecting cache operations
|
|
33
|
+
const cacheMutex = new _asyncMutex.Mutex();
|
|
34
|
+
function getUniqueId(type, id) {
|
|
35
|
+
return `${type}.${id}`;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
async get(type, ids) {
|
|
39
|
+
return cacheMutex.runExclusive(async () => {
|
|
40
|
+
const data = {};
|
|
41
|
+
const idsToFetch = [];
|
|
42
|
+
for (const id of ids) {
|
|
43
|
+
const item = await cache.get(getUniqueId(type, id));
|
|
44
|
+
if (typeof item !== 'undefined') {
|
|
45
|
+
data[id] = item;
|
|
46
|
+
} else {
|
|
47
|
+
idsToFetch.push(id);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (idsToFetch.length) {
|
|
51
|
+
logger?.trace({
|
|
52
|
+
items: idsToFetch.length
|
|
53
|
+
}, 'loading from store');
|
|
54
|
+
const fetched = await store.get(type, idsToFetch);
|
|
55
|
+
for (const id of idsToFetch) {
|
|
56
|
+
const item = fetched[id];
|
|
57
|
+
if (item) {
|
|
58
|
+
data[id] = item;
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion
|
|
60
|
+
await cache.set(getUniqueId(type, id), item);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return data;
|
|
65
|
+
});
|
|
66
|
+
},
|
|
67
|
+
async set(data) {
|
|
68
|
+
return cacheMutex.runExclusive(async () => {
|
|
69
|
+
let keys = 0;
|
|
70
|
+
for (const type in data) {
|
|
71
|
+
for (const id in data[type]) {
|
|
72
|
+
await cache.set(getUniqueId(type, id), data[type][id]);
|
|
73
|
+
keys += 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
logger?.trace({
|
|
77
|
+
keys
|
|
78
|
+
}, 'updated cache');
|
|
79
|
+
await store.set(data);
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
async clear() {
|
|
83
|
+
await cache.flushAll();
|
|
84
|
+
await store.clear?.();
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Adds DB-like transaction capability to the SignalKeyStore
|
|
90
|
+
* Uses AsyncLocalStorage for automatic context management
|
|
91
|
+
* @param state the key store to apply this capability to
|
|
92
|
+
* @param logger logger to log events
|
|
93
|
+
* @returns SignalKeyStore with transaction capability
|
|
94
|
+
*/
|
|
95
|
+
const addTransactionCapability = (state, logger, {
|
|
96
|
+
maxCommitRetries,
|
|
97
|
+
delayBetweenTriesMs
|
|
98
|
+
}) => {
|
|
99
|
+
const txStorage = new _async_hooks.AsyncLocalStorage();
|
|
100
|
+
// Queues for concurrency control (keyed by signal data type - bounded set)
|
|
101
|
+
const keyQueues = new Map();
|
|
102
|
+
// Transaction mutexes with reference counting for cleanup
|
|
103
|
+
const txMutexes = new Map();
|
|
104
|
+
const txMutexRefCounts = new Map();
|
|
105
|
+
// Pre-key manager for specialized operations
|
|
106
|
+
const preKeyManager = new _preKeyManager.PreKeyManager(state, logger);
|
|
107
|
+
/**
|
|
108
|
+
* Get or create a queue for a specific key type
|
|
109
|
+
*/
|
|
110
|
+
function getQueue(key) {
|
|
111
|
+
if (!keyQueues.has(key)) {
|
|
112
|
+
keyQueues.set(key, new _pQueue.default({
|
|
113
|
+
concurrency: 1
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
return keyQueues.get(key);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get or create a transaction mutex
|
|
120
|
+
*/
|
|
121
|
+
function getTxMutex(key) {
|
|
122
|
+
if (!txMutexes.has(key)) {
|
|
123
|
+
txMutexes.set(key, new _asyncMutex.Mutex());
|
|
124
|
+
txMutexRefCounts.set(key, 0);
|
|
125
|
+
}
|
|
126
|
+
return txMutexes.get(key);
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Acquire a reference to a transaction mutex
|
|
130
|
+
*/
|
|
131
|
+
function acquireTxMutexRef(key) {
|
|
132
|
+
const count = txMutexRefCounts.get(key) ?? 0;
|
|
133
|
+
txMutexRefCounts.set(key, count + 1);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Release a reference to a transaction mutex and cleanup if no longer needed
|
|
137
|
+
*/
|
|
138
|
+
function releaseTxMutexRef(key) {
|
|
139
|
+
const count = (txMutexRefCounts.get(key) ?? 1) - 1;
|
|
140
|
+
txMutexRefCounts.set(key, count);
|
|
141
|
+
// Cleanup if no more references and mutex is not locked
|
|
142
|
+
if (count <= 0) {
|
|
143
|
+
const mutex = txMutexes.get(key);
|
|
144
|
+
if (mutex && !mutex.isLocked()) {
|
|
145
|
+
txMutexes.delete(key);
|
|
146
|
+
txMutexRefCounts.delete(key);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Check if currently in a transaction
|
|
152
|
+
*/
|
|
153
|
+
function isInTransaction() {
|
|
154
|
+
return !!txStorage.getStore();
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Commit transaction with retries
|
|
158
|
+
*/
|
|
159
|
+
async function commitWithRetry(mutations) {
|
|
160
|
+
if (Object.keys(mutations).length === 0) {
|
|
161
|
+
logger.trace('no mutations in transaction');
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
logger.trace('committing transaction');
|
|
165
|
+
for (let attempt = 0; attempt < maxCommitRetries; attempt++) {
|
|
166
|
+
try {
|
|
167
|
+
await state.set(mutations);
|
|
168
|
+
logger.trace({
|
|
169
|
+
mutationCount: Object.keys(mutations).length
|
|
170
|
+
}, 'committed transaction');
|
|
171
|
+
return;
|
|
172
|
+
} catch (error) {
|
|
173
|
+
const retriesLeft = maxCommitRetries - attempt - 1;
|
|
174
|
+
logger.warn(`failed to commit mutations, retries left=${retriesLeft}`);
|
|
175
|
+
if (retriesLeft === 0) {
|
|
176
|
+
throw error;
|
|
177
|
+
}
|
|
178
|
+
await (0, _generics.delay)(delayBetweenTriesMs);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
get: async (type, ids) => {
|
|
184
|
+
const ctx = txStorage.getStore();
|
|
185
|
+
if (!ctx) {
|
|
186
|
+
// No transaction - direct read without exclusive lock for concurrency
|
|
187
|
+
return state.get(type, ids);
|
|
188
|
+
}
|
|
189
|
+
// In transaction - check cache first
|
|
190
|
+
const cached = ctx.cache[type] || {};
|
|
191
|
+
const missing = ids.filter(id => !(id in cached));
|
|
192
|
+
if (missing.length > 0) {
|
|
193
|
+
ctx.dbQueries++;
|
|
194
|
+
logger.trace({
|
|
195
|
+
type,
|
|
196
|
+
count: missing.length
|
|
197
|
+
}, 'fetching missing keys in transaction');
|
|
198
|
+
const fetched = await getTxMutex(type).runExclusive(() => state.get(type, missing));
|
|
199
|
+
// Update cache
|
|
200
|
+
ctx.cache[type] = ctx.cache[type] || {};
|
|
201
|
+
Object.assign(ctx.cache[type], fetched);
|
|
202
|
+
}
|
|
203
|
+
// Return requested ids from cache
|
|
204
|
+
const result = {};
|
|
205
|
+
for (const id of ids) {
|
|
206
|
+
const value = ctx.cache[type]?.[id];
|
|
207
|
+
if (value !== undefined && value !== null) {
|
|
208
|
+
result[id] = value;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
},
|
|
213
|
+
set: async data => {
|
|
214
|
+
const ctx = txStorage.getStore();
|
|
215
|
+
if (!ctx) {
|
|
216
|
+
// No transaction - direct write with queue protection
|
|
217
|
+
const types = Object.keys(data);
|
|
218
|
+
// Process pre-keys with validation
|
|
219
|
+
for (const type_ of types) {
|
|
220
|
+
const type = type_;
|
|
221
|
+
if (type === 'pre-key') {
|
|
222
|
+
await preKeyManager.validateDeletions(data, type);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// Write all data in parallel
|
|
226
|
+
await Promise.all(types.map(type => getQueue(type).add(async () => {
|
|
227
|
+
const typeData = {
|
|
228
|
+
[type]: data[type]
|
|
229
|
+
};
|
|
230
|
+
await state.set(typeData);
|
|
231
|
+
})));
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
// In transaction - update cache and mutations
|
|
235
|
+
logger.trace({
|
|
236
|
+
types: Object.keys(data)
|
|
237
|
+
}, 'caching in transaction');
|
|
238
|
+
for (const key_ in data) {
|
|
239
|
+
const key = key_;
|
|
240
|
+
// Ensure structures exist
|
|
241
|
+
ctx.cache[key] = ctx.cache[key] || {};
|
|
242
|
+
ctx.mutations[key] = ctx.mutations[key] || {};
|
|
243
|
+
// Special handling for pre-keys
|
|
244
|
+
if (key === 'pre-key') {
|
|
245
|
+
await preKeyManager.processOperations(data, key, ctx.cache, ctx.mutations, true);
|
|
246
|
+
} else {
|
|
247
|
+
// Normal key types
|
|
248
|
+
Object.assign(ctx.cache[key], data[key]);
|
|
249
|
+
Object.assign(ctx.mutations[key], data[key]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
isInTransaction,
|
|
254
|
+
transaction: async (work, key) => {
|
|
255
|
+
const existing = txStorage.getStore();
|
|
256
|
+
// Nested transaction - reuse existing context
|
|
257
|
+
if (existing) {
|
|
258
|
+
logger.trace('reusing existing transaction context');
|
|
259
|
+
return work();
|
|
260
|
+
}
|
|
261
|
+
// New transaction - acquire mutex and create context
|
|
262
|
+
const mutex = getTxMutex(key);
|
|
263
|
+
acquireTxMutexRef(key);
|
|
264
|
+
try {
|
|
265
|
+
return await mutex.runExclusive(async () => {
|
|
266
|
+
const ctx = {
|
|
267
|
+
cache: {},
|
|
268
|
+
mutations: {},
|
|
269
|
+
dbQueries: 0
|
|
270
|
+
};
|
|
271
|
+
logger.trace('entering transaction');
|
|
272
|
+
try {
|
|
273
|
+
const result = await txStorage.run(ctx, work);
|
|
274
|
+
// Commit mutations
|
|
275
|
+
await commitWithRetry(ctx.mutations);
|
|
276
|
+
logger.trace({
|
|
277
|
+
dbQueries: ctx.dbQueries
|
|
278
|
+
}, 'transaction completed');
|
|
279
|
+
return result;
|
|
280
|
+
} catch (error) {
|
|
281
|
+
logger.error({
|
|
282
|
+
error
|
|
283
|
+
}, 'transaction failed, rolling back');
|
|
284
|
+
throw error;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
} finally {
|
|
288
|
+
releaseTxMutexRef(key);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
};
|
|
293
|
+
/**
|
|
294
|
+
* Returns the authenticated user's JID, or throws a Boom-401 if creds are not yet authenticated.
|
|
295
|
+
* Use this anywhere we'd otherwise reach for `creds.me!.id` to fail fast with a descriptive error.
|
|
296
|
+
*/
|
|
297
|
+
exports.addTransactionCapability = addTransactionCapability;
|
|
298
|
+
const assertMeId = creds => {
|
|
299
|
+
const id = creds.me?.id;
|
|
300
|
+
if (!id) {
|
|
301
|
+
throw new _boom.Boom('Cannot proceed: socket is not authenticated yet (creds.me.id is missing)', {
|
|
302
|
+
statusCode: 401
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
return id;
|
|
306
|
+
};
|
|
307
|
+
exports.assertMeId = assertMeId;
|
|
308
|
+
const initAuthCreds = () => {
|
|
309
|
+
const identityKey = _crypto2.Curve.generateKeyPair();
|
|
310
|
+
return {
|
|
311
|
+
noiseKey: _crypto2.Curve.generateKeyPair(),
|
|
312
|
+
pairingEphemeralKeyPair: _crypto2.Curve.generateKeyPair(),
|
|
313
|
+
signedIdentityKey: identityKey,
|
|
314
|
+
signedPreKey: (0, _crypto2.signedKeyPair)(identityKey, 1),
|
|
315
|
+
registrationId: (0, _generics.generateRegistrationId)(),
|
|
316
|
+
advSecretKey: (0, _crypto.randomBytes)(32).toString('base64'),
|
|
317
|
+
processedHistoryMessages: [],
|
|
318
|
+
nextPreKeyId: 1,
|
|
319
|
+
firstUnuploadedPreKeyId: 1,
|
|
320
|
+
accountSyncCounter: 0,
|
|
321
|
+
accountSettings: {
|
|
322
|
+
unarchiveChats: false
|
|
323
|
+
},
|
|
324
|
+
registered: false,
|
|
325
|
+
pairingCode: undefined,
|
|
326
|
+
lastPropHash: undefined,
|
|
327
|
+
routingInfo: undefined,
|
|
328
|
+
additionalData: undefined
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
//# sourceMappingURL=auth-utils.js.map
|
|
332
|
+
exports.initAuthCreds = initAuthCreds;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-utils.js","sourceRoot":"","sources":["../../src/Utils/auth-utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,uBAAuB,CAAA;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAUhD,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAWjD;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAC1C,KAAqB,EACrB,MAAgB,EAChB,MAAmB;IAEnB,MAAM,KAAK,GACV,MAAM;QACN,IAAI,SAAS,CAA6C;YACzD,MAAM,EAAE,kBAAkB,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CAAC,eAAe,EAAE;QACjC,uBAAuB,EAAE,KAAK,CAAC,eAAe,EAAE;QAChD,iBAAiB,EAAE,WAAW;QAC9B,YAAY,EAAE,aAAa,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3C,cAAc,EAAE,sBAAsB,EAAE;QACxC,YAAY,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAChD,wBAAwB,EAAE,EAAE;QAC5B,YAAY,EAAE,CAAC;QACf,uBAAuB,EAAE,CAAC;QAC1B,kBAAkB,EAAE,CAAC;QACrB,eAAe,EAAE;YAChB,cAAc,EAAE,KAAK;SACrB;QACD,UAAU,EAAE,KAAK;QACjB,WAAW,EAAE,SAAS;QACtB,YAAY,EAAE,SAAS;QACvB,WAAW,EAAE,SAAS;QACtB,cAAc,EAAE,SAAS;KACzB,CAAA;AACF,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-utils.d.ts","sourceRoot":"","sources":["../../src/Utils/browser-utils.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAgB3C,eAAO,MAAM,QAAQ,EAAE,WAOtB,CAAA;AAED,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,WAG5C,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPlatformId = exports.Browsers = void 0;
|
|
7
|
+
var _os = require("os");
|
|
8
|
+
var _index = require("../../WAProto/index.js");
|
|
9
|
+
const PLATFORM_MAP = {
|
|
10
|
+
aix: 'AIX',
|
|
11
|
+
darwin: 'Mac OS',
|
|
12
|
+
win32: 'Windows',
|
|
13
|
+
android: 'Android',
|
|
14
|
+
freebsd: 'FreeBSD',
|
|
15
|
+
openbsd: 'OpenBSD',
|
|
16
|
+
sunos: 'Solaris',
|
|
17
|
+
linux: undefined,
|
|
18
|
+
haiku: undefined,
|
|
19
|
+
cygwin: undefined,
|
|
20
|
+
netbsd: undefined
|
|
21
|
+
};
|
|
22
|
+
const Browsers = exports.Browsers = {
|
|
23
|
+
ubuntu: browser => ['Ubuntu', browser, '22.04.4'],
|
|
24
|
+
macOS: browser => ['Mac OS', browser, '14.4.1'],
|
|
25
|
+
xrl: browser => ['xrl', browser, '6.5.0'],
|
|
26
|
+
windows: browser => ['Windows', browser, '10.0.22631'],
|
|
27
|
+
/** The appropriate browser based on your OS & release */
|
|
28
|
+
appropriate: browser => [PLATFORM_MAP[(0, _os.platform)()] || 'Ubuntu', browser, (0, _os.release)()]
|
|
29
|
+
};
|
|
30
|
+
const getPlatformId = browser => {
|
|
31
|
+
const platformType = _index.proto.DeviceProps.PlatformType[browser.toUpperCase()];
|
|
32
|
+
return platformType ? platformType.toString() : '1'; //chrome
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=browser-utils.js.map
|
|
35
|
+
exports.getPlatformId = getPlatformId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-utils.js","sourceRoot":"","sources":["../../src/Utils/browser-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAG9C,MAAM,YAAY,GAAG;IACpB,GAAG,EAAE,KAAK;IACV,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,SAAS;IAChB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;CACjB,CAAA;AAED,MAAM,CAAC,MAAM,QAAQ,GAA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