slidge-whatsapp 0.2.5__cp311-cp311-manylinux_2_36_aarch64.whl → 0.2.7__cp311-cp311-manylinux_2_36_aarch64.whl
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.
Potentially problematic release.
This version of slidge-whatsapp might be problematic. Click here for more details.
- slidge_whatsapp/config.py +3 -0
- slidge_whatsapp/event.go +31 -26
- slidge_whatsapp/gateway.go +13 -9
- slidge_whatsapp/gateway.py +2 -2
- slidge_whatsapp/generated/_whatsapp.cpython-311-aarch64-linux-gnu.h +170 -170
- slidge_whatsapp/generated/_whatsapp.cpython-311-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +135 -135
- slidge_whatsapp/generated/whatsapp.c +1496 -1496
- slidge_whatsapp/generated/whatsapp.go +1137 -1137
- slidge_whatsapp/generated/whatsapp.py +1216 -1216
- slidge_whatsapp/generated/whatsapp_go.h +170 -170
- slidge_whatsapp/go.mod +15 -12
- slidge_whatsapp/go.sum +35 -29
- slidge_whatsapp/media/media.go +21 -11
- slidge_whatsapp/session.go +73 -66
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn.go +4 -4
- slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_darwin.go +0 -5
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +3 -0
- slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +40 -20
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/CHANGELOG.md +14 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/ffi.go +2 -2
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/fun.go +10 -2
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib.go +1 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib_unix.go +1 -1
- slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib_windows.go +1 -1
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/README.md +2 -7
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/callback.go +2 -1
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +8510 -5090
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +344 -150
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3.go +57 -23
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.c +4 -0
- slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.go +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/.gitignore +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/LICENSE +202 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/README.md +4 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid.go +35 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_gccgo.go +26 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.3.c +23 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.3.go +22 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.4.go +35 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.4.s +18 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.5.go +28 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.5.s +44 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/goid_slow.go +24 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_gccgo_go1.8.go +17 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.23.go +38 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.5.go +57 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.6.go +43 -0
- slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.9.go +37 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/CONTRIBUTING.md +43 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/README.md +31 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/console.go +20 -5
- slidge_whatsapp/vendor/github.com/rs/zerolog/log/log.go +131 -0
- slidge_whatsapp/vendor/github.com/rs/zerolog/log.go +1 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/sampler.go +4 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/writer.go +9 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/GroupCipher.go +17 -6
- slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/GroupSessionBuilder.go +17 -7
- slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/state/store/SenderKeyStore.go +4 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/keys/chain/ChainKey.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/keys/identity/IdentityKey.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/libsignal/logger/DefaultLogger.go +2 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/libsignal/session/Session.go +41 -17
- slidge_whatsapp/vendor/go.mau.fi/libsignal/session/SessionCipher.go +64 -30
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/IdentityKeyStore.go +5 -3
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/MessageKeyStore.go +6 -4
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/PreKeyStore.go +6 -4
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/SessionStore.go +8 -6
- slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/SignedPreKeyStore.go +7 -5
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/connlog.go +257 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/database.go +309 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/iter.go +233 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/json.go +47 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/log.go +129 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/massinsert.go +164 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/queryhelper.go +137 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/reflectscan.go +30 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/transaction.go +180 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgrades.go +250 -0
- slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgradetable.go +331 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exerrors/dualerror.go +33 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exerrors/must.go +23 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/cors.go +32 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/handleerrors.go +64 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/json.go +36 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/middleware.go +30 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exhttp/networkerror.go +37 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +76 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +88 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/returnonce.go +25 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/ringbuffer.go +139 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncmap.go +94 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncset.go +136 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/callermarshal.go +28 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/defaults.go +32 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/generics.go +45 -0
- slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/writer.go +81 -0
- slidge_whatsapp/vendor/go.mau.fi/util/ptr/ptr.go +43 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +27 -26
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +4 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/keys.go +5 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +27 -25
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +40 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/binary/encoder.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/broadcast.go +5 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +119 -37
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +29 -11
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download-to-file.go +63 -30
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +74 -34
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +61 -31
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +188 -152
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaconn.go +5 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaretry.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +444 -135
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +118 -31
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +78 -42
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +7 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +42 -18
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +9 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/privacysettings.go +10 -11
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/extra.go +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +983 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.proto +85 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +197 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.proto +13 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +279 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.proto +21 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +137 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.proto +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +313 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.proto +27 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1299 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.proto +112 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +514 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.proto +47 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +123 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.proto +7 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +720 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.proto +59 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/extra.go +3 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +365 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.proto +33 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1238 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.proto +105 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go +39 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go +354 -175
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.proto +5 -5
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +170 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go +29 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go +13 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go +344 -31
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.proto +26 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/{WAWebProtobufsCompanionReg.pb.go → WACompanionReg.pb.go} +184 -89
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/{WAWebProtobufsCompanionReg.proto → WACompanionReg.proto} +2 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go +173 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +78 -16
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +5 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +7428 -2151
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +373 -44
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +456 -135
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +198 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.proto +14 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go +162 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go +32 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.proto +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go +192 -52
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.proto +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go +60 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/extra.go +7 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go +39 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go +61 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +800 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +72 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +1344 -438
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +52 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go +27 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go +59 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +382 -78
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +563 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +4 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +25 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingfields.json +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingtoken.go +176 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +39 -21
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +261 -75
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +28 -16
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +3 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +85 -43
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/signal.go +75 -88
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +86 -65
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/lidmap.go +186 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +291 -167
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +155 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/03-message-secrets.sql +11 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/04-privacy-tokens.sql +8 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/05-account-jid-format.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/06-facebook-uuid.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/07-account-lid.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/08-lid-mapping.sql +5 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/09-decryption-buffer.sql +10 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/10-chat-db-lid-migration-ts.sql +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/upgrades.go +22 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +107 -56
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/botmap.go +210 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +13 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/group.go +15 -6
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +7 -8
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +18 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/update.go +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/upload.go +1 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +47 -29
- slidge_whatsapp/vendor/golang.org/x/exp/LICENSE +27 -0
- slidge_whatsapp/vendor/golang.org/x/exp/PATENTS +22 -0
- slidge_whatsapp/vendor/golang.org/x/exp/constraints/constraints.go +54 -0
- slidge_whatsapp/vendor/golang.org/x/net/http/httpguts/guts.go +50 -0
- slidge_whatsapp/vendor/golang.org/x/net/http/httpguts/httplex.go +347 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/.gitignore +2 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/ascii.go +53 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/ciphers.go +641 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/client_conn_pool.go +311 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +122 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_go124.go +61 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/config_pre_go124.go +16 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/databuffer.go +149 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/errors.go +145 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/flow.go +120 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +1702 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/gotrack.go +170 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/encode.go +245 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/hpack.go +523 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/huffman.go +226 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/static_table.go +188 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/tables.go +403 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +432 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/pipe.go +184 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +3350 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/timer.go +20 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +3287 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/unencrypted.go +32 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/write.go +381 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched.go +251 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_priority.go +451 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_random.go +77 -0
- slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_roundrobin.go +119 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/go118.go +13 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/idna10.0.0.go +769 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/idna9.0.0.go +717 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/pre_go118.go +11 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/punycode.go +217 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables10.0.0.go +4559 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables11.0.0.go +4653 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables12.0.0.go +4733 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables13.0.0.go +4959 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables15.0.0.go +5144 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/tables9.0.0.go +4486 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trie.go +51 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trie12.0.0.go +30 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trie13.0.0.go +30 -0
- slidge_whatsapp/vendor/golang.org/x/net/idna/trieval.go +119 -0
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/ascii.go +53 -0
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/headermap.go +115 -0
- slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/request.go +467 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_darwin.go +148 -1
- slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +16 -26
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +84 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +20 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +84 -0
- slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +20 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/security_windows.go +44 -5
- slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +4 -2
- slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +239 -0
- slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +9 -0
- slidge_whatsapp/vendor/golang.org/x/text/LICENSE +27 -0
- slidge_whatsapp/vendor/golang.org/x/text/PATENTS +22 -0
- slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule.go +336 -0
- slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +11 -0
- slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +14 -0
- slidge_whatsapp/vendor/golang.org/x/text/transform/transform.go +709 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/bidi.go +359 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/bracket.go +335 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/core.go +1071 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/prop.go +206 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +1815 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +1887 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +1923 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go +1955 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go +2042 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +1781 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/trieval.go +48 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/composition.go +512 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/forminfo.go +279 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/input.go +109 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/iter.go +458 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/normalize.go +610 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/readwriter.go +125 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +7657 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +7693 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +7710 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +7760 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go +7907 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +7637 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/transform.go +88 -0
- slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/trie.go +54 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +0 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +3 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +16 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/strs/{strings_unsafe_go121.go → strings_unsafe.go} +0 -2
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
- slidge_whatsapp/vendor/google.golang.org/protobuf/proto/merge.go +6 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +2 -0
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/{value_unsafe_go121.go → value_unsafe.go} +0 -2
- slidge_whatsapp/vendor/modules.txt +52 -13
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/METADATA +1 -1
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/RECORD +330 -184
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/WHEEL +1 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/CNAME +0 -1
- slidge_whatsapp/vendor/github.com/rs/zerolog/_config.yml +0 -1
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.raw +0 -23
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.raw +0 -7
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.raw +0 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go +0 -296
- slidge_whatsapp/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go +0 -94
- slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go +0 -98
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/LICENSE +0 -0
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.7.dist-info}/entry_points.txt +0 -0
|
@@ -35,6 +35,8 @@ import (
|
|
|
35
35
|
"go.mau.fi/whatsmeow/types/events"
|
|
36
36
|
)
|
|
37
37
|
|
|
38
|
+
const WebMessageIDPrefix = "3EB0"
|
|
39
|
+
|
|
38
40
|
// GenerateMessageID generates a random string that can be used as a message ID on WhatsApp.
|
|
39
41
|
//
|
|
40
42
|
// msgID := cli.GenerateMessageID()
|
|
@@ -52,7 +54,7 @@ func (cli *Client) GenerateMessageID() types.MessageID {
|
|
|
52
54
|
}
|
|
53
55
|
data = append(data, random.Bytes(16)...)
|
|
54
56
|
hash := sha256.Sum256(data)
|
|
55
|
-
return
|
|
57
|
+
return WebMessageIDPrefix + strings.ToUpper(hex.EncodeToString(hash[:9]))
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
func GenerateFacebookMessageID() int64 {
|
|
@@ -67,7 +69,7 @@ func GenerateFacebookMessageID() int64 {
|
|
|
67
69
|
//
|
|
68
70
|
// Deprecated: WhatsApp web has switched to using a hash of the current timestamp, user id and random bytes. Use Client.GenerateMessageID instead.
|
|
69
71
|
func GenerateMessageID() types.MessageID {
|
|
70
|
-
return
|
|
72
|
+
return WebMessageIDPrefix + strings.ToUpper(hex.EncodeToString(random.Bytes(8)))
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
type MessageDebugTimings struct {
|
|
@@ -114,6 +116,10 @@ type SendResponse struct {
|
|
|
114
116
|
|
|
115
117
|
// Message handling duration, used for debugging
|
|
116
118
|
DebugTimings MessageDebugTimings
|
|
119
|
+
|
|
120
|
+
// The identity the message was sent with (LID or PN)
|
|
121
|
+
// This is currently not reliable in all cases.
|
|
122
|
+
Sender types.JID
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
// SendRequestExtra contains the optional parameters for SendMessage.
|
|
@@ -140,6 +146,8 @@ type SendRequestExtra struct {
|
|
|
140
146
|
Timeout time.Duration
|
|
141
147
|
// When sending media to newsletters, the Handle field returned by the file upload.
|
|
142
148
|
MediaHandle string
|
|
149
|
+
|
|
150
|
+
Meta *types.MsgMetaInfo
|
|
143
151
|
}
|
|
144
152
|
|
|
145
153
|
// SendMessage sends the given message.
|
|
@@ -215,17 +223,19 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E
|
|
|
215
223
|
}
|
|
216
224
|
|
|
217
225
|
isBotMode := isInlineBotMode || to.IsBot()
|
|
218
|
-
|
|
226
|
+
needsMessageSecret := isBotMode || cli.shouldIncludeReportingToken(message)
|
|
227
|
+
var extraParams nodeExtraParams
|
|
219
228
|
|
|
220
|
-
if
|
|
229
|
+
if needsMessageSecret {
|
|
221
230
|
if message.MessageContextInfo == nil {
|
|
222
231
|
message.MessageContextInfo = &waE2E.MessageContextInfo{}
|
|
223
232
|
}
|
|
224
|
-
|
|
225
233
|
if message.MessageContextInfo.MessageSecret == nil {
|
|
226
234
|
message.MessageContextInfo.MessageSecret = random.Bytes(32)
|
|
227
235
|
}
|
|
236
|
+
}
|
|
228
237
|
|
|
238
|
+
if isBotMode {
|
|
229
239
|
if message.MessageContextInfo.BotMetadata == nil {
|
|
230
240
|
message.MessageContextInfo.BotMetadata = &waE2E.BotMetadata{
|
|
231
241
|
PersonaID: proto.String("867051314767696$760019659443059"),
|
|
@@ -261,8 +271,8 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E
|
|
|
261
271
|
return
|
|
262
272
|
}
|
|
263
273
|
|
|
264
|
-
participantNodes, _ := cli.encryptMessageForDevices(ctx, []types.JID{req.InlineBotJID},
|
|
265
|
-
botNode = &waBinary.Node{
|
|
274
|
+
participantNodes, _ := cli.encryptMessageForDevices(ctx, []types.JID{req.InlineBotJID}, resp.ID, messagePlaintext, nil, waBinary.Attrs{})
|
|
275
|
+
extraParams.botNode = &waBinary.Node{
|
|
266
276
|
Tag: "bot",
|
|
267
277
|
Attrs: nil,
|
|
268
278
|
Content: participantNodes,
|
|
@@ -270,6 +280,53 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E
|
|
|
270
280
|
}
|
|
271
281
|
}
|
|
272
282
|
|
|
283
|
+
var groupParticipants []types.JID
|
|
284
|
+
if to.Server == types.GroupServer || to.Server == types.BroadcastServer {
|
|
285
|
+
start := time.Now()
|
|
286
|
+
if to.Server == types.GroupServer {
|
|
287
|
+
var cachedData *groupMetaCache
|
|
288
|
+
cachedData, err = cli.getCachedGroupData(ctx, to)
|
|
289
|
+
if err != nil {
|
|
290
|
+
err = fmt.Errorf("failed to get group members: %w", err)
|
|
291
|
+
return
|
|
292
|
+
}
|
|
293
|
+
groupParticipants = cachedData.Members
|
|
294
|
+
// TODO this is fairly hacky, is there a proper way to determine which identity the message is sent with?
|
|
295
|
+
if cachedData.AddressingMode == types.AddressingModeLID {
|
|
296
|
+
ownID = cli.getOwnLID()
|
|
297
|
+
extraParams.addressingMode = types.AddressingModeLID
|
|
298
|
+
} else if cachedData.CommunityAnnouncementGroup && req.Meta != nil {
|
|
299
|
+
ownID = cli.getOwnLID()
|
|
300
|
+
// Why is this set to PN?
|
|
301
|
+
extraParams.addressingMode = types.AddressingModePN
|
|
302
|
+
}
|
|
303
|
+
} else {
|
|
304
|
+
groupParticipants, err = cli.getBroadcastListParticipants(ctx, to)
|
|
305
|
+
if err != nil {
|
|
306
|
+
err = fmt.Errorf("failed to get broadcast list members: %w", err)
|
|
307
|
+
return
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
resp.DebugTimings.GetParticipants = time.Since(start)
|
|
311
|
+
} else if to.Server == types.HiddenUserServer {
|
|
312
|
+
ownID = cli.getOwnLID()
|
|
313
|
+
}
|
|
314
|
+
if req.Meta != nil {
|
|
315
|
+
extraParams.metaNode = &waBinary.Node{
|
|
316
|
+
Tag: "meta",
|
|
317
|
+
Attrs: waBinary.Attrs{},
|
|
318
|
+
}
|
|
319
|
+
if req.Meta.DeprecatedLIDSession != nil {
|
|
320
|
+
extraParams.metaNode.Attrs["deprecated_lid_session"] = *req.Meta.DeprecatedLIDSession
|
|
321
|
+
}
|
|
322
|
+
if req.Meta.ThreadMessageID != "" {
|
|
323
|
+
extraParams.metaNode.Attrs["thread_msg_id"] = req.Meta.ThreadMessageID
|
|
324
|
+
extraParams.metaNode.Attrs["thread_msg_sender_jid"] = req.Meta.ThreadMessageSenderJID
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
resp.Sender = ownID
|
|
329
|
+
|
|
273
330
|
start := time.Now()
|
|
274
331
|
// Sending multiple messages at a time can cause weird issues and makes it harder to retry safely
|
|
275
332
|
cli.messageSendLock.Lock()
|
|
@@ -283,7 +340,7 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E
|
|
|
283
340
|
}
|
|
284
341
|
|
|
285
342
|
if message.GetMessageContextInfo().GetMessageSecret() != nil {
|
|
286
|
-
err = cli.Store.MsgSecrets.PutMessageSecret(to, ownID, req.ID, message.GetMessageContextInfo().GetMessageSecret())
|
|
343
|
+
err = cli.Store.MsgSecrets.PutMessageSecret(ctx, to, ownID, req.ID, message.GetMessageContextInfo().GetMessageSecret())
|
|
287
344
|
if err != nil {
|
|
288
345
|
cli.Log.Warnf("Failed to store message secret key for outgoing message %s: %v", req.ID, err)
|
|
289
346
|
} else {
|
|
@@ -294,12 +351,12 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E
|
|
|
294
351
|
var data []byte
|
|
295
352
|
switch to.Server {
|
|
296
353
|
case types.GroupServer, types.BroadcastServer:
|
|
297
|
-
phash, data, err = cli.sendGroup(ctx, to,
|
|
298
|
-
case types.DefaultUserServer:
|
|
354
|
+
phash, data, err = cli.sendGroup(ctx, ownID, to, groupParticipants, req.ID, message, &resp.DebugTimings, extraParams)
|
|
355
|
+
case types.DefaultUserServer, types.BotServer, types.HiddenUserServer:
|
|
299
356
|
if req.Peer {
|
|
300
|
-
data, err = cli.sendPeerMessage(to, req.ID, message, &resp.DebugTimings)
|
|
357
|
+
data, err = cli.sendPeerMessage(ctx, to, req.ID, message, &resp.DebugTimings)
|
|
301
358
|
} else {
|
|
302
|
-
data, err = cli.sendDM(ctx,
|
|
359
|
+
data, err = cli.sendDM(ctx, ownID, to, req.ID, message, &resp.DebugTimings, extraParams)
|
|
303
360
|
}
|
|
304
361
|
case types.NewsletterServer:
|
|
305
362
|
data, err = cli.sendNewsletter(to, req.ID, message, req.MediaHandle, &resp.DebugTimings)
|
|
@@ -348,9 +405,9 @@ func (cli *Client) SendMessage(ctx context.Context, to types.JID, message *waE2E
|
|
|
348
405
|
if len(expectedPHash) > 0 && phash != expectedPHash {
|
|
349
406
|
cli.Log.Warnf("Server returned different participant list hash when sending to %s. Some devices may not have received the message.", to)
|
|
350
407
|
// TODO also invalidate device list caches
|
|
351
|
-
cli.
|
|
352
|
-
delete(cli.
|
|
353
|
-
cli.
|
|
408
|
+
cli.groupCacheLock.Lock()
|
|
409
|
+
delete(cli.groupCache, to)
|
|
410
|
+
cli.groupCacheLock.Unlock()
|
|
354
411
|
}
|
|
355
412
|
return
|
|
356
413
|
}
|
|
@@ -373,9 +430,9 @@ func (cli *Client) BuildMessageKey(chat, sender types.JID, id types.MessageID) *
|
|
|
373
430
|
ID: proto.String(id),
|
|
374
431
|
RemoteJID: proto.String(chat.String()),
|
|
375
432
|
}
|
|
376
|
-
if !sender.IsEmpty() && sender.User != cli.getOwnID().User {
|
|
433
|
+
if !sender.IsEmpty() && sender.User != cli.getOwnID().User && sender.User != cli.getOwnLID().User {
|
|
377
434
|
key.FromMe = proto.Bool(false)
|
|
378
|
-
if chat.Server != types.DefaultUserServer && chat.Server != types.MessengerServer {
|
|
435
|
+
if chat.Server != types.DefaultUserServer && chat.Server != types.HiddenUserServer && chat.Server != types.MessengerServer {
|
|
379
436
|
key.Participant = proto.String(sender.ToNonAD().String())
|
|
380
437
|
}
|
|
381
438
|
}
|
|
@@ -523,7 +580,7 @@ func ParseDisappearingTimerString(val string) (time.Duration, bool) {
|
|
|
523
580
|
// In groups, the server will echo the change as a notification, so it'll show up as a *events.GroupInfo update.
|
|
524
581
|
func (cli *Client) SetDisappearingTimer(chat types.JID, timer time.Duration) (err error) {
|
|
525
582
|
switch chat.Server {
|
|
526
|
-
case types.DefaultUserServer:
|
|
583
|
+
case types.DefaultUserServer, types.HiddenUserServer:
|
|
527
584
|
_, err = cli.SendMessage(context.TODO(), chat, &waE2E.Message{
|
|
528
585
|
ProtocolMessage: &waE2E.ProtocolMessage{
|
|
529
586
|
Type: waE2E.ProtocolMessage_EPHEMERAL_SETTING.Enum(),
|
|
@@ -561,7 +618,13 @@ func participantListHashV2(participants []types.JID) string {
|
|
|
561
618
|
return fmt.Sprintf("2:%s", base64.RawStdEncoding.EncodeToString(hash[:6]))
|
|
562
619
|
}
|
|
563
620
|
|
|
564
|
-
func (cli *Client) sendNewsletter(
|
|
621
|
+
func (cli *Client) sendNewsletter(
|
|
622
|
+
to types.JID,
|
|
623
|
+
id types.MessageID,
|
|
624
|
+
message *waE2E.Message,
|
|
625
|
+
mediaID string,
|
|
626
|
+
timings *MessageDebugTimings,
|
|
627
|
+
) ([]byte, error) {
|
|
565
628
|
attrs := waBinary.Attrs{
|
|
566
629
|
"to": to,
|
|
567
630
|
"id": id,
|
|
@@ -588,8 +651,10 @@ func (cli *Client) sendNewsletter(to types.JID, id types.MessageID, message *waE
|
|
|
588
651
|
Content: plaintext,
|
|
589
652
|
Attrs: waBinary.Attrs{},
|
|
590
653
|
}
|
|
591
|
-
if
|
|
592
|
-
|
|
654
|
+
if message != nil {
|
|
655
|
+
if mediaType := getMediaTypeFromMessage(message); mediaType != "" {
|
|
656
|
+
plaintextNode.Attrs["mediatype"] = mediaType
|
|
657
|
+
}
|
|
593
658
|
}
|
|
594
659
|
node := waBinary.Node{
|
|
595
660
|
Tag: "message",
|
|
@@ -605,24 +670,23 @@ func (cli *Client) sendNewsletter(to types.JID, id types.MessageID, message *waE
|
|
|
605
670
|
return data, nil
|
|
606
671
|
}
|
|
607
672
|
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
673
|
+
type nodeExtraParams struct {
|
|
674
|
+
botNode *waBinary.Node
|
|
675
|
+
metaNode *waBinary.Node
|
|
676
|
+
addressingMode types.AddressingMode
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
func (cli *Client) sendGroup(
|
|
680
|
+
ctx context.Context,
|
|
681
|
+
ownID,
|
|
682
|
+
to types.JID,
|
|
683
|
+
participants []types.JID,
|
|
684
|
+
id types.MessageID,
|
|
685
|
+
message *waE2E.Message,
|
|
686
|
+
timings *MessageDebugTimings,
|
|
687
|
+
extraParams nodeExtraParams,
|
|
688
|
+
) (string, []byte, error) {
|
|
611
689
|
start := time.Now()
|
|
612
|
-
if to.Server == types.GroupServer {
|
|
613
|
-
participants, err = cli.getGroupMembers(ctx, to)
|
|
614
|
-
if err != nil {
|
|
615
|
-
return "", nil, fmt.Errorf("failed to get group members: %w", err)
|
|
616
|
-
}
|
|
617
|
-
} else {
|
|
618
|
-
// TODO use context
|
|
619
|
-
participants, err = cli.getBroadcastListParticipants(to)
|
|
620
|
-
if err != nil {
|
|
621
|
-
return "", nil, fmt.Errorf("failed to get broadcast list members: %w", err)
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
timings.GetParticipants = time.Since(start)
|
|
625
|
-
start = time.Now()
|
|
626
690
|
plaintext, _, err := marshalMessage(to, message)
|
|
627
691
|
timings.Marshal = time.Since(start)
|
|
628
692
|
if err != nil {
|
|
@@ -631,8 +695,8 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.
|
|
|
631
695
|
|
|
632
696
|
start = time.Now()
|
|
633
697
|
builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer)
|
|
634
|
-
senderKeyName := protocol.NewSenderKeyName(to.String(),
|
|
635
|
-
signalSKDMessage, err := builder.Create(senderKeyName)
|
|
698
|
+
senderKeyName := protocol.NewSenderKeyName(to.String(), cli.getOwnLID().SignalAddress())
|
|
699
|
+
signalSKDMessage, err := builder.Create(ctx, senderKeyName)
|
|
636
700
|
if err != nil {
|
|
637
701
|
return "", nil, fmt.Errorf("failed to create sender key distribution message to send %s to %s: %w", id, to, err)
|
|
638
702
|
}
|
|
@@ -648,14 +712,16 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.
|
|
|
648
712
|
}
|
|
649
713
|
|
|
650
714
|
cipher := groups.NewGroupCipher(builder, senderKeyName, cli.Store)
|
|
651
|
-
encrypted, err := cipher.Encrypt(padMessage(plaintext))
|
|
715
|
+
encrypted, err := cipher.Encrypt(ctx, padMessage(plaintext))
|
|
652
716
|
if err != nil {
|
|
653
717
|
return "", nil, fmt.Errorf("failed to encrypt group message to send %s to %s: %w", id, to, err)
|
|
654
718
|
}
|
|
655
719
|
ciphertext := encrypted.SignedSerialize()
|
|
656
720
|
timings.GroupEncrypt = time.Since(start)
|
|
657
721
|
|
|
658
|
-
node, allDevices, err := cli.prepareMessageNode(
|
|
722
|
+
node, allDevices, err := cli.prepareMessageNode(
|
|
723
|
+
ctx, to, id, message, participants, skdPlaintext, nil, timings, extraParams,
|
|
724
|
+
)
|
|
659
725
|
if err != nil {
|
|
660
726
|
return "", nil, err
|
|
661
727
|
}
|
|
@@ -671,6 +737,9 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.
|
|
|
671
737
|
skMsg.Attrs["mediatype"] = mediaType
|
|
672
738
|
}
|
|
673
739
|
node.Content = append(node.GetChildren(), skMsg)
|
|
740
|
+
if cli.shouldIncludeReportingToken(message) && message.GetMessageContextInfo().GetMessageSecret() != nil {
|
|
741
|
+
node.Content = append(node.GetChildren(), cli.getMessageReportingToken(plaintext, message, ownID, to, id))
|
|
742
|
+
}
|
|
674
743
|
|
|
675
744
|
start = time.Now()
|
|
676
745
|
data, err := cli.sendNodeAndGetData(*node)
|
|
@@ -681,8 +750,14 @@ func (cli *Client) sendGroup(ctx context.Context, to, ownID types.JID, id types.
|
|
|
681
750
|
return phash, data, nil
|
|
682
751
|
}
|
|
683
752
|
|
|
684
|
-
func (cli *Client) sendPeerMessage(
|
|
685
|
-
|
|
753
|
+
func (cli *Client) sendPeerMessage(
|
|
754
|
+
ctx context.Context,
|
|
755
|
+
to types.JID,
|
|
756
|
+
id types.MessageID,
|
|
757
|
+
message *waE2E.Message,
|
|
758
|
+
timings *MessageDebugTimings,
|
|
759
|
+
) ([]byte, error) {
|
|
760
|
+
node, err := cli.preparePeerMessageNode(ctx, to, id, message, timings)
|
|
686
761
|
if err != nil {
|
|
687
762
|
return nil, err
|
|
688
763
|
}
|
|
@@ -695,7 +770,15 @@ func (cli *Client) sendPeerMessage(to types.JID, id types.MessageID, message *wa
|
|
|
695
770
|
return data, nil
|
|
696
771
|
}
|
|
697
772
|
|
|
698
|
-
func (cli *Client) sendDM(
|
|
773
|
+
func (cli *Client) sendDM(
|
|
774
|
+
ctx context.Context,
|
|
775
|
+
ownID,
|
|
776
|
+
to types.JID,
|
|
777
|
+
id types.MessageID,
|
|
778
|
+
message *waE2E.Message,
|
|
779
|
+
timings *MessageDebugTimings,
|
|
780
|
+
extraParams nodeExtraParams,
|
|
781
|
+
) ([]byte, error) {
|
|
699
782
|
start := time.Now()
|
|
700
783
|
messagePlaintext, deviceSentMessagePlaintext, err := marshalMessage(to, message)
|
|
701
784
|
timings.Marshal = time.Since(start)
|
|
@@ -703,10 +786,27 @@ func (cli *Client) sendDM(ctx context.Context, to, ownID types.JID, id types.Mes
|
|
|
703
786
|
return nil, err
|
|
704
787
|
}
|
|
705
788
|
|
|
706
|
-
node, _, err := cli.prepareMessageNode(
|
|
789
|
+
node, _, err := cli.prepareMessageNode(
|
|
790
|
+
ctx, to, id, message, []types.JID{to, ownID.ToNonAD()},
|
|
791
|
+
messagePlaintext, deviceSentMessagePlaintext, timings, extraParams,
|
|
792
|
+
)
|
|
707
793
|
if err != nil {
|
|
708
794
|
return nil, err
|
|
709
795
|
}
|
|
796
|
+
|
|
797
|
+
if cli.shouldIncludeReportingToken(message) && message.GetMessageContextInfo().GetMessageSecret() != nil {
|
|
798
|
+
node.Content = append(node.GetChildren(), cli.getMessageReportingToken(messagePlaintext, message, ownID, to, id))
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
if tcToken, err := cli.Store.PrivacyTokens.GetPrivacyToken(ctx, to); err != nil {
|
|
802
|
+
cli.Log.Warnf("Failed to get privacy token for %s: %v", to, err)
|
|
803
|
+
} else if tcToken != nil {
|
|
804
|
+
node.Content = append(node.GetChildren(), waBinary.Node{
|
|
805
|
+
Tag: "tctoken",
|
|
806
|
+
Content: tcToken.Token,
|
|
807
|
+
})
|
|
808
|
+
}
|
|
809
|
+
|
|
710
810
|
start = time.Now()
|
|
711
811
|
data, err := cli.sendNodeAndGetData(*node)
|
|
712
812
|
timings.Send = time.Since(start)
|
|
@@ -730,7 +830,7 @@ func getTypeFromMessage(msg *waE2E.Message) string {
|
|
|
730
830
|
return getTypeFromMessage(msg.EphemeralMessage.Message)
|
|
731
831
|
case msg.DocumentWithCaptionMessage != nil:
|
|
732
832
|
return getTypeFromMessage(msg.DocumentWithCaptionMessage.Message)
|
|
733
|
-
case msg.ReactionMessage != nil:
|
|
833
|
+
case msg.ReactionMessage != nil, msg.EncReactionMessage != nil:
|
|
734
834
|
return "reaction"
|
|
735
835
|
case msg.PollCreationMessage != nil, msg.PollUpdateMessage != nil:
|
|
736
836
|
return "poll"
|
|
@@ -868,7 +968,13 @@ func getEditAttribute(msg *waE2E.Message) types.EditAttribute {
|
|
|
868
968
|
return types.EditAttributeEmpty
|
|
869
969
|
}
|
|
870
970
|
|
|
871
|
-
func (cli *Client) preparePeerMessageNode(
|
|
971
|
+
func (cli *Client) preparePeerMessageNode(
|
|
972
|
+
ctx context.Context,
|
|
973
|
+
to types.JID,
|
|
974
|
+
id types.MessageID,
|
|
975
|
+
message *waE2E.Message,
|
|
976
|
+
timings *MessageDebugTimings,
|
|
977
|
+
) (*waBinary.Node, error) {
|
|
872
978
|
attrs := waBinary.Attrs{
|
|
873
979
|
"id": id,
|
|
874
980
|
"type": "text",
|
|
@@ -885,8 +991,15 @@ func (cli *Client) preparePeerMessageNode(to types.JID, id types.MessageID, mess
|
|
|
885
991
|
err = fmt.Errorf("failed to marshal message: %w", err)
|
|
886
992
|
return nil, err
|
|
887
993
|
}
|
|
994
|
+
encryptionIdentity := to
|
|
995
|
+
if to.Server == types.DefaultUserServer {
|
|
996
|
+
encryptionIdentity, err = cli.Store.LIDs.GetLIDForPN(ctx, to)
|
|
997
|
+
if err != nil {
|
|
998
|
+
return nil, fmt.Errorf("failed to get LID for PN %s: %w", to, err)
|
|
999
|
+
}
|
|
1000
|
+
}
|
|
888
1001
|
start = time.Now()
|
|
889
|
-
encrypted, isPreKey, err := cli.encryptMessageForDevice(plaintext,
|
|
1002
|
+
encrypted, isPreKey, err := cli.encryptMessageForDevice(ctx, plaintext, encryptionIdentity, nil, nil)
|
|
890
1003
|
timings.PeerEncrypt = time.Since(start)
|
|
891
1004
|
if err != nil {
|
|
892
1005
|
return nil, fmt.Errorf("failed to encrypt peer message for %s: %v", to, err)
|
|
@@ -902,7 +1015,13 @@ func (cli *Client) preparePeerMessageNode(to types.JID, id types.MessageID, mess
|
|
|
902
1015
|
}, nil
|
|
903
1016
|
}
|
|
904
1017
|
|
|
905
|
-
func (cli *Client) getMessageContent(
|
|
1018
|
+
func (cli *Client) getMessageContent(
|
|
1019
|
+
baseNode waBinary.Node,
|
|
1020
|
+
message *waE2E.Message,
|
|
1021
|
+
msgAttrs waBinary.Attrs,
|
|
1022
|
+
includeIdentity bool,
|
|
1023
|
+
extraParams nodeExtraParams,
|
|
1024
|
+
) []waBinary.Node {
|
|
906
1025
|
content := []waBinary.Node{baseNode}
|
|
907
1026
|
if includeIdentity {
|
|
908
1027
|
content = append(content, cli.makeDeviceIdentityNode())
|
|
@@ -920,8 +1039,11 @@ func (cli *Client) getMessageContent(baseNode waBinary.Node, message *waE2E.Mess
|
|
|
920
1039
|
})
|
|
921
1040
|
}
|
|
922
1041
|
|
|
923
|
-
if botNode != nil {
|
|
924
|
-
content = append(content, *botNode)
|
|
1042
|
+
if extraParams.botNode != nil {
|
|
1043
|
+
content = append(content, *extraParams.botNode)
|
|
1044
|
+
}
|
|
1045
|
+
if extraParams.metaNode != nil {
|
|
1046
|
+
content = append(content, *extraParams.metaNode)
|
|
925
1047
|
}
|
|
926
1048
|
|
|
927
1049
|
if buttonType := getButtonTypeFromMessage(message); buttonType != "" {
|
|
@@ -936,7 +1058,16 @@ func (cli *Client) getMessageContent(baseNode waBinary.Node, message *waE2E.Mess
|
|
|
936
1058
|
return content
|
|
937
1059
|
}
|
|
938
1060
|
|
|
939
|
-
func (cli *Client) prepareMessageNode(
|
|
1061
|
+
func (cli *Client) prepareMessageNode(
|
|
1062
|
+
ctx context.Context,
|
|
1063
|
+
to types.JID,
|
|
1064
|
+
id types.MessageID,
|
|
1065
|
+
message *waE2E.Message,
|
|
1066
|
+
participants []types.JID,
|
|
1067
|
+
plaintext, dsmPlaintext []byte,
|
|
1068
|
+
timings *MessageDebugTimings,
|
|
1069
|
+
extraParams nodeExtraParams,
|
|
1070
|
+
) (*waBinary.Node, []types.JID, error) {
|
|
940
1071
|
start := time.Now()
|
|
941
1072
|
allDevices, err := cli.GetUserDevicesContext(ctx, participants)
|
|
942
1073
|
timings.GetDevices = time.Since(start)
|
|
@@ -955,6 +1086,10 @@ func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID,
|
|
|
955
1086
|
"type": msgType,
|
|
956
1087
|
"to": to,
|
|
957
1088
|
}
|
|
1089
|
+
// TODO this is a very hacky hack for announcement group messages, why is it pn anyway?
|
|
1090
|
+
if extraParams.addressingMode != "" {
|
|
1091
|
+
attrs["addressing_mode"] = string(extraParams.addressingMode)
|
|
1092
|
+
}
|
|
958
1093
|
if editAttr := getEditAttribute(message); editAttr != "" {
|
|
959
1094
|
attrs["edit"] = string(editAttr)
|
|
960
1095
|
encAttrs["decrypt-fail"] = string(events.DecryptFailHide)
|
|
@@ -964,16 +1099,20 @@ func (cli *Client) prepareMessageNode(ctx context.Context, to, ownID types.JID,
|
|
|
964
1099
|
}
|
|
965
1100
|
|
|
966
1101
|
start = time.Now()
|
|
967
|
-
participantNodes, includeIdentity := cli.encryptMessageForDevices(
|
|
1102
|
+
participantNodes, includeIdentity := cli.encryptMessageForDevices(
|
|
1103
|
+
ctx, allDevices, id, plaintext, dsmPlaintext, encAttrs,
|
|
1104
|
+
)
|
|
968
1105
|
timings.PeerEncrypt = time.Since(start)
|
|
969
1106
|
participantNode := waBinary.Node{
|
|
970
1107
|
Tag: "participants",
|
|
971
1108
|
Content: participantNodes,
|
|
972
1109
|
}
|
|
973
1110
|
return &waBinary.Node{
|
|
974
|
-
Tag:
|
|
975
|
-
Attrs:
|
|
976
|
-
Content: cli.getMessageContent(
|
|
1111
|
+
Tag: "message",
|
|
1112
|
+
Attrs: attrs,
|
|
1113
|
+
Content: cli.getMessageContent(
|
|
1114
|
+
participantNode, message, attrs, includeIdentity, extraParams,
|
|
1115
|
+
),
|
|
977
1116
|
}, allDevices, nil
|
|
978
1117
|
}
|
|
979
1118
|
|
|
@@ -993,6 +1132,7 @@ func marshalMessage(to types.JID, message *waE2E.Message) (plaintext, dsmPlainte
|
|
|
993
1132
|
DestinationJID: proto.String(to.String()),
|
|
994
1133
|
Message: message,
|
|
995
1134
|
},
|
|
1135
|
+
MessageContextInfo: message.MessageContextInfo,
|
|
996
1136
|
})
|
|
997
1137
|
if err != nil {
|
|
998
1138
|
err = fmt.Errorf("failed to marshal message (for own devices): %w", err)
|
|
@@ -1014,23 +1154,46 @@ func (cli *Client) makeDeviceIdentityNode() waBinary.Node {
|
|
|
1014
1154
|
}
|
|
1015
1155
|
}
|
|
1016
1156
|
|
|
1017
|
-
func (cli *Client) encryptMessageForDevices(
|
|
1157
|
+
func (cli *Client) encryptMessageForDevices(
|
|
1158
|
+
ctx context.Context,
|
|
1159
|
+
allDevices []types.JID,
|
|
1160
|
+
id string,
|
|
1161
|
+
msgPlaintext, dsmPlaintext []byte,
|
|
1162
|
+
encAttrs waBinary.Attrs,
|
|
1163
|
+
) ([]waBinary.Node, bool) {
|
|
1164
|
+
ownJID := cli.getOwnID()
|
|
1165
|
+
ownLID := cli.getOwnLID()
|
|
1018
1166
|
includeIdentity := false
|
|
1019
1167
|
participantNodes := make([]waBinary.Node, 0, len(allDevices))
|
|
1020
|
-
var retryDevices []types.JID
|
|
1168
|
+
var retryDevices, retryEncryptionIdentities []types.JID
|
|
1021
1169
|
for _, jid := range allDevices {
|
|
1022
1170
|
plaintext := msgPlaintext
|
|
1023
|
-
if jid.User ==
|
|
1024
|
-
if jid ==
|
|
1171
|
+
if (jid.User == ownJID.User || jid.User == ownLID.User) && dsmPlaintext != nil {
|
|
1172
|
+
if jid == ownJID || jid == ownLID {
|
|
1025
1173
|
continue
|
|
1026
1174
|
}
|
|
1027
1175
|
plaintext = dsmPlaintext
|
|
1028
1176
|
}
|
|
1029
|
-
|
|
1177
|
+
encryptionIdentity := jid
|
|
1178
|
+
if jid.Server == types.DefaultUserServer {
|
|
1179
|
+
lidForPN, err := cli.Store.LIDs.GetLIDForPN(ctx, jid)
|
|
1180
|
+
if err != nil {
|
|
1181
|
+
cli.Log.Warnf("Failed to get LID for %s: %v", jid, err)
|
|
1182
|
+
} else if !lidForPN.IsEmpty() {
|
|
1183
|
+
cli.migrateSessionStore(ctx, jid, lidForPN)
|
|
1184
|
+
encryptionIdentity = lidForPN
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(
|
|
1189
|
+
ctx, plaintext, jid, encryptionIdentity, nil, encAttrs,
|
|
1190
|
+
)
|
|
1030
1191
|
if errors.Is(err, ErrNoSession) {
|
|
1031
1192
|
retryDevices = append(retryDevices, jid)
|
|
1193
|
+
retryEncryptionIdentities = append(retryEncryptionIdentities, encryptionIdentity)
|
|
1032
1194
|
continue
|
|
1033
1195
|
} else if err != nil {
|
|
1196
|
+
// TODO return these errors if it's a fatal one (like context cancellation or database)
|
|
1034
1197
|
cli.Log.Warnf("Failed to encrypt %s for %s: %v", id, jid, err)
|
|
1035
1198
|
continue
|
|
1036
1199
|
}
|
|
@@ -1045,18 +1208,21 @@ func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []ty
|
|
|
1045
1208
|
if err != nil {
|
|
1046
1209
|
cli.Log.Warnf("Failed to fetch prekeys for %v to retry encryption: %v", retryDevices, err)
|
|
1047
1210
|
} else {
|
|
1048
|
-
for
|
|
1211
|
+
for i, jid := range retryDevices {
|
|
1049
1212
|
resp := bundles[jid]
|
|
1050
1213
|
if resp.err != nil {
|
|
1051
1214
|
cli.Log.Warnf("Failed to fetch prekey for %s: %v", jid, resp.err)
|
|
1052
1215
|
continue
|
|
1053
1216
|
}
|
|
1054
1217
|
plaintext := msgPlaintext
|
|
1055
|
-
if jid.User ==
|
|
1218
|
+
if (jid.User == ownJID.User || jid.User == ownLID.User) && dsmPlaintext != nil {
|
|
1056
1219
|
plaintext = dsmPlaintext
|
|
1057
1220
|
}
|
|
1058
|
-
encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(
|
|
1221
|
+
encrypted, isPreKey, err := cli.encryptMessageForDeviceAndWrap(
|
|
1222
|
+
ctx, plaintext, jid, retryEncryptionIdentities[i], resp.bundle, encAttrs,
|
|
1223
|
+
)
|
|
1059
1224
|
if err != nil {
|
|
1225
|
+
// TODO return these errors if it's a fatal one (like context cancellation or database)
|
|
1060
1226
|
cli.Log.Warnf("Failed to encrypt %s for %s (retry): %v", id, jid, err)
|
|
1061
1227
|
continue
|
|
1062
1228
|
}
|
|
@@ -1070,14 +1236,23 @@ func (cli *Client) encryptMessageForDevices(ctx context.Context, allDevices []ty
|
|
|
1070
1236
|
return participantNodes, includeIdentity
|
|
1071
1237
|
}
|
|
1072
1238
|
|
|
1073
|
-
func (cli *Client) encryptMessageForDeviceAndWrap(
|
|
1074
|
-
|
|
1239
|
+
func (cli *Client) encryptMessageForDeviceAndWrap(
|
|
1240
|
+
ctx context.Context,
|
|
1241
|
+
plaintext []byte,
|
|
1242
|
+
wireIdentity,
|
|
1243
|
+
encryptionIdentity types.JID,
|
|
1244
|
+
bundle *prekey.Bundle,
|
|
1245
|
+
encAttrs waBinary.Attrs,
|
|
1246
|
+
) (*waBinary.Node, bool, error) {
|
|
1247
|
+
node, includeDeviceIdentity, err := cli.encryptMessageForDevice(
|
|
1248
|
+
ctx, plaintext, encryptionIdentity, bundle, encAttrs,
|
|
1249
|
+
)
|
|
1075
1250
|
if err != nil {
|
|
1076
1251
|
return nil, false, err
|
|
1077
1252
|
}
|
|
1078
1253
|
return &waBinary.Node{
|
|
1079
1254
|
Tag: "to",
|
|
1080
|
-
Attrs: waBinary.Attrs{"jid":
|
|
1255
|
+
Attrs: waBinary.Attrs{"jid": wireIdentity},
|
|
1081
1256
|
Content: []waBinary.Node{*node},
|
|
1082
1257
|
}, includeDeviceIdentity, nil
|
|
1083
1258
|
}
|
|
@@ -1088,24 +1263,35 @@ func copyAttrs(from, to waBinary.Attrs) {
|
|
|
1088
1263
|
}
|
|
1089
1264
|
}
|
|
1090
1265
|
|
|
1091
|
-
func (cli *Client) encryptMessageForDevice(
|
|
1266
|
+
func (cli *Client) encryptMessageForDevice(
|
|
1267
|
+
ctx context.Context,
|
|
1268
|
+
plaintext []byte,
|
|
1269
|
+
to types.JID,
|
|
1270
|
+
bundle *prekey.Bundle,
|
|
1271
|
+
extraAttrs waBinary.Attrs,
|
|
1272
|
+
) (*waBinary.Node, bool, error) {
|
|
1092
1273
|
builder := session.NewBuilderFromSignal(cli.Store, to.SignalAddress(), pbSerializer)
|
|
1093
1274
|
if bundle != nil {
|
|
1094
1275
|
cli.Log.Debugf("Processing prekey bundle for %s", to)
|
|
1095
|
-
err := builder.ProcessBundle(bundle)
|
|
1276
|
+
err := builder.ProcessBundle(ctx, bundle)
|
|
1096
1277
|
if cli.AutoTrustIdentity && errors.Is(err, signalerror.ErrUntrustedIdentity) {
|
|
1097
1278
|
cli.Log.Warnf("Got %v error while trying to process prekey bundle for %s, clearing stored identity and retrying", err, to)
|
|
1098
|
-
cli.clearUntrustedIdentity(to)
|
|
1099
|
-
err
|
|
1279
|
+
err = cli.clearUntrustedIdentity(ctx, to)
|
|
1280
|
+
if err != nil {
|
|
1281
|
+
return nil, false, fmt.Errorf("failed to clear untrusted identity: %w", err)
|
|
1282
|
+
}
|
|
1283
|
+
err = builder.ProcessBundle(ctx, bundle)
|
|
1100
1284
|
}
|
|
1101
1285
|
if err != nil {
|
|
1102
1286
|
return nil, false, fmt.Errorf("failed to process prekey bundle: %w", err)
|
|
1103
1287
|
}
|
|
1104
|
-
} else if
|
|
1105
|
-
return nil, false,
|
|
1288
|
+
} else if contains, err := cli.Store.ContainsSession(ctx, to.SignalAddress()); err != nil {
|
|
1289
|
+
return nil, false, err
|
|
1290
|
+
} else if !contains {
|
|
1291
|
+
return nil, false, fmt.Errorf("%w with %s", ErrNoSession, to.SignalAddress().String())
|
|
1106
1292
|
}
|
|
1107
1293
|
cipher := session.NewCipher(builder, to.SignalAddress())
|
|
1108
|
-
ciphertext, err := cipher.Encrypt(padMessage(plaintext))
|
|
1294
|
+
ciphertext, err := cipher.Encrypt(ctx, padMessage(plaintext))
|
|
1109
1295
|
if err != nil {
|
|
1110
1296
|
return nil, false, fmt.Errorf("cipher encryption failed: %w", err)
|
|
1111
1297
|
}
|