@eduh_dev021/baileys 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +495 -2
- package/WAProto/index.d.ts +22220 -0
- package/WAProto/index.js +5 -0
- package/cjs/WAProto/index.d.ts +22220 -0
- package/cjs/WAProto/index.js +60125 -0
- package/cjs/engine-requirements.js +12 -0
- package/cjs/lib/Addon/http-error.d.ts +18 -0
- package/cjs/lib/Addon/http-error.js +66 -0
- package/cjs/lib/Addon/index.d.ts +3 -0
- package/cjs/lib/Addon/index.js +50 -0
- package/cjs/lib/Addon/keyed-db.d.ts +14 -0
- package/cjs/lib/Addon/keyed-db.js +264 -0
- package/cjs/lib/Addon/link-preview.d.ts +15 -0
- package/cjs/lib/Addon/link-preview.js +104 -0
- package/cjs/lib/Defaults/index.d.ts +184 -0
- package/cjs/lib/Defaults/index.js +292 -0
- package/cjs/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/cjs/lib/Signal/Group/ciphertext-message.js +37 -0
- package/cjs/lib/Signal/Group/group-cipher.d.ts +10 -0
- package/cjs/lib/Signal/Group/group-cipher.js +105 -0
- package/cjs/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/cjs/lib/Signal/Group/group-session-builder.js +65 -0
- package/cjs/lib/Signal/Group/index.d.ts +11 -0
- package/cjs/lib/Signal/Group/index.js +67 -0
- package/cjs/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/cjs/lib/Signal/Group/keyhelper.js +47 -0
- package/cjs/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/cjs/lib/Signal/Group/sender-chain-key.js +51 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/cjs/lib/Signal/Group/sender-key-distribution-message.js +80 -0
- package/cjs/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/cjs/lib/Signal/Group/sender-key-message.js +87 -0
- package/cjs/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/cjs/lib/Signal/Group/sender-key-name.js +73 -0
- package/cjs/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/cjs/lib/Signal/Group/sender-key-record.js +66 -0
- package/cjs/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/cjs/lib/Signal/Group/sender-key-state.js +106 -0
- package/cjs/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/cjs/lib/Signal/Group/sender-message-key.js +51 -0
- package/cjs/lib/Signal/libsignal.d.ts +54 -0
- package/cjs/lib/Signal/libsignal.js +421 -0
- package/cjs/lib/Signal/lid-mapping.d.ts +20 -0
- package/cjs/lib/Signal/lid-mapping.js +292 -0
- package/cjs/lib/Socket/Client/index.d.ts +2 -0
- package/cjs/lib/Socket/Client/index.js +23 -0
- package/cjs/lib/Socket/Client/types.d.ts +5 -0
- package/cjs/lib/Socket/Client/types.js +36 -0
- package/cjs/lib/Socket/Client/websocket.d.ts +12 -0
- package/cjs/lib/Socket/Client/websocket.js +143 -0
- package/cjs/lib/Socket/business.d.ts +387 -0
- package/cjs/lib/Socket/business.js +402 -0
- package/cjs/lib/Socket/chats.d.ts +144 -0
- package/cjs/lib/Socket/chats.js +1118 -0
- package/cjs/lib/Socket/communities.d.ts +554 -0
- package/cjs/lib/Socket/communities.js +456 -0
- package/cjs/lib/Socket/groups.d.ts +286 -0
- package/cjs/lib/Socket/groups.js +366 -0
- package/cjs/lib/Socket/index.d.ts +522 -0
- package/cjs/lib/Socket/index.js +32 -0
- package/cjs/lib/Socket/messages-recv.d.ts +326 -0
- package/cjs/lib/Socket/messages-recv.js +1670 -0
- package/cjs/lib/Socket/messages-send.d.ts +321 -0
- package/cjs/lib/Socket/messages-send.js +1252 -0
- package/cjs/lib/Socket/mex.d.ts +1 -0
- package/cjs/lib/Socket/mex.js +65 -0
- package/cjs/lib/Socket/newsletter.d.ts +283 -0
- package/cjs/lib/Socket/newsletter.js +243 -0
- package/cjs/lib/Socket/socket.d.ts +61 -0
- package/cjs/lib/Socket/socket.js +908 -0
- package/cjs/lib/Store/index.d.ts +3 -0
- package/cjs/lib/Store/index.js +25 -0
- package/cjs/lib/Store/make-in-memory-store.d.ts +63 -0
- package/cjs/lib/Store/make-in-memory-store.js +431 -0
- package/cjs/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/cjs/lib/Store/make-ordered-dictionary.js +101 -0
- package/cjs/lib/Store/object-repository.d.ts +10 -0
- package/cjs/lib/Store/object-repository.js +49 -0
- package/cjs/lib/Transport/crypto.d.ts +6 -0
- package/cjs/lib/Transport/crypto.js +107 -0
- package/cjs/lib/Transport/curve.d.ts +8 -0
- package/cjs/lib/Transport/curve.js +94 -0
- package/cjs/lib/Transport/index.d.ts +16 -0
- package/cjs/lib/Transport/index.js +67 -0
- package/cjs/lib/Transport/internals.d.ts +57 -0
- package/cjs/lib/Transport/internals.js +203 -0
- package/cjs/lib/Transport/session-builder.d.ts +40 -0
- package/cjs/lib/Transport/session-builder.js +169 -0
- package/cjs/lib/Transport/session-cipher.d.ts +26 -0
- package/cjs/lib/Transport/session-cipher.js +328 -0
- package/cjs/lib/Transport/session-record.d.ts +55 -0
- package/cjs/lib/Transport/session-record.js +289 -0
- package/cjs/lib/Types/Auth.d.ts +1 -0
- package/cjs/lib/Types/Auth.js +15 -0
- package/cjs/lib/Types/Bussines.d.ts +1 -0
- package/cjs/lib/Types/Bussines.js +15 -0
- package/cjs/lib/Types/Call.d.ts +1 -0
- package/cjs/lib/Types/Call.js +15 -0
- package/cjs/lib/Types/Chat.d.ts +1 -0
- package/cjs/lib/Types/Chat.js +33 -0
- package/cjs/lib/Types/Contact.d.ts +1 -0
- package/cjs/lib/Types/Contact.js +15 -0
- package/cjs/lib/Types/Events.d.ts +1 -0
- package/cjs/lib/Types/Events.js +1 -0
- package/cjs/lib/Types/GroupMetadata.d.ts +1 -0
- package/cjs/lib/Types/GroupMetadata.js +15 -0
- package/cjs/lib/Types/Label.d.ts +2 -0
- package/cjs/lib/Types/Label.js +49 -0
- package/cjs/lib/Types/LabelAssociation.d.ts +2 -0
- package/cjs/lib/Types/LabelAssociation.js +31 -0
- package/cjs/lib/Types/Message.d.ts +11 -0
- package/cjs/lib/Types/Message.js +58 -0
- package/cjs/lib/Types/Mex.d.ts +2 -0
- package/cjs/lib/Types/Mex.js +66 -0
- package/cjs/lib/Types/Product.d.ts +1 -0
- package/cjs/lib/Types/Product.js +15 -0
- package/cjs/lib/Types/RichType.d.ts +2 -0
- package/cjs/lib/Types/RichType.js +50 -0
- package/cjs/lib/Types/Signal.d.ts +1 -0
- package/cjs/lib/Types/Signal.js +1 -0
- package/cjs/lib/Types/Socket.d.ts +1 -0
- package/cjs/lib/Types/Socket.js +1 -0
- package/cjs/lib/Types/State.d.ts +5 -0
- package/cjs/lib/Types/State.js +83 -0
- package/cjs/lib/Types/USync.d.ts +1 -0
- package/cjs/lib/Types/USync.js +1 -0
- package/cjs/lib/Types/index.d.ts +13 -0
- package/cjs/lib/Types/index.js +64 -0
- package/cjs/lib/Utils/auth-utils.d.ts +58 -0
- package/cjs/lib/Utils/auth-utils.js +275 -0
- package/cjs/lib/Utils/browser-utils.d.ts +9 -0
- package/cjs/lib/Utils/browser-utils.js +56 -0
- package/cjs/lib/Utils/business.d.ts +49 -0
- package/cjs/lib/Utils/business.js +259 -0
- package/cjs/lib/Utils/chat-utils.d.ts +408 -0
- package/cjs/lib/Utils/chat-utils.js +821 -0
- package/cjs/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/cjs/lib/Utils/companion-reg-client-utils.js +71 -0
- package/cjs/lib/Utils/crypto.d.ts +39 -0
- package/cjs/lib/Utils/crypto.js +155 -0
- package/cjs/lib/Utils/decode-wa-message.d.ts +83 -0
- package/cjs/lib/Utils/decode-wa-message.js +316 -0
- package/cjs/lib/Utils/event-buffer.d.ts +12 -0
- package/cjs/lib/Utils/event-buffer.js +605 -0
- package/cjs/lib/Utils/generics.d.ts +63 -0
- package/cjs/lib/Utils/generics.js +440 -0
- package/cjs/lib/Utils/history.d.ts +75 -0
- package/cjs/lib/Utils/history.js +153 -0
- package/cjs/lib/Utils/identity-change-handler.d.ts +13 -0
- package/cjs/lib/Utils/identity-change-handler.js +73 -0
- package/cjs/lib/Utils/index.d.ts +24 -0
- package/cjs/lib/Utils/index.js +67 -0
- package/cjs/lib/Utils/link-preview.d.ts +13 -0
- package/cjs/lib/Utils/link-preview.js +87 -0
- package/cjs/lib/Utils/logger.d.ts +12 -0
- package/cjs/lib/Utils/logger.js +40 -0
- package/cjs/lib/Utils/lt-hash.d.ts +6 -0
- package/cjs/lib/Utils/lt-hash.js +28 -0
- package/cjs/lib/Utils/make-mutex.d.ts +6 -0
- package/cjs/lib/Utils/make-mutex.js +58 -0
- package/cjs/lib/Utils/message-retry-manager.d.ts +79 -0
- package/cjs/lib/Utils/message-retry-manager.js +274 -0
- package/cjs/lib/Utils/messages-media.d.ts +134 -0
- package/cjs/lib/Utils/messages-media.js +799 -0
- package/cjs/lib/Utils/messages.d.ts +47 -0
- package/cjs/lib/Utils/messages.js +1667 -0
- package/cjs/lib/Utils/noise-handler.d.ts +20 -0
- package/cjs/lib/Utils/noise-handler.js +223 -0
- package/cjs/lib/Utils/offline-node-processor.d.ts +10 -0
- package/cjs/lib/Utils/offline-node-processor.js +60 -0
- package/cjs/lib/Utils/pre-key-manager.d.ts +25 -0
- package/cjs/lib/Utils/pre-key-manager.js +116 -0
- package/cjs/lib/Utils/process-message.d.ts +83 -0
- package/cjs/lib/Utils/process-message.js +607 -0
- package/cjs/lib/Utils/reporting-utils.d.ts +12 -0
- package/cjs/lib/Utils/reporting-utils.js +282 -0
- package/cjs/lib/Utils/rich-message-utils.d.ts +48 -0
- package/cjs/lib/Utils/rich-message-utils.js +381 -0
- package/cjs/lib/Utils/signal.d.ts +82 -0
- package/cjs/lib/Utils/signal.js +232 -0
- package/cjs/lib/Utils/stanza-ack.d.ts +16 -0
- package/cjs/lib/Utils/stanza-ack.js +53 -0
- package/cjs/lib/Utils/sync-action-utils.d.ts +2 -0
- package/cjs/lib/Utils/sync-action-utils.js +68 -0
- package/cjs/lib/Utils/tc-token-utils.d.ts +29 -0
- package/cjs/lib/Utils/tc-token-utils.js +182 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/cjs/lib/Utils/use-multi-file-auth-state.js +135 -0
- package/cjs/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/cjs/lib/Utils/use-single-file-auth-state.js +115 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/cjs/lib/Utils/use-sqlite-auth-state.js +140 -0
- package/cjs/lib/Utils/validate-connection.d.ts +44 -0
- package/cjs/lib/Utils/validate-connection.js +229 -0
- package/cjs/lib/WABinary/constants.d.ts +61 -0
- package/cjs/lib/WABinary/constants.js +1992 -0
- package/cjs/lib/WABinary/decode.d.ts +9 -0
- package/cjs/lib/WABinary/decode.js +292 -0
- package/cjs/lib/WABinary/encode.d.ts +2 -0
- package/cjs/lib/WABinary/encode.js +240 -0
- package/cjs/lib/WABinary/generic-utils.d.ts +79 -0
- package/cjs/lib/WABinary/generic-utils.js +252 -0
- package/cjs/lib/WABinary/index.d.ts +5 -0
- package/cjs/lib/WABinary/index.js +29 -0
- package/cjs/lib/WABinary/jid-utils.d.ts +28 -0
- package/cjs/lib/WABinary/jid-utils.js +151 -0
- package/cjs/lib/WABinary/types.d.ts +1 -0
- package/cjs/lib/WABinary/types.js +23 -0
- package/cjs/lib/WACrypto/appstate-keys.js +39 -0
- package/cjs/lib/WACrypto/curves/constants.js +37 -0
- package/cjs/lib/WACrypto/hkdf.js +38 -0
- package/cjs/lib/WACrypto/index.js +51 -0
- package/cjs/lib/WACrypto/lthash.js +59 -0
- package/cjs/lib/WACrypto/math/constants.js +53 -0
- package/cjs/lib/WACrypto/math/edwards.js +206 -0
- package/cjs/lib/WACrypto/math/fe.js +449 -0
- package/cjs/lib/WACrypto/math/le.js +44 -0
- package/cjs/lib/WACrypto/math/mod.js +36 -0
- package/cjs/lib/WACrypto/util/bytes.js +348 -0
- package/cjs/lib/WACrypto/x25519.js +157 -0
- package/cjs/lib/WACrypto/xeddsa.js +134 -0
- package/cjs/lib/WAM/BinaryInfo.d.ts +7 -0
- package/cjs/lib/WAM/BinaryInfo.js +35 -0
- package/cjs/lib/WAM/constants.d.ts +34926 -0
- package/cjs/lib/WAM/constants.js +22890 -0
- package/cjs/lib/WAM/encode.d.ts +1 -0
- package/cjs/lib/WAM/encode.js +162 -0
- package/cjs/lib/WAM/index.d.ts +3 -0
- package/cjs/lib/WAM/index.js +25 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/cjs/lib/WAUSync/Protocols/USyncContactProtocol.js +77 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/cjs/lib/WAUSync/Protocols/USyncDeviceProtocol.js +76 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/cjs/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +52 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/cjs/lib/WAUSync/Protocols/USyncStatusProtocol.js +61 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/cjs/lib/WAUSync/Protocols/USyncUsernameProtocol.js +50 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/cjs/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +76 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/cjs/lib/WAUSync/Protocols/UsyncLIDProtocol.js +53 -0
- package/cjs/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/cjs/lib/WAUSync/Protocols/index.js +29 -0
- package/cjs/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/cjs/lib/WAUSync/USyncQuery.js +113 -0
- package/cjs/lib/WAUSync/USyncUser.d.ts +16 -0
- package/cjs/lib/WAUSync/USyncUser.js +56 -0
- package/cjs/lib/WAUSync/index.d.ts +3 -0
- package/cjs/lib/WAUSync/index.js +25 -0
- package/cjs/lib/index.d.ts +11 -0
- package/cjs/lib/index.js +56 -0
- package/cjs/package.json +3 -0
- package/engine-requirements.js +12 -0
- package/lib/Addon/http-error.d.ts +18 -0
- package/lib/Addon/http-error.js +40 -0
- package/lib/Addon/index.d.ts +3 -0
- package/lib/Addon/index.js +4 -0
- package/lib/Addon/keyed-db.d.ts +14 -0
- package/lib/Addon/keyed-db.js +241 -0
- package/lib/Addon/link-preview.d.ts +15 -0
- package/lib/Addon/link-preview.js +79 -0
- package/lib/Defaults/index.d.ts +184 -0
- package/lib/Defaults/index.js +181 -0
- package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
- package/lib/Signal/Group/ciphertext-message.js +11 -0
- package/lib/Signal/Group/group-cipher.d.ts +10 -0
- package/lib/Signal/Group/group-cipher.js +81 -0
- package/lib/Signal/Group/group-session-builder.d.ts +7 -0
- package/lib/Signal/Group/group-session-builder.js +29 -0
- package/lib/Signal/Group/index.d.ts +11 -0
- package/lib/Signal/Group/index.js +11 -0
- package/lib/Signal/Group/keyhelper.d.ts +6 -0
- package/lib/Signal/Group/keyhelper.js +17 -0
- package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
- package/lib/Signal/Group/sender-chain-key.js +25 -0
- package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
- package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
- package/lib/Signal/Group/sender-key-message.d.ts +18 -0
- package/lib/Signal/Group/sender-key-message.js +65 -0
- package/lib/Signal/Group/sender-key-name.d.ts +11 -0
- package/lib/Signal/Group/sender-key-name.js +47 -0
- package/lib/Signal/Group/sender-key-record.d.ts +12 -0
- package/lib/Signal/Group/sender-key-record.js +40 -0
- package/lib/Signal/Group/sender-key-state.d.ts +16 -0
- package/lib/Signal/Group/sender-key-state.js +83 -0
- package/lib/Signal/Group/sender-message-key.d.ts +11 -0
- package/lib/Signal/Group/sender-message-key.js +25 -0
- package/lib/Signal/libsignal.d.ts +54 -0
- package/lib/Signal/libsignal.js +426 -0
- package/lib/Signal/lid-mapping.d.ts +20 -0
- package/lib/Signal/lid-mapping.js +274 -0
- package/lib/Socket/Client/index.d.ts +2 -0
- package/lib/Socket/Client/index.js +2 -0
- package/lib/Socket/Client/types.d.ts +5 -0
- package/lib/Socket/Client/types.js +10 -0
- package/lib/Socket/Client/websocket.d.ts +12 -0
- package/lib/Socket/Client/websocket.js +119 -0
- package/lib/Socket/business.d.ts +387 -0
- package/lib/Socket/business.js +379 -0
- package/lib/Socket/chats.d.ts +144 -0
- package/lib/Socket/chats.js +1216 -0
- package/lib/Socket/communities.d.ts +554 -0
- package/lib/Socket/communities.js +431 -0
- package/lib/Socket/groups.d.ts +286 -0
- package/lib/Socket/groups.js +347 -0
- package/lib/Socket/index.d.ts +522 -0
- package/lib/Socket/index.js +11 -0
- package/lib/Socket/messages-recv.d.ts +326 -0
- package/lib/Socket/messages-recv.js +1822 -0
- package/lib/Socket/messages-send.d.ts +321 -0
- package/lib/Socket/messages-send.js +1378 -0
- package/lib/Socket/mex.d.ts +1 -0
- package/lib/Socket/mex.js +41 -0
- package/lib/Socket/newsletter.d.ts +283 -0
- package/lib/Socket/newsletter.js +225 -0
- package/lib/Socket/socket.d.ts +61 -0
- package/lib/Socket/socket.js +992 -0
- package/lib/Store/index.d.ts +3 -0
- package/lib/Store/index.js +3 -0
- package/lib/Store/make-in-memory-store.d.ts +63 -0
- package/lib/Store/make-in-memory-store.js +419 -0
- package/lib/Store/make-ordered-dictionary.d.ts +12 -0
- package/lib/Store/make-ordered-dictionary.js +78 -0
- package/lib/Store/object-repository.d.ts +10 -0
- package/lib/Store/object-repository.js +23 -0
- package/lib/Transport/crypto.d.ts +6 -0
- package/lib/Transport/crypto.js +61 -0
- package/lib/Transport/curve.d.ts +8 -0
- package/lib/Transport/curve.js +66 -0
- package/lib/Transport/index.d.ts +16 -0
- package/lib/Transport/index.js +9 -0
- package/lib/Transport/internals.d.ts +57 -0
- package/lib/Transport/internals.js +155 -0
- package/lib/Transport/session-builder.d.ts +40 -0
- package/lib/Transport/session-builder.js +143 -0
- package/lib/Transport/session-cipher.d.ts +26 -0
- package/lib/Transport/session-cipher.js +301 -0
- package/lib/Transport/session-record.d.ts +55 -0
- package/lib/Transport/session-record.js +272 -0
- package/lib/Types/Auth.d.ts +1 -0
- package/lib/Types/Auth.js +1 -0
- package/lib/Types/Bussines.d.ts +1 -0
- package/lib/Types/Bussines.js +1 -0
- package/lib/Types/Call.d.ts +1 -0
- package/lib/Types/Call.js +1 -0
- package/lib/Types/Chat.d.ts +1 -0
- package/lib/Types/Chat.js +7 -0
- package/lib/Types/Contact.d.ts +1 -0
- package/lib/Types/Contact.js +1 -0
- package/lib/Types/Events.d.ts +1 -0
- package/lib/Types/Events.js +1 -0
- package/lib/Types/GroupMetadata.d.ts +1 -0
- package/lib/Types/GroupMetadata.js +1 -0
- package/lib/Types/Label.d.ts +2 -0
- package/lib/Types/Label.js +24 -0
- package/lib/Types/LabelAssociation.d.ts +2 -0
- package/lib/Types/LabelAssociation.js +6 -0
- package/lib/Types/Message.d.ts +11 -0
- package/lib/Types/Message.js +17 -0
- package/lib/Types/Mex.d.ts +2 -0
- package/lib/Types/Mex.js +38 -0
- package/lib/Types/Product.d.ts +1 -0
- package/lib/Types/Product.js +1 -0
- package/lib/Types/RichType.d.ts +2 -0
- package/lib/Types/RichType.js +22 -0
- package/lib/Types/Signal.d.ts +1 -0
- package/lib/Types/Signal.js +1 -0
- package/lib/Types/Socket.d.ts +1 -0
- package/lib/Types/Socket.js +1 -0
- package/lib/Types/State.d.ts +5 -0
- package/lib/Types/State.js +54 -0
- package/lib/Types/USync.d.ts +1 -0
- package/lib/Types/USync.js +1 -0
- package/lib/Types/index.d.ts +13 -0
- package/lib/Types/index.js +25 -0
- package/lib/Utils/auth-utils.d.ts +58 -0
- package/lib/Utils/auth-utils.js +316 -0
- package/lib/Utils/browser-utils.d.ts +9 -0
- package/lib/Utils/browser-utils.js +28 -0
- package/lib/Utils/business.d.ts +49 -0
- package/lib/Utils/business.js +230 -0
- package/lib/Utils/chat-utils.d.ts +408 -0
- package/lib/Utils/chat-utils.js +871 -0
- package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
- package/lib/Utils/companion-reg-client-utils.js +39 -0
- package/lib/Utils/crypto.d.ts +39 -0
- package/lib/Utils/crypto.js +117 -0
- package/lib/Utils/decode-wa-message.d.ts +83 -0
- package/lib/Utils/decode-wa-message.js +316 -0
- package/lib/Utils/event-buffer.d.ts +12 -0
- package/lib/Utils/event-buffer.js +621 -0
- package/lib/Utils/generics.d.ts +63 -0
- package/lib/Utils/generics.js +394 -0
- package/lib/Utils/history.d.ts +75 -0
- package/lib/Utils/history.js +133 -0
- package/lib/Utils/identity-change-handler.d.ts +13 -0
- package/lib/Utils/identity-change-handler.js +48 -0
- package/lib/Utils/index.d.ts +24 -0
- package/lib/Utils/index.js +24 -0
- package/lib/Utils/link-preview.d.ts +13 -0
- package/lib/Utils/link-preview.js +73 -0
- package/lib/Utils/logger.d.ts +12 -0
- package/lib/Utils/logger.js +12 -0
- package/lib/Utils/lt-hash.d.ts +6 -0
- package/lib/Utils/lt-hash.js +7 -0
- package/lib/Utils/make-mutex.d.ts +6 -0
- package/lib/Utils/make-mutex.js +32 -0
- package/lib/Utils/message-retry-manager.d.ts +79 -0
- package/lib/Utils/message-retry-manager.js +259 -0
- package/lib/Utils/messages-media.d.ts +134 -0
- package/lib/Utils/messages-media.js +802 -0
- package/lib/Utils/messages.d.ts +47 -0
- package/lib/Utils/messages.js +1911 -0
- package/lib/Utils/noise-handler.d.ts +20 -0
- package/lib/Utils/noise-handler.js +200 -0
- package/lib/Utils/offline-node-processor.d.ts +10 -0
- package/lib/Utils/offline-node-processor.js +40 -0
- package/lib/Utils/pre-key-manager.d.ts +25 -0
- package/lib/Utils/pre-key-manager.js +105 -0
- package/lib/Utils/process-message.d.ts +83 -0
- package/lib/Utils/process-message.js +748 -0
- package/lib/Utils/reporting-utils.d.ts +12 -0
- package/lib/Utils/reporting-utils.js +257 -0
- package/lib/Utils/rich-message-utils.d.ts +48 -0
- package/lib/Utils/rich-message-utils.js +369 -0
- package/lib/Utils/signal.d.ts +82 -0
- package/lib/Utils/signal.js +200 -0
- package/lib/Utils/stanza-ack.d.ts +16 -0
- package/lib/Utils/stanza-ack.js +37 -0
- package/lib/Utils/sync-action-utils.d.ts +2 -0
- package/lib/Utils/sync-action-utils.js +48 -0
- package/lib/Utils/tc-token-utils.d.ts +29 -0
- package/lib/Utils/tc-token-utils.js +163 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +10 -0
- package/lib/Utils/use-multi-file-auth-state.js +116 -0
- package/lib/Utils/use-single-file-auth-state.d.ts +11 -0
- package/lib/Utils/use-single-file-auth-state.js +94 -0
- package/lib/Utils/use-sqlite-auth-state.d.ts +11 -0
- package/lib/Utils/use-sqlite-auth-state.js +109 -0
- package/lib/Utils/validate-connection.d.ts +44 -0
- package/lib/Utils/validate-connection.js +210 -0
- package/lib/WABinary/constants.d.ts +61 -0
- package/lib/WABinary/constants.js +1466 -0
- package/lib/WABinary/decode.d.ts +9 -0
- package/lib/WABinary/decode.js +261 -0
- package/lib/WABinary/encode.d.ts +2 -0
- package/lib/WABinary/encode.js +219 -0
- package/lib/WABinary/generic-utils.d.ts +79 -0
- package/lib/WABinary/generic-utils.js +228 -0
- package/lib/WABinary/index.d.ts +5 -0
- package/lib/WABinary/index.js +5 -0
- package/lib/WABinary/jid-utils.d.ts +28 -0
- package/lib/WABinary/jid-utils.js +95 -0
- package/lib/WABinary/types.d.ts +1 -0
- package/lib/WABinary/types.js +1 -0
- package/lib/WACrypto/appstate-keys.js +26 -0
- package/lib/WACrypto/curves/constants.js +12 -0
- package/lib/WACrypto/hkdf.js +27 -0
- package/lib/WACrypto/index.js +20 -0
- package/lib/WACrypto/lthash.js +54 -0
- package/lib/WACrypto/math/constants.js +24 -0
- package/lib/WACrypto/math/edwards.js +194 -0
- package/lib/WACrypto/math/fe.js +698 -0
- package/lib/WACrypto/math/le.js +23 -0
- package/lib/WACrypto/math/mod.js +15 -0
- package/lib/WACrypto/util/bytes.js +339 -0
- package/lib/WACrypto/x25519.js +145 -0
- package/lib/WACrypto/xeddsa.js +92 -0
- package/lib/WAM/BinaryInfo.d.ts +7 -0
- package/lib/WAM/BinaryInfo.js +9 -0
- package/lib/WAM/constants.d.ts +34926 -0
- package/lib/WAM/constants.js +22852 -0
- package/lib/WAM/encode.d.ts +1 -0
- package/lib/WAM/encode.js +149 -0
- package/lib/WAM/index.d.ts +3 -0
- package/lib/WAM/index.js +3 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
- package/lib/WAUSync/Protocols/USyncContactProtocol.js +51 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +22 -0
- package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +53 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
- package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
- package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
- package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +50 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
- package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
- package/lib/WAUSync/Protocols/index.d.ts +5 -0
- package/lib/WAUSync/Protocols/index.js +5 -0
- package/lib/WAUSync/USyncQuery.d.ts +20 -0
- package/lib/WAUSync/USyncQuery.js +97 -0
- package/lib/WAUSync/USyncUser.d.ts +16 -0
- package/lib/WAUSync/USyncUser.js +30 -0
- package/lib/WAUSync/index.d.ts +3 -0
- package/lib/WAUSync/index.js +3 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +11 -0
- package/package.json +79 -5
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var group_session_builder_exports = {};
|
|
29
|
+
__export(group_session_builder_exports, {
|
|
30
|
+
GroupSessionBuilder: () => GroupSessionBuilder
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(group_session_builder_exports);
|
|
33
|
+
var keyhelper = __toESM(require("./keyhelper.js"));
|
|
34
|
+
var import_sender_key_distribution_message = require("./sender-key-distribution-message.js");
|
|
35
|
+
var import_sender_key_name = require("./sender-key-name.js");
|
|
36
|
+
var import_sender_key_record = require("./sender-key-record.js");
|
|
37
|
+
class GroupSessionBuilder {
|
|
38
|
+
constructor(senderKeyStore) {
|
|
39
|
+
this.senderKeyStore = senderKeyStore;
|
|
40
|
+
}
|
|
41
|
+
async process(senderKeyName, senderKeyDistributionMessage) {
|
|
42
|
+
const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName);
|
|
43
|
+
senderKeyRecord.addSenderKeyState(senderKeyDistributionMessage.getId(), senderKeyDistributionMessage.getIteration(), senderKeyDistributionMessage.getChainKey(), senderKeyDistributionMessage.getSignatureKey());
|
|
44
|
+
await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord);
|
|
45
|
+
}
|
|
46
|
+
async create(senderKeyName) {
|
|
47
|
+
const senderKeyRecord = await this.senderKeyStore.loadSenderKey(senderKeyName);
|
|
48
|
+
if (senderKeyRecord.isEmpty()) {
|
|
49
|
+
const keyId = keyhelper.generateSenderKeyId();
|
|
50
|
+
const senderKey = keyhelper.generateSenderKey();
|
|
51
|
+
const signingKey = keyhelper.generateSenderSigningKey();
|
|
52
|
+
senderKeyRecord.setSenderKeyState(keyId, 0, senderKey, signingKey);
|
|
53
|
+
await this.senderKeyStore.storeSenderKey(senderKeyName, senderKeyRecord);
|
|
54
|
+
}
|
|
55
|
+
const state = senderKeyRecord.getSenderKeyState();
|
|
56
|
+
if (!state) {
|
|
57
|
+
throw new Error("No session state available");
|
|
58
|
+
}
|
|
59
|
+
return new import_sender_key_distribution_message.SenderKeyDistributionMessage(state.getKeyId(), state.getSenderChainKey().getIteration(), state.getSenderChainKey().getSeed(), state.getSigningKeyPublic());
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
GroupSessionBuilder
|
|
65
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { GroupSessionBuilder } from "./group-session-builder.js";
|
|
2
|
+
export { SenderKeyDistributionMessage } from "./sender-key-distribution-message.js";
|
|
3
|
+
export { SenderKeyRecord } from "./sender-key-record.js";
|
|
4
|
+
export { SenderKeyName } from "./sender-key-name.js";
|
|
5
|
+
export { GroupCipher } from "./group-cipher.js";
|
|
6
|
+
export { SenderKeyState } from "./sender-key-state.js";
|
|
7
|
+
export { SenderKeyMessage } from "./sender-key-message.js";
|
|
8
|
+
export { SenderMessageKey } from "./sender-message-key.js";
|
|
9
|
+
export { SenderChainKey } from "./sender-chain-key.js";
|
|
10
|
+
export { CiphertextMessage } from "./ciphertext-message.js";
|
|
11
|
+
export * as keyhelper from "./keyhelper.js";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var index_exports = {};
|
|
29
|
+
__export(index_exports, {
|
|
30
|
+
CiphertextMessage: () => import_ciphertext_message.CiphertextMessage,
|
|
31
|
+
GroupCipher: () => import_group_cipher.GroupCipher,
|
|
32
|
+
GroupSessionBuilder: () => import_group_session_builder.GroupSessionBuilder,
|
|
33
|
+
SenderChainKey: () => import_sender_chain_key.SenderChainKey,
|
|
34
|
+
SenderKeyDistributionMessage: () => import_sender_key_distribution_message.SenderKeyDistributionMessage,
|
|
35
|
+
SenderKeyMessage: () => import_sender_key_message.SenderKeyMessage,
|
|
36
|
+
SenderKeyName: () => import_sender_key_name.SenderKeyName,
|
|
37
|
+
SenderKeyRecord: () => import_sender_key_record.SenderKeyRecord,
|
|
38
|
+
SenderKeyState: () => import_sender_key_state.SenderKeyState,
|
|
39
|
+
SenderMessageKey: () => import_sender_message_key.SenderMessageKey,
|
|
40
|
+
keyhelper: () => keyhelper
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(index_exports);
|
|
43
|
+
var import_group_session_builder = require("./group-session-builder.js");
|
|
44
|
+
var import_sender_key_distribution_message = require("./sender-key-distribution-message.js");
|
|
45
|
+
var import_sender_key_record = require("./sender-key-record.js");
|
|
46
|
+
var import_sender_key_name = require("./sender-key-name.js");
|
|
47
|
+
var import_group_cipher = require("./group-cipher.js");
|
|
48
|
+
var import_sender_key_state = require("./sender-key-state.js");
|
|
49
|
+
var import_sender_key_message = require("./sender-key-message.js");
|
|
50
|
+
var import_sender_message_key = require("./sender-message-key.js");
|
|
51
|
+
var import_sender_chain_key = require("./sender-chain-key.js");
|
|
52
|
+
var import_ciphertext_message = require("./ciphertext-message.js");
|
|
53
|
+
var keyhelper = __toESM(require("./keyhelper.js"));
|
|
54
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
+
0 && (module.exports = {
|
|
56
|
+
CiphertextMessage,
|
|
57
|
+
GroupCipher,
|
|
58
|
+
GroupSessionBuilder,
|
|
59
|
+
SenderChainKey,
|
|
60
|
+
SenderKeyDistributionMessage,
|
|
61
|
+
SenderKeyMessage,
|
|
62
|
+
SenderKeyName,
|
|
63
|
+
SenderKeyRecord,
|
|
64
|
+
SenderKeyState,
|
|
65
|
+
SenderMessageKey,
|
|
66
|
+
keyhelper
|
|
67
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var keyhelper_exports = {};
|
|
19
|
+
__export(keyhelper_exports, {
|
|
20
|
+
generateSenderKey: () => generateSenderKey,
|
|
21
|
+
generateSenderKeyId: () => generateSenderKeyId,
|
|
22
|
+
generateSenderSigningKey: () => generateSenderSigningKey
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(keyhelper_exports);
|
|
25
|
+
var import_node_crypto = require("node:crypto");
|
|
26
|
+
var import_Transport = require("../../Transport/index.js");
|
|
27
|
+
function generateSenderKey() {
|
|
28
|
+
return (0, import_node_crypto.randomBytes)(32);
|
|
29
|
+
}
|
|
30
|
+
function generateSenderKeyId() {
|
|
31
|
+
return (0, import_node_crypto.randomInt)(2147483647);
|
|
32
|
+
}
|
|
33
|
+
function generateSenderSigningKey(key) {
|
|
34
|
+
if (!key) {
|
|
35
|
+
key = import_Transport.curve.generateKeyPair();
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
public: Buffer.from(key.pubKey),
|
|
39
|
+
private: Buffer.from(key.privKey)
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
generateSenderKey,
|
|
45
|
+
generateSenderKeyId,
|
|
46
|
+
generateSenderSigningKey
|
|
47
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class SenderChainKey {
|
|
2
|
+
constructor(iteration: any, chainKey: any);
|
|
3
|
+
MESSAGE_KEY_SEED: any;
|
|
4
|
+
CHAIN_KEY_SEED: any;
|
|
5
|
+
iteration: any;
|
|
6
|
+
chainKey: any;
|
|
7
|
+
getIteration(): any;
|
|
8
|
+
getSenderMessageKey(): SenderMessageKey;
|
|
9
|
+
getNext(): SenderChainKey;
|
|
10
|
+
getSeed(): any;
|
|
11
|
+
getDerivative(seed: any, key: any): any;
|
|
12
|
+
}
|
|
13
|
+
import { SenderMessageKey } from './sender-message-key.js';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var sender_chain_key_exports = {};
|
|
19
|
+
__export(sender_chain_key_exports, {
|
|
20
|
+
SenderChainKey: () => SenderChainKey
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sender_chain_key_exports);
|
|
23
|
+
var import_Transport = require("../../Transport/index.js");
|
|
24
|
+
var import_sender_message_key = require("./sender-message-key.js");
|
|
25
|
+
class SenderChainKey {
|
|
26
|
+
constructor(iteration, chainKey) {
|
|
27
|
+
this.MESSAGE_KEY_SEED = Buffer.from([1]);
|
|
28
|
+
this.CHAIN_KEY_SEED = Buffer.from([2]);
|
|
29
|
+
this.iteration = iteration;
|
|
30
|
+
this.chainKey = Buffer.from(chainKey);
|
|
31
|
+
}
|
|
32
|
+
getIteration() {
|
|
33
|
+
return this.iteration;
|
|
34
|
+
}
|
|
35
|
+
getSenderMessageKey() {
|
|
36
|
+
return new import_sender_message_key.SenderMessageKey(this.iteration, this.getDerivative(this.MESSAGE_KEY_SEED, this.chainKey));
|
|
37
|
+
}
|
|
38
|
+
getNext() {
|
|
39
|
+
return new SenderChainKey(this.iteration + 1, this.getDerivative(this.CHAIN_KEY_SEED, this.chainKey));
|
|
40
|
+
}
|
|
41
|
+
getSeed() {
|
|
42
|
+
return this.chainKey;
|
|
43
|
+
}
|
|
44
|
+
getDerivative(seed, key) {
|
|
45
|
+
return import_Transport.crypto.calculateMAC(key, seed);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
SenderChainKey
|
|
51
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class SenderKeyDistributionMessage extends CiphertextMessage {
|
|
2
|
+
constructor(id: any, iteration: any, chainKey: any, signatureKey: any, serialized: any);
|
|
3
|
+
serialized: any;
|
|
4
|
+
id: any;
|
|
5
|
+
iteration: any;
|
|
6
|
+
chainKey: any;
|
|
7
|
+
signatureKey: any;
|
|
8
|
+
intsToByteHighAndLow(highValue: any, lowValue: any): number;
|
|
9
|
+
serialize(): any;
|
|
10
|
+
getType(): number;
|
|
11
|
+
getIteration(): any;
|
|
12
|
+
getChainKey(): any;
|
|
13
|
+
getSignatureKey(): any;
|
|
14
|
+
getId(): any;
|
|
15
|
+
}
|
|
16
|
+
import { CiphertextMessage } from './ciphertext-message.js';
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var sender_key_distribution_message_exports = {};
|
|
19
|
+
__export(sender_key_distribution_message_exports, {
|
|
20
|
+
SenderKeyDistributionMessage: () => SenderKeyDistributionMessage
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sender_key_distribution_message_exports);
|
|
23
|
+
var import_WAProto = require("../../../WAProto/index.js");
|
|
24
|
+
var import_ciphertext_message = require("./ciphertext-message.js");
|
|
25
|
+
class SenderKeyDistributionMessage extends import_ciphertext_message.CiphertextMessage {
|
|
26
|
+
constructor(id, iteration, chainKey, signatureKey, serialized) {
|
|
27
|
+
super();
|
|
28
|
+
if (serialized) {
|
|
29
|
+
try {
|
|
30
|
+
const message = serialized.slice(1);
|
|
31
|
+
const distributionMessage = import_WAProto.proto.SenderKeyDistributionMessage.decode(message).toJSON();
|
|
32
|
+
this.serialized = serialized;
|
|
33
|
+
this.id = distributionMessage.id;
|
|
34
|
+
this.iteration = distributionMessage.iteration;
|
|
35
|
+
this.chainKey = typeof distributionMessage.chainKey === "string" ? Buffer.from(distributionMessage.chainKey, "base64") : distributionMessage.chainKey;
|
|
36
|
+
this.signatureKey = typeof distributionMessage.signingKey === "string" ? Buffer.from(distributionMessage.signingKey, "base64") : distributionMessage.signingKey;
|
|
37
|
+
} catch (e) {
|
|
38
|
+
throw new Error(String(e));
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
const version = this.intsToByteHighAndLow(this.CURRENT_VERSION, this.CURRENT_VERSION);
|
|
42
|
+
this.id = id;
|
|
43
|
+
this.iteration = iteration;
|
|
44
|
+
this.chainKey = chainKey;
|
|
45
|
+
this.signatureKey = signatureKey;
|
|
46
|
+
const message = import_WAProto.proto.SenderKeyDistributionMessage.encode(import_WAProto.proto.SenderKeyDistributionMessage.create({
|
|
47
|
+
id,
|
|
48
|
+
iteration,
|
|
49
|
+
chainKey,
|
|
50
|
+
signingKey: this.signatureKey
|
|
51
|
+
})).finish();
|
|
52
|
+
this.serialized = Buffer.concat([Buffer.from([version]), message]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
intsToByteHighAndLow(highValue, lowValue) {
|
|
56
|
+
return ((highValue << 4 | lowValue) & 255) % 256;
|
|
57
|
+
}
|
|
58
|
+
serialize() {
|
|
59
|
+
return this.serialized;
|
|
60
|
+
}
|
|
61
|
+
getType() {
|
|
62
|
+
return this.SENDERKEY_DISTRIBUTION_TYPE;
|
|
63
|
+
}
|
|
64
|
+
getIteration() {
|
|
65
|
+
return this.iteration;
|
|
66
|
+
}
|
|
67
|
+
getChainKey() {
|
|
68
|
+
return this.chainKey;
|
|
69
|
+
}
|
|
70
|
+
getSignatureKey() {
|
|
71
|
+
return this.signatureKey;
|
|
72
|
+
}
|
|
73
|
+
getId() {
|
|
74
|
+
return this.id;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
78
|
+
0 && (module.exports = {
|
|
79
|
+
SenderKeyDistributionMessage
|
|
80
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class SenderKeyMessage extends CiphertextMessage {
|
|
2
|
+
constructor(keyId: any, iteration: any, ciphertext: any, signatureKey: any, serialized: any);
|
|
3
|
+
SIGNATURE_LENGTH: number;
|
|
4
|
+
serialized: any;
|
|
5
|
+
messageVersion: number;
|
|
6
|
+
keyId: any;
|
|
7
|
+
iteration: any;
|
|
8
|
+
ciphertext: any;
|
|
9
|
+
signature: any;
|
|
10
|
+
getKeyId(): any;
|
|
11
|
+
getIteration(): any;
|
|
12
|
+
getCipherText(): any;
|
|
13
|
+
verifySignature(signatureKey: any): void;
|
|
14
|
+
getSignature(signatureKey: any, serialized: any): any;
|
|
15
|
+
serialize(): any;
|
|
16
|
+
getType(): number;
|
|
17
|
+
}
|
|
18
|
+
import { CiphertextMessage } from './ciphertext-message.js';
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var sender_key_message_exports = {};
|
|
19
|
+
__export(sender_key_message_exports, {
|
|
20
|
+
SenderKeyMessage: () => SenderKeyMessage
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sender_key_message_exports);
|
|
23
|
+
var import_WAProto = require("../../../WAProto/index.js");
|
|
24
|
+
var import_Transport = require("../../Transport/index.js");
|
|
25
|
+
var import_ciphertext_message = require("./ciphertext-message.js");
|
|
26
|
+
class SenderKeyMessage extends import_ciphertext_message.CiphertextMessage {
|
|
27
|
+
constructor(keyId, iteration, ciphertext, signatureKey, serialized) {
|
|
28
|
+
super();
|
|
29
|
+
this.SIGNATURE_LENGTH = 64;
|
|
30
|
+
if (serialized) {
|
|
31
|
+
const version = serialized[0];
|
|
32
|
+
const message = serialized.slice(1, serialized.length - this.SIGNATURE_LENGTH);
|
|
33
|
+
const signature = serialized.slice(-1 * this.SIGNATURE_LENGTH);
|
|
34
|
+
const senderKeyMessage = import_WAProto.proto.SenderKeyMessage.decode(message).toJSON();
|
|
35
|
+
this.serialized = serialized;
|
|
36
|
+
this.messageVersion = (version & 255) >> 4;
|
|
37
|
+
this.keyId = senderKeyMessage.id;
|
|
38
|
+
this.iteration = senderKeyMessage.iteration;
|
|
39
|
+
this.ciphertext = typeof senderKeyMessage.ciphertext === "string" ? Buffer.from(senderKeyMessage.ciphertext, "base64") : senderKeyMessage.ciphertext;
|
|
40
|
+
this.signature = signature;
|
|
41
|
+
} else {
|
|
42
|
+
const version = ((this.CURRENT_VERSION << 4 | this.CURRENT_VERSION) & 255) % 256;
|
|
43
|
+
const ciphertextBuffer = Buffer.from(ciphertext);
|
|
44
|
+
const message = import_WAProto.proto.SenderKeyMessage.encode(import_WAProto.proto.SenderKeyMessage.create({
|
|
45
|
+
id: keyId,
|
|
46
|
+
iteration,
|
|
47
|
+
ciphertext: ciphertextBuffer
|
|
48
|
+
})).finish();
|
|
49
|
+
const signature = this.getSignature(signatureKey, Buffer.concat([Buffer.from([version]), message]));
|
|
50
|
+
this.serialized = Buffer.concat([Buffer.from([version]), message, Buffer.from(signature)]);
|
|
51
|
+
this.messageVersion = this.CURRENT_VERSION;
|
|
52
|
+
this.keyId = keyId;
|
|
53
|
+
this.iteration = iteration;
|
|
54
|
+
this.ciphertext = ciphertextBuffer;
|
|
55
|
+
this.signature = signature;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
getKeyId() {
|
|
59
|
+
return this.keyId;
|
|
60
|
+
}
|
|
61
|
+
getIteration() {
|
|
62
|
+
return this.iteration;
|
|
63
|
+
}
|
|
64
|
+
getCipherText() {
|
|
65
|
+
return this.ciphertext;
|
|
66
|
+
}
|
|
67
|
+
verifySignature(signatureKey) {
|
|
68
|
+
const part1 = this.serialized.slice(0, this.serialized.length - this.SIGNATURE_LENGTH);
|
|
69
|
+
const part2 = this.serialized.slice(-1 * this.SIGNATURE_LENGTH);
|
|
70
|
+
const res = import_Transport.curve.verifySignature(signatureKey, part1, part2);
|
|
71
|
+
if (!res)
|
|
72
|
+
throw new Error("Invalid signature!");
|
|
73
|
+
}
|
|
74
|
+
getSignature(signatureKey, serialized) {
|
|
75
|
+
return Buffer.from(import_Transport.curve.calculateSignature(signatureKey, serialized));
|
|
76
|
+
}
|
|
77
|
+
serialize() {
|
|
78
|
+
return this.serialized;
|
|
79
|
+
}
|
|
80
|
+
getType() {
|
|
81
|
+
return 4;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
85
|
+
0 && (module.exports = {
|
|
86
|
+
SenderKeyMessage
|
|
87
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var sender_key_name_exports = {};
|
|
19
|
+
__export(sender_key_name_exports, {
|
|
20
|
+
SenderKeyName: () => SenderKeyName
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sender_key_name_exports);
|
|
23
|
+
function isNull(str) {
|
|
24
|
+
return str === null || str === "";
|
|
25
|
+
}
|
|
26
|
+
function intValue(num) {
|
|
27
|
+
const MAX_VALUE = 2147483647;
|
|
28
|
+
const MIN_VALUE = -2147483648;
|
|
29
|
+
if (num > MAX_VALUE || num < MIN_VALUE) {
|
|
30
|
+
return num & 4294967295;
|
|
31
|
+
}
|
|
32
|
+
return num;
|
|
33
|
+
}
|
|
34
|
+
function hashCode(strKey) {
|
|
35
|
+
let hash = 0;
|
|
36
|
+
if (!isNull(strKey)) {
|
|
37
|
+
for (let i = 0; i < strKey.length; i++) {
|
|
38
|
+
hash = hash * 31 + strKey.charCodeAt(i);
|
|
39
|
+
hash = intValue(hash);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return hash;
|
|
43
|
+
}
|
|
44
|
+
class SenderKeyName {
|
|
45
|
+
constructor(groupId, sender) {
|
|
46
|
+
this.groupId = groupId;
|
|
47
|
+
this.sender = sender;
|
|
48
|
+
}
|
|
49
|
+
getGroupId() {
|
|
50
|
+
return this.groupId;
|
|
51
|
+
}
|
|
52
|
+
getSender() {
|
|
53
|
+
return this.sender;
|
|
54
|
+
}
|
|
55
|
+
serialize() {
|
|
56
|
+
return `${this.groupId}::${this.sender.id}::${this.sender.deviceId}`;
|
|
57
|
+
}
|
|
58
|
+
toString() {
|
|
59
|
+
return this.serialize();
|
|
60
|
+
}
|
|
61
|
+
equals(other) {
|
|
62
|
+
if (other === null)
|
|
63
|
+
return false;
|
|
64
|
+
return this.groupId === other.groupId && this.sender.toString() === other.sender.toString();
|
|
65
|
+
}
|
|
66
|
+
hashCode() {
|
|
67
|
+
return hashCode(this.groupId) ^ hashCode(this.sender.toString());
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
71
|
+
0 && (module.exports = {
|
|
72
|
+
SenderKeyName
|
|
73
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export class SenderKeyRecord {
|
|
2
|
+
static deserialize(data: any): SenderKeyRecord;
|
|
3
|
+
constructor(serialized: any);
|
|
4
|
+
MAX_STATES: number;
|
|
5
|
+
senderKeyStates: SenderKeyState[];
|
|
6
|
+
isEmpty(): boolean;
|
|
7
|
+
getSenderKeyState(keyId: any): SenderKeyState | undefined;
|
|
8
|
+
addSenderKeyState(id: any, iteration: any, chainKey: any, signatureKey: any): void;
|
|
9
|
+
setSenderKeyState(id: any, iteration: any, chainKey: any, keyPair: any): void;
|
|
10
|
+
serialize(): any[];
|
|
11
|
+
}
|
|
12
|
+
import { SenderKeyState } from './sender-key-state.js';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var sender_key_record_exports = {};
|
|
19
|
+
__export(sender_key_record_exports, {
|
|
20
|
+
SenderKeyRecord: () => SenderKeyRecord
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(sender_key_record_exports);
|
|
23
|
+
var import_generics = require("../../Utils/generics.js");
|
|
24
|
+
var import_sender_key_state = require("./sender-key-state.js");
|
|
25
|
+
class SenderKeyRecord {
|
|
26
|
+
constructor(serialized) {
|
|
27
|
+
this.MAX_STATES = 5;
|
|
28
|
+
this.senderKeyStates = [];
|
|
29
|
+
if (serialized) {
|
|
30
|
+
for (const structure of serialized) {
|
|
31
|
+
this.senderKeyStates.push(new import_sender_key_state.SenderKeyState(null, null, null, null, null, null, structure));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
isEmpty() {
|
|
36
|
+
return this.senderKeyStates.length === 0;
|
|
37
|
+
}
|
|
38
|
+
getSenderKeyState(keyId) {
|
|
39
|
+
if (keyId === void 0 && this.senderKeyStates.length) {
|
|
40
|
+
return this.senderKeyStates[this.senderKeyStates.length - 1];
|
|
41
|
+
}
|
|
42
|
+
return this.senderKeyStates.find((state) => state.getKeyId() === keyId);
|
|
43
|
+
}
|
|
44
|
+
addSenderKeyState(id, iteration, chainKey, signatureKey) {
|
|
45
|
+
this.senderKeyStates.push(new import_sender_key_state.SenderKeyState(id, iteration, chainKey, null, signatureKey));
|
|
46
|
+
if (this.senderKeyStates.length > this.MAX_STATES) {
|
|
47
|
+
this.senderKeyStates.shift();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
setSenderKeyState(id, iteration, chainKey, keyPair) {
|
|
51
|
+
this.senderKeyStates.length = 0;
|
|
52
|
+
this.senderKeyStates.push(new import_sender_key_state.SenderKeyState(id, iteration, chainKey, keyPair));
|
|
53
|
+
}
|
|
54
|
+
serialize() {
|
|
55
|
+
return this.senderKeyStates.map((state) => state.getStructure());
|
|
56
|
+
}
|
|
57
|
+
static deserialize(data) {
|
|
58
|
+
const str = Buffer.from(data).toString("utf-8");
|
|
59
|
+
const parsed = JSON.parse(str, import_generics.BufferJSON.reviver);
|
|
60
|
+
return new SenderKeyRecord(parsed);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
+
0 && (module.exports = {
|
|
65
|
+
SenderKeyRecord
|
|
66
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export class SenderKeyState {
|
|
2
|
+
constructor(id: any, iteration: any, chainKey: any, signatureKeyPair: any, signatureKeyPublic: any, signatureKeyPrivate: any, senderKeyStateStructure: any);
|
|
3
|
+
MAX_MESSAGE_KEYS: number;
|
|
4
|
+
senderKeyStateStructure: any;
|
|
5
|
+
getKeyId(): any;
|
|
6
|
+
getSenderChainKey(): SenderChainKey;
|
|
7
|
+
setSenderChainKey(chainKey: any): void;
|
|
8
|
+
getSigningKeyPublic(): any;
|
|
9
|
+
getSigningKeyPrivate(): any;
|
|
10
|
+
hasSenderMessageKey(iteration: any): any;
|
|
11
|
+
addSenderMessageKey(senderMessageKey: any): void;
|
|
12
|
+
removeSenderMessageKey(iteration: any): SenderMessageKey | null;
|
|
13
|
+
getStructure(): any;
|
|
14
|
+
}
|
|
15
|
+
import { SenderChainKey } from './sender-chain-key.js';
|
|
16
|
+
import { SenderMessageKey } from './sender-message-key.js';
|