slidge-whatsapp 0.2.5__cp313-cp313-manylinux_2_36_aarch64.whl → 0.2.6__cp313-cp313-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 +23 -24
- slidge_whatsapp/gateway.go +13 -9
- slidge_whatsapp/gateway.py +2 -2
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.h +181 -181
- slidge_whatsapp/generated/_whatsapp.cpython-313-aarch64-linux-gnu.so +0 -0
- slidge_whatsapp/generated/build.py +155 -155
- slidge_whatsapp/generated/whatsapp.c +1507 -1507
- slidge_whatsapp/generated/whatsapp.go +907 -907
- slidge_whatsapp/generated/whatsapp.py +1318 -1318
- slidge_whatsapp/generated/whatsapp_go.h +181 -181
- slidge_whatsapp/go.mod +15 -12
- slidge_whatsapp/go.sum +41 -29
- slidge_whatsapp/media/media.go +16 -10
- 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 +41 -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/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 +3 -2
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/broadcast.go +5 -4
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +60 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +25 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download-to-file.go +45 -19
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +52 -28
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +1 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +59 -29
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +166 -146
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +2 -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 +270 -111
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +118 -31
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +67 -36
- 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/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 +158 -15
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +1 -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} +170 -84
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/{WAWebProtobufsCompanionReg.proto → WACompanionReg.proto} +1 -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 +6747 -2230
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +294 -43
- 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/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/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/waSyncAction/WASyncAction.pb.go +1051 -382
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +32 -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 +555 -9
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +2 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +13 -3
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +29 -19
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +244 -73
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +27 -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 +79 -61
- 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 +153 -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/upgrades.go +22 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +105 -56
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/botmap.go +210 -0
- slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +8 -0
- 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 +17 -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 +45 -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 +38 -13
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.6.dist-info}/METADATA +1 -1
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.6.dist-info}/RECORD +293 -180
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.6.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.6.dist-info}/LICENSE +0 -0
- {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.2.6.dist-info}/entry_points.txt +0 -0
|
@@ -9,6 +9,8 @@ package whatsmeow
|
|
|
9
9
|
import (
|
|
10
10
|
"bytes"
|
|
11
11
|
"compress/zlib"
|
|
12
|
+
"context"
|
|
13
|
+
"crypto/sha256"
|
|
12
14
|
"encoding/hex"
|
|
13
15
|
"errors"
|
|
14
16
|
"fmt"
|
|
@@ -16,6 +18,7 @@ import (
|
|
|
16
18
|
"runtime/debug"
|
|
17
19
|
"time"
|
|
18
20
|
|
|
21
|
+
"github.com/rs/zerolog"
|
|
19
22
|
"go.mau.fi/libsignal/groups"
|
|
20
23
|
"go.mau.fi/libsignal/protocol"
|
|
21
24
|
"go.mau.fi/libsignal/session"
|
|
@@ -36,33 +39,41 @@ import (
|
|
|
36
39
|
var pbSerializer = store.SignalProtobufSerializer
|
|
37
40
|
|
|
38
41
|
func (cli *Client) handleEncryptedMessage(node *waBinary.Node) {
|
|
42
|
+
ctx := context.TODO()
|
|
39
43
|
info, err := cli.parseMessageInfo(node)
|
|
40
44
|
if err != nil {
|
|
41
45
|
cli.Log.Warnf("Failed to parse message: %v", err)
|
|
42
46
|
} else {
|
|
47
|
+
if !info.SenderAlt.IsEmpty() {
|
|
48
|
+
cli.StoreLIDPNMapping(ctx, info.SenderAlt, info.Sender)
|
|
49
|
+
} else if !info.RecipientAlt.IsEmpty() {
|
|
50
|
+
cli.StoreLIDPNMapping(ctx, info.RecipientAlt, info.Chat)
|
|
51
|
+
}
|
|
43
52
|
if info.VerifiedName != nil && len(info.VerifiedName.Details.GetVerifiedName()) > 0 {
|
|
44
|
-
go cli.updateBusinessName(info.Sender, info, info.VerifiedName.Details.GetVerifiedName())
|
|
53
|
+
go cli.updateBusinessName(context.WithoutCancel(ctx), info.Sender, info, info.VerifiedName.Details.GetVerifiedName())
|
|
45
54
|
}
|
|
46
55
|
if len(info.PushName) > 0 && info.PushName != "-" {
|
|
47
|
-
go cli.updatePushName(info.Sender, info, info.PushName)
|
|
56
|
+
go cli.updatePushName(context.WithoutCancel(ctx), info.Sender, info, info.PushName)
|
|
48
57
|
}
|
|
49
58
|
defer cli.maybeDeferredAck(node)()
|
|
50
59
|
if info.Sender.Server == types.NewsletterServer {
|
|
51
|
-
cli.handlePlaintextMessage(info, node)
|
|
60
|
+
cli.handlePlaintextMessage(ctx, info, node)
|
|
52
61
|
} else {
|
|
53
|
-
cli.decryptMessages(info, node)
|
|
62
|
+
cli.decryptMessages(ctx, info, node)
|
|
54
63
|
}
|
|
55
64
|
}
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bool) (source types.MessageSource, err error) {
|
|
59
68
|
clientID := cli.getOwnID()
|
|
69
|
+
clientLID := cli.Store.GetLID()
|
|
60
70
|
if clientID.IsEmpty() {
|
|
61
71
|
err = ErrNotLoggedIn
|
|
62
72
|
return
|
|
63
73
|
}
|
|
64
74
|
ag := node.AttrGetter()
|
|
65
75
|
from := ag.JID("from")
|
|
76
|
+
source.AddressingMode = types.AddressingMode(ag.OptionalString("addressing_mode"))
|
|
66
77
|
if from.Server == types.GroupServer || from.Server == types.BroadcastServer {
|
|
67
78
|
source.IsGroup = true
|
|
68
79
|
source.Chat = from
|
|
@@ -71,7 +82,12 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
|
|
|
71
82
|
} else {
|
|
72
83
|
source.Sender = ag.OptionalJIDOrEmpty("participant")
|
|
73
84
|
}
|
|
74
|
-
if source.
|
|
85
|
+
if source.AddressingMode == types.AddressingModeLID {
|
|
86
|
+
source.SenderAlt = ag.OptionalJIDOrEmpty("participant_pn")
|
|
87
|
+
} else {
|
|
88
|
+
source.SenderAlt = ag.OptionalJIDOrEmpty("participant_lid")
|
|
89
|
+
}
|
|
90
|
+
if source.Sender.User == clientID.User || source.Sender.User == clientLID.User {
|
|
75
91
|
source.IsFromMe = true
|
|
76
92
|
}
|
|
77
93
|
if from.Server == types.BroadcastServer {
|
|
@@ -81,7 +97,7 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
|
|
|
81
97
|
source.Chat = from
|
|
82
98
|
source.Sender = from
|
|
83
99
|
// TODO IsFromMe?
|
|
84
|
-
} else if from.User == clientID.User {
|
|
100
|
+
} else if from.User == clientID.User || from.User == clientLID.User {
|
|
85
101
|
source.IsFromMe = true
|
|
86
102
|
source.Sender = from
|
|
87
103
|
recipient := ag.OptionalJID("recipient")
|
|
@@ -90,6 +106,11 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
|
|
|
90
106
|
} else {
|
|
91
107
|
source.Chat = from.ToNonAD()
|
|
92
108
|
}
|
|
109
|
+
if source.AddressingMode == types.AddressingModeLID {
|
|
110
|
+
source.RecipientAlt = ag.OptionalJIDOrEmpty("peer_recipient_pn") // existence of this field is not confirmed
|
|
111
|
+
} else {
|
|
112
|
+
source.RecipientAlt = ag.OptionalJIDOrEmpty("peer_recipient_lid")
|
|
113
|
+
}
|
|
93
114
|
} else if from.IsBot() {
|
|
94
115
|
source.Sender = from
|
|
95
116
|
meta := node.GetChildByTag("meta")
|
|
@@ -103,6 +124,14 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
|
|
|
103
124
|
} else {
|
|
104
125
|
source.Chat = from.ToNonAD()
|
|
105
126
|
source.Sender = from
|
|
127
|
+
if source.AddressingMode == types.AddressingModeLID {
|
|
128
|
+
source.SenderAlt = ag.OptionalJIDOrEmpty("sender_pn")
|
|
129
|
+
} else {
|
|
130
|
+
source.SenderAlt = ag.OptionalJIDOrEmpty("sender_lid")
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if !source.SenderAlt.IsEmpty() && source.SenderAlt.Device == 0 {
|
|
134
|
+
source.SenderAlt.Device = source.Sender.Device
|
|
106
135
|
}
|
|
107
136
|
err = ag.Error()
|
|
108
137
|
return
|
|
@@ -125,11 +154,14 @@ func (cli *Client) parseMsgMetaInfo(node waBinary.Node) (metaInfo types.MsgMetaI
|
|
|
125
154
|
metaNode := node.GetChildByTag("meta")
|
|
126
155
|
|
|
127
156
|
ag := metaNode.AttrGetter()
|
|
128
|
-
metaInfo.TargetID = types.MessageID(ag.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
157
|
+
metaInfo.TargetID = types.MessageID(ag.OptionalString("target_id"))
|
|
158
|
+
metaInfo.TargetSender = ag.OptionalJIDOrEmpty("target_sender_jid")
|
|
159
|
+
deprecatedLIDSession, ok := ag.GetBool("deprecated_lid_session", false)
|
|
160
|
+
if ok {
|
|
161
|
+
metaInfo.DeprecatedLIDSession = &deprecatedLIDSession
|
|
132
162
|
}
|
|
163
|
+
metaInfo.ThreadMessageID = types.MessageID(ag.OptionalString("thread_msg_id"))
|
|
164
|
+
metaInfo.ThreadMessageSenderJID = ag.OptionalJIDOrEmpty("thread_msg_sender_jid")
|
|
133
165
|
err = ag.Error()
|
|
134
166
|
return
|
|
135
167
|
}
|
|
@@ -168,8 +200,10 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er
|
|
|
168
200
|
cli.Log.Warnf("Failed to parse <bot> node in %s: %v", info.ID, err)
|
|
169
201
|
}
|
|
170
202
|
case "meta":
|
|
171
|
-
|
|
172
|
-
|
|
203
|
+
info.MsgMetaInfo, err = cli.parseMsgMetaInfo(child)
|
|
204
|
+
if err != nil {
|
|
205
|
+
cli.Log.Warnf("Failed to parse <meta> node in %s: %v", info.ID, err)
|
|
206
|
+
}
|
|
173
207
|
case "franking":
|
|
174
208
|
// TODO
|
|
175
209
|
case "trace":
|
|
@@ -184,7 +218,7 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er
|
|
|
184
218
|
return &info, nil
|
|
185
219
|
}
|
|
186
220
|
|
|
187
|
-
func (cli *Client) handlePlaintextMessage(info *types.MessageInfo, node *waBinary.Node) {
|
|
221
|
+
func (cli *Client) handlePlaintextMessage(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) {
|
|
188
222
|
// TODO edits have an additional <meta msg_edit_t="1696321271735" original_msg_t="1696321248"/> node
|
|
189
223
|
plaintext, ok := node.GetOptionalChildByTag("plaintext")
|
|
190
224
|
if !ok {
|
|
@@ -203,7 +237,7 @@ func (cli *Client) handlePlaintextMessage(info *types.MessageInfo, node *waBinar
|
|
|
203
237
|
cli.Log.Warnf("Error unmarshaling plaintext message from %s: %v", info.SourceString(), err)
|
|
204
238
|
return
|
|
205
239
|
}
|
|
206
|
-
cli.storeMessageSecret(info, &msg)
|
|
240
|
+
cli.storeMessageSecret(ctx, info, &msg)
|
|
207
241
|
evt := &events.Message{
|
|
208
242
|
Info: *info,
|
|
209
243
|
RawMessage: &msg,
|
|
@@ -216,10 +250,16 @@ func (cli *Client) handlePlaintextMessage(info *types.MessageInfo, node *waBinar
|
|
|
216
250
|
}
|
|
217
251
|
}
|
|
218
252
|
cli.dispatchEvent(evt.UnwrapRaw())
|
|
219
|
-
return
|
|
220
253
|
}
|
|
221
254
|
|
|
222
|
-
func (cli *Client)
|
|
255
|
+
func (cli *Client) migrateSessionStore(ctx context.Context, pn, lid types.JID) {
|
|
256
|
+
err := cli.Store.Sessions.MigratePNToLID(ctx, pn, lid)
|
|
257
|
+
if err != nil {
|
|
258
|
+
cli.Log.Errorf("Failed to migrate signal store from %s to %s: %v", pn, lid, err)
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) {
|
|
223
263
|
unavailableNode, ok := node.GetOptionalChildByTag("unavailable")
|
|
224
264
|
if ok && len(node.GetChildrenByTag("enc")) == 0 {
|
|
225
265
|
uType := events.UnavailableType(unavailableNode.AttrGetter().String("type"))
|
|
@@ -233,6 +273,21 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node)
|
|
|
233
273
|
cli.Log.Debugf("Decrypting message from %s", info.SourceString())
|
|
234
274
|
handled := false
|
|
235
275
|
containsDirectMsg := false
|
|
276
|
+
senderEncryptionJID := info.Sender
|
|
277
|
+
if info.Sender.Server == types.DefaultUserServer && !info.Sender.IsBot() {
|
|
278
|
+
if info.SenderAlt.Server == types.HiddenUserServer {
|
|
279
|
+
senderEncryptionJID = info.SenderAlt
|
|
280
|
+
cli.migrateSessionStore(ctx, info.Sender, info.SenderAlt)
|
|
281
|
+
} else if lid, err := cli.Store.LIDs.GetLIDForPN(ctx, info.Sender); err != nil {
|
|
282
|
+
cli.Log.Errorf("Failed to get LID for %s: %v", info.Sender, err)
|
|
283
|
+
} else if !lid.IsEmpty() {
|
|
284
|
+
cli.migrateSessionStore(ctx, info.Sender, lid)
|
|
285
|
+
senderEncryptionJID = lid
|
|
286
|
+
info.SenderAlt = lid
|
|
287
|
+
} else {
|
|
288
|
+
cli.Log.Warnf("No LID found for %s", info.Sender)
|
|
289
|
+
}
|
|
290
|
+
}
|
|
236
291
|
for _, child := range children {
|
|
237
292
|
if child.Tag != "enc" {
|
|
238
293
|
continue
|
|
@@ -243,59 +298,54 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node)
|
|
|
243
298
|
continue
|
|
244
299
|
}
|
|
245
300
|
var decrypted []byte
|
|
301
|
+
var ciphertextHash *[32]byte
|
|
246
302
|
var err error
|
|
247
303
|
if encType == "pkmsg" || encType == "msg" {
|
|
248
|
-
decrypted, err = cli.decryptDM(&child,
|
|
304
|
+
decrypted, ciphertextHash, err = cli.decryptDM(ctx, &child, senderEncryptionJID, encType == "pkmsg", info.Timestamp)
|
|
249
305
|
containsDirectMsg = true
|
|
250
306
|
} else if info.IsGroup && encType == "skmsg" {
|
|
251
|
-
decrypted, err = cli.decryptGroupMsg(&child, info.
|
|
307
|
+
decrypted, ciphertextHash, err = cli.decryptGroupMsg(ctx, &child, senderEncryptionJID, info.Chat, info.Timestamp)
|
|
252
308
|
} else if encType == "msmsg" && info.Sender.IsBot() {
|
|
253
|
-
// Meta AI / other bots (biz?):
|
|
254
|
-
|
|
255
|
-
// step 1: get message secret
|
|
256
309
|
targetSenderJID := info.MsgMetaInfo.TargetSender
|
|
310
|
+
messageSecretSenderJID := targetSenderJID
|
|
257
311
|
if targetSenderJID.User == "" {
|
|
258
|
-
|
|
259
|
-
|
|
312
|
+
if info.Sender.Server == types.BotServer {
|
|
313
|
+
targetSenderJID = cli.Store.GetLID()
|
|
314
|
+
} else {
|
|
315
|
+
targetSenderJID = cli.getOwnID()
|
|
316
|
+
}
|
|
317
|
+
messageSecretSenderJID = cli.getOwnID()
|
|
260
318
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
319
|
+
var decryptMessageID string
|
|
320
|
+
if info.MsgBotInfo.EditType == types.EditTypeInner || info.MsgBotInfo.EditType == types.EditTypeLast {
|
|
321
|
+
decryptMessageID = info.MsgBotInfo.EditTargetID
|
|
322
|
+
} else {
|
|
323
|
+
decryptMessageID = info.ID
|
|
266
324
|
}
|
|
267
|
-
|
|
268
|
-
// step 2: get MessageSecretMessage
|
|
269
|
-
byteContents := child.Content.([]byte) // <enc> contents
|
|
270
325
|
var msMsg waE2E.MessageSecretMessage
|
|
271
|
-
|
|
272
|
-
err =
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
// step 3: determine best message id for decryption
|
|
279
|
-
var messageID string
|
|
280
|
-
if info.MsgBotInfo.EditType == types.EditTypeInner || info.MsgBotInfo.EditType == types.EditTypeLast {
|
|
281
|
-
messageID = info.MsgBotInfo.EditTargetID
|
|
326
|
+
var messageSecret []byte
|
|
327
|
+
if messageSecret, err = cli.Store.MsgSecrets.GetMessageSecret(ctx, info.Chat, messageSecretSenderJID, info.MsgMetaInfo.TargetID); err != nil {
|
|
328
|
+
err = fmt.Errorf("failed to get message secret for %s: %v", info.MsgMetaInfo.TargetID, err)
|
|
329
|
+
} else if messageSecret == nil {
|
|
330
|
+
err = fmt.Errorf("message secret for %s not found", info.MsgMetaInfo.TargetID)
|
|
331
|
+
} else if err = proto.Unmarshal(child.Content.([]byte), &msMsg); err != nil {
|
|
332
|
+
err = fmt.Errorf("failed to unmarshal MessageSecretMessage protobuf: %v", err)
|
|
282
333
|
} else {
|
|
283
|
-
|
|
334
|
+
decrypted, err = cli.decryptBotMessage(ctx, messageSecret, &msMsg, decryptMessageID, targetSenderJID, info)
|
|
284
335
|
}
|
|
285
|
-
|
|
286
|
-
// step 4: decrypt and voila
|
|
287
|
-
decrypted, err = cli.decryptBotMessage(messageSecret, &msMsg, messageID, targetSenderJID, info)
|
|
288
336
|
} else {
|
|
289
337
|
cli.Log.Warnf("Unhandled encrypted message (type %s) from %s", encType, info.SourceString())
|
|
290
338
|
continue
|
|
291
339
|
}
|
|
292
340
|
|
|
293
|
-
if err
|
|
341
|
+
if errors.Is(err, EventAlreadyProcessed) {
|
|
342
|
+
cli.Log.Debugf("Ignoring message %s from %s: %v", info.ID, info.SourceString(), err)
|
|
343
|
+
return
|
|
344
|
+
} else if err != nil {
|
|
294
345
|
cli.Log.Warnf("Error decrypting message from %s: %v", info.SourceString(), err)
|
|
295
346
|
isUnavailable := encType == "skmsg" && !containsDirectMsg && errors.Is(err, signalerror.ErrNoSenderKeyForUser)
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
go cli.sendRetryReceipt(node, info, isUnavailable)
|
|
347
|
+
if encType != "msmsg" {
|
|
348
|
+
go cli.sendRetryReceipt(context.WithoutCancel(ctx), node, info, isUnavailable)
|
|
299
349
|
}
|
|
300
350
|
cli.dispatchEvent(&events.UndecryptableMessage{
|
|
301
351
|
Info: *info,
|
|
@@ -315,85 +365,183 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node)
|
|
|
315
365
|
cli.Log.Warnf("Error unmarshaling decrypted message from %s: %v", info.SourceString(), err)
|
|
316
366
|
continue
|
|
317
367
|
}
|
|
318
|
-
cli.handleDecryptedMessage(info, &msg, retryCount)
|
|
368
|
+
cli.handleDecryptedMessage(ctx, info, &msg, retryCount)
|
|
319
369
|
handled = true
|
|
320
370
|
case 3:
|
|
321
|
-
handled = cli.handleDecryptedArmadillo(info, decrypted, retryCount)
|
|
371
|
+
handled = cli.handleDecryptedArmadillo(ctx, info, decrypted, retryCount)
|
|
322
372
|
default:
|
|
323
373
|
cli.Log.Warnf("Unknown version %d in decrypted message from %s", ag.Int("v"), info.SourceString())
|
|
324
374
|
}
|
|
375
|
+
if ciphertextHash != nil && cli.EnableDecryptedEventBuffer {
|
|
376
|
+
// Use the context passed to decryptMessages
|
|
377
|
+
err = cli.Store.EventBuffer.ClearBufferedEventPlaintext(ctx, *ciphertextHash)
|
|
378
|
+
if err != nil {
|
|
379
|
+
zerolog.Ctx(ctx).Err(err).
|
|
380
|
+
Hex("ciphertext_hash", ciphertextHash[:]).
|
|
381
|
+
Msg("Failed to clear buffered event plaintext")
|
|
382
|
+
} else {
|
|
383
|
+
zerolog.Ctx(ctx).Debug().
|
|
384
|
+
Hex("ciphertext_hash", ciphertextHash[:]).
|
|
385
|
+
Msg("Deleted event plaintext from buffer")
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
if time.Since(cli.lastDecryptedBufferClear) > 12*time.Hour {
|
|
389
|
+
cli.lastDecryptedBufferClear = time.Now()
|
|
390
|
+
go func() {
|
|
391
|
+
err := cli.Store.EventBuffer.DeleteOldBufferedHashes(context.WithoutCancel(ctx))
|
|
392
|
+
if err != nil {
|
|
393
|
+
zerolog.Ctx(ctx).Err(err).Msg("Failed to delete old buffered hashes")
|
|
394
|
+
}
|
|
395
|
+
}()
|
|
396
|
+
}
|
|
397
|
+
}
|
|
325
398
|
}
|
|
326
399
|
if handled {
|
|
327
400
|
go cli.sendMessageReceipt(info)
|
|
328
401
|
}
|
|
329
402
|
}
|
|
330
403
|
|
|
331
|
-
func (cli *Client) clearUntrustedIdentity(target types.JID) {
|
|
332
|
-
err := cli.Store.Identities.DeleteIdentity(target.SignalAddress().String())
|
|
404
|
+
func (cli *Client) clearUntrustedIdentity(ctx context.Context, target types.JID) error {
|
|
405
|
+
err := cli.Store.Identities.DeleteIdentity(ctx, target.SignalAddress().String())
|
|
333
406
|
if err != nil {
|
|
334
|
-
|
|
407
|
+
return fmt.Errorf("failed to delete identity: %w", err)
|
|
335
408
|
}
|
|
336
|
-
err = cli.Store.Sessions.DeleteSession(target.SignalAddress().String())
|
|
409
|
+
err = cli.Store.Sessions.DeleteSession(ctx, target.SignalAddress().String())
|
|
337
410
|
if err != nil {
|
|
338
|
-
|
|
411
|
+
return fmt.Errorf("failed to delete session: %w", err)
|
|
339
412
|
}
|
|
340
|
-
cli.dispatchEvent(&events.IdentityChange{JID: target, Timestamp: time.Now(), Implicit: true})
|
|
413
|
+
go cli.dispatchEvent(&events.IdentityChange{JID: target, Timestamp: time.Now(), Implicit: true})
|
|
414
|
+
return nil
|
|
341
415
|
}
|
|
342
416
|
|
|
343
|
-
|
|
344
|
-
|
|
417
|
+
var EventAlreadyProcessed = errors.New("event was already processed")
|
|
418
|
+
|
|
419
|
+
func (cli *Client) bufferedDecrypt(
|
|
420
|
+
ctx context.Context,
|
|
421
|
+
ciphertext []byte,
|
|
422
|
+
serverTimestamp time.Time,
|
|
423
|
+
decrypt func(context.Context) ([]byte, error),
|
|
424
|
+
) (plaintext []byte, ciphertextHash [32]byte, err error) {
|
|
425
|
+
if !cli.EnableDecryptedEventBuffer {
|
|
426
|
+
plaintext, err = decrypt(ctx)
|
|
427
|
+
return
|
|
428
|
+
}
|
|
429
|
+
ciphertextHash = sha256.Sum256(ciphertext)
|
|
430
|
+
var buf *store.BufferedEvent
|
|
431
|
+
buf, err = cli.Store.EventBuffer.GetBufferedEvent(ctx, ciphertextHash)
|
|
432
|
+
if err != nil {
|
|
433
|
+
err = fmt.Errorf("failed to get buffered event: %w", err)
|
|
434
|
+
return
|
|
435
|
+
} else if buf != nil {
|
|
436
|
+
if buf.Plaintext == nil {
|
|
437
|
+
zerolog.Ctx(ctx).Debug().
|
|
438
|
+
Hex("ciphertext_hash", ciphertextHash[:]).
|
|
439
|
+
Time("insertion_time", buf.InsertTime).
|
|
440
|
+
Msg("Returning event already processed error")
|
|
441
|
+
err = fmt.Errorf("%w at %s", EventAlreadyProcessed, buf.InsertTime.String())
|
|
442
|
+
return
|
|
443
|
+
}
|
|
444
|
+
zerolog.Ctx(ctx).Debug().
|
|
445
|
+
Hex("ciphertext_hash", ciphertextHash[:]).
|
|
446
|
+
Time("insertion_time", buf.InsertTime).
|
|
447
|
+
Msg("Returning previously decrypted plaintext")
|
|
448
|
+
plaintext = buf.Plaintext
|
|
449
|
+
return
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
err = cli.Store.EventBuffer.DoDecryptionTxn(ctx, func(ctx context.Context) (innerErr error) {
|
|
453
|
+
plaintext, innerErr = decrypt(ctx)
|
|
454
|
+
if innerErr != nil {
|
|
455
|
+
return
|
|
456
|
+
}
|
|
457
|
+
innerErr = cli.Store.EventBuffer.PutBufferedEvent(ctx, ciphertextHash, plaintext, serverTimestamp)
|
|
458
|
+
if innerErr != nil {
|
|
459
|
+
innerErr = fmt.Errorf("failed to save decrypted event to buffer: %w", innerErr)
|
|
460
|
+
}
|
|
461
|
+
return
|
|
462
|
+
})
|
|
463
|
+
if err == nil {
|
|
464
|
+
zerolog.Ctx(ctx).Debug().
|
|
465
|
+
Hex("ciphertext_hash", ciphertextHash[:]).
|
|
466
|
+
Msg("Successfully decrypted and saved event")
|
|
467
|
+
}
|
|
468
|
+
return
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
func (cli *Client) decryptDM(ctx context.Context, child *waBinary.Node, from types.JID, isPreKey bool, serverTS time.Time) ([]byte, *[32]byte, error) {
|
|
472
|
+
content, ok := child.Content.([]byte)
|
|
473
|
+
if !ok {
|
|
474
|
+
return nil, nil, fmt.Errorf("message content is not a byte slice")
|
|
475
|
+
}
|
|
345
476
|
|
|
346
477
|
builder := session.NewBuilderFromSignal(cli.Store, from.SignalAddress(), pbSerializer)
|
|
347
478
|
cipher := session.NewCipher(builder, from.SignalAddress())
|
|
348
479
|
var plaintext []byte
|
|
480
|
+
var ciphertextHash [32]byte
|
|
349
481
|
if isPreKey {
|
|
350
482
|
preKeyMsg, err := protocol.NewPreKeySignalMessageFromBytes(content, pbSerializer.PreKeySignalMessage, pbSerializer.SignalMessage)
|
|
351
483
|
if err != nil {
|
|
352
|
-
return nil, fmt.Errorf("failed to parse prekey message: %w", err)
|
|
353
|
-
}
|
|
354
|
-
plaintext,
|
|
355
|
-
|
|
356
|
-
cli.
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
484
|
+
return nil, nil, fmt.Errorf("failed to parse prekey message: %w", err)
|
|
485
|
+
}
|
|
486
|
+
plaintext, ciphertextHash, err = cli.bufferedDecrypt(ctx, content, serverTS, func(decryptCtx context.Context) ([]byte, error) {
|
|
487
|
+
pt, innerErr := cipher.DecryptMessage(decryptCtx, preKeyMsg)
|
|
488
|
+
if cli.AutoTrustIdentity && errors.Is(innerErr, signalerror.ErrUntrustedIdentity) {
|
|
489
|
+
cli.Log.Warnf("Got %v error while trying to decrypt prekey message from %s, clearing stored identity and retrying", innerErr, from)
|
|
490
|
+
if innerErr = cli.clearUntrustedIdentity(decryptCtx, from); innerErr != nil {
|
|
491
|
+
innerErr = fmt.Errorf("failed to clear untrusted identity: %w", innerErr)
|
|
492
|
+
return nil, innerErr
|
|
493
|
+
}
|
|
494
|
+
pt, innerErr = cipher.DecryptMessage(decryptCtx, preKeyMsg)
|
|
495
|
+
}
|
|
496
|
+
return pt, innerErr
|
|
497
|
+
})
|
|
360
498
|
if err != nil {
|
|
361
|
-
return nil, fmt.Errorf("failed to decrypt prekey message: %w", err)
|
|
499
|
+
return nil, nil, fmt.Errorf("failed to decrypt prekey message: %w", err)
|
|
362
500
|
}
|
|
363
501
|
} else {
|
|
364
502
|
msg, err := protocol.NewSignalMessageFromBytes(content, pbSerializer.SignalMessage)
|
|
365
503
|
if err != nil {
|
|
366
|
-
return nil, fmt.Errorf("failed to parse normal message: %w", err)
|
|
504
|
+
return nil, nil, fmt.Errorf("failed to parse normal message: %w", err)
|
|
367
505
|
}
|
|
368
|
-
plaintext, err =
|
|
506
|
+
plaintext, ciphertextHash, err = cli.bufferedDecrypt(ctx, content, serverTS, func(decryptCtx context.Context) ([]byte, error) {
|
|
507
|
+
return cipher.Decrypt(decryptCtx, msg)
|
|
508
|
+
})
|
|
369
509
|
if err != nil {
|
|
370
|
-
return nil, fmt.Errorf("failed to decrypt normal message: %w", err)
|
|
510
|
+
return nil, nil, fmt.Errorf("failed to decrypt normal message: %w", err)
|
|
371
511
|
}
|
|
372
512
|
}
|
|
373
|
-
|
|
374
|
-
|
|
513
|
+
var err error
|
|
514
|
+
plaintext, err = unpadMessage(plaintext, child.AttrGetter().Int("v"))
|
|
515
|
+
if err != nil {
|
|
516
|
+
return nil, nil, fmt.Errorf("failed to unpad message: %w", err)
|
|
375
517
|
}
|
|
376
|
-
return
|
|
518
|
+
return plaintext, &ciphertextHash, nil
|
|
377
519
|
}
|
|
378
520
|
|
|
379
|
-
func (cli *Client) decryptGroupMsg(child *waBinary.Node, from types.JID, chat types.JID) ([]byte, error) {
|
|
380
|
-
content,
|
|
521
|
+
func (cli *Client) decryptGroupMsg(ctx context.Context, child *waBinary.Node, from types.JID, chat types.JID, serverTS time.Time) ([]byte, *[32]byte, error) {
|
|
522
|
+
content, ok := child.Content.([]byte)
|
|
523
|
+
if !ok {
|
|
524
|
+
return nil, nil, fmt.Errorf("message content is not a byte slice")
|
|
525
|
+
}
|
|
381
526
|
|
|
382
527
|
senderKeyName := protocol.NewSenderKeyName(chat.String(), from.SignalAddress())
|
|
383
528
|
builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer)
|
|
384
529
|
cipher := groups.NewGroupCipher(builder, senderKeyName, cli.Store)
|
|
385
530
|
msg, err := protocol.NewSenderKeyMessageFromBytes(content, pbSerializer.SenderKeyMessage)
|
|
386
531
|
if err != nil {
|
|
387
|
-
return nil, fmt.Errorf("failed to parse group message: %w", err)
|
|
532
|
+
return nil, nil, fmt.Errorf("failed to parse group message: %w", err)
|
|
388
533
|
}
|
|
389
|
-
plaintext, err :=
|
|
534
|
+
plaintext, ciphertextHash, err := cli.bufferedDecrypt(ctx, content, serverTS, func(decryptCtx context.Context) ([]byte, error) {
|
|
535
|
+
return cipher.Decrypt(decryptCtx, msg)
|
|
536
|
+
})
|
|
390
537
|
if err != nil {
|
|
391
|
-
return nil, fmt.Errorf("failed to decrypt group message: %w", err)
|
|
538
|
+
return nil, nil, fmt.Errorf("failed to decrypt group message: %w", err)
|
|
392
539
|
}
|
|
393
|
-
|
|
394
|
-
|
|
540
|
+
plaintext, err = unpadMessage(plaintext, child.AttrGetter().Int("v"))
|
|
541
|
+
if err != nil {
|
|
542
|
+
return nil, nil, err
|
|
395
543
|
}
|
|
396
|
-
return
|
|
544
|
+
return plaintext, &ciphertextHash, nil
|
|
397
545
|
}
|
|
398
546
|
|
|
399
547
|
const checkPadding = true
|
|
@@ -404,14 +552,16 @@ func isValidPadding(plaintext []byte) bool {
|
|
|
404
552
|
return bytes.HasSuffix(plaintext, expectedPadding)
|
|
405
553
|
}
|
|
406
554
|
|
|
407
|
-
func unpadMessage(plaintext []byte) ([]byte, error) {
|
|
408
|
-
if
|
|
555
|
+
func unpadMessage(plaintext []byte, version int) ([]byte, error) {
|
|
556
|
+
if version == 3 {
|
|
557
|
+
return plaintext, nil
|
|
558
|
+
} else if len(plaintext) == 0 {
|
|
409
559
|
return nil, fmt.Errorf("plaintext is empty")
|
|
410
|
-
}
|
|
411
|
-
if checkPadding && !isValidPadding(plaintext) {
|
|
560
|
+
} else if checkPadding && !isValidPadding(plaintext) {
|
|
412
561
|
return nil, fmt.Errorf("plaintext doesn't have expected padding")
|
|
562
|
+
} else {
|
|
563
|
+
return plaintext[:len(plaintext)-int(plaintext[len(plaintext)-1])], nil
|
|
413
564
|
}
|
|
414
|
-
return plaintext[:len(plaintext)-int(plaintext[len(plaintext)-1])], nil
|
|
415
565
|
}
|
|
416
566
|
|
|
417
567
|
func padMessage(plaintext []byte) []byte {
|
|
@@ -424,7 +574,7 @@ func padMessage(plaintext []byte) []byte {
|
|
|
424
574
|
return plaintext
|
|
425
575
|
}
|
|
426
576
|
|
|
427
|
-
func (cli *Client) handleSenderKeyDistributionMessage(chat, from types.JID, axolotlSKDM []byte) {
|
|
577
|
+
func (cli *Client) handleSenderKeyDistributionMessage(ctx context.Context, chat, from types.JID, axolotlSKDM []byte) {
|
|
428
578
|
builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer)
|
|
429
579
|
senderKeyName := protocol.NewSenderKeyName(chat.String(), from.SignalAddress())
|
|
430
580
|
sdkMsg, err := protocol.NewSenderKeyDistributionMessageFromBytes(axolotlSKDM, pbSerializer.SenderKeyDistributionMessage)
|
|
@@ -432,7 +582,11 @@ func (cli *Client) handleSenderKeyDistributionMessage(chat, from types.JID, axol
|
|
|
432
582
|
cli.Log.Errorf("Failed to parse sender key distribution message from %s for %s: %v", from, chat, err)
|
|
433
583
|
return
|
|
434
584
|
}
|
|
435
|
-
builder.Process(senderKeyName, sdkMsg)
|
|
585
|
+
err = builder.Process(ctx, senderKeyName, sdkMsg)
|
|
586
|
+
if err != nil {
|
|
587
|
+
cli.Log.Errorf("Failed to process sender key distribution message from %s for %s: %v", from, chat, err)
|
|
588
|
+
return
|
|
589
|
+
}
|
|
436
590
|
cli.Log.Debugf("Processed sender key distribution message from %s in %s", senderKeyName.Sender().String(), senderKeyName.GroupID())
|
|
437
591
|
}
|
|
438
592
|
|
|
@@ -451,14 +605,15 @@ func (cli *Client) handleHistorySyncNotificationLoop() {
|
|
|
451
605
|
go cli.handleHistorySyncNotificationLoop()
|
|
452
606
|
}
|
|
453
607
|
}()
|
|
608
|
+
ctx := context.TODO()
|
|
454
609
|
for notif := range cli.historySyncNotifications {
|
|
455
|
-
cli.handleHistorySyncNotification(notif)
|
|
610
|
+
cli.handleHistorySyncNotification(ctx, notif)
|
|
456
611
|
}
|
|
457
612
|
}
|
|
458
613
|
|
|
459
|
-
func (cli *Client) handleHistorySyncNotification(notif *waE2E.HistorySyncNotification) {
|
|
614
|
+
func (cli *Client) handleHistorySyncNotification(ctx context.Context, notif *waE2E.HistorySyncNotification) {
|
|
460
615
|
var historySync waHistorySync.HistorySync
|
|
461
|
-
if data, err := cli.Download(notif); err != nil {
|
|
616
|
+
if data, err := cli.Download(ctx, notif); err != nil {
|
|
462
617
|
cli.Log.Errorf("Failed to download history sync data: %v", err)
|
|
463
618
|
} else if reader, err := zlib.NewReader(bytes.NewReader(data)); err != nil {
|
|
464
619
|
cli.Log.Errorf("Failed to create zlib reader for history sync data: %v", err)
|
|
@@ -469,9 +624,9 @@ func (cli *Client) handleHistorySyncNotification(notif *waE2E.HistorySyncNotific
|
|
|
469
624
|
} else {
|
|
470
625
|
cli.Log.Debugf("Received history sync (type %s, chunk %d)", historySync.GetSyncType(), historySync.GetChunkOrder())
|
|
471
626
|
if historySync.GetSyncType() == waHistorySync.HistorySync_PUSH_NAME {
|
|
472
|
-
go cli.handleHistoricalPushNames(historySync.GetPushnames())
|
|
627
|
+
go cli.handleHistoricalPushNames(context.WithoutCancel(ctx), historySync.GetPushnames())
|
|
473
628
|
} else if len(historySync.GetConversations()) > 0 {
|
|
474
|
-
go cli.storeHistoricalMessageSecrets(historySync.GetConversations())
|
|
629
|
+
go cli.storeHistoricalMessageSecrets(context.WithoutCancel(ctx), historySync.GetConversations())
|
|
475
630
|
}
|
|
476
631
|
cli.dispatchEvent(&events.HistorySync{
|
|
477
632
|
Data: &historySync,
|
|
@@ -479,7 +634,7 @@ func (cli *Client) handleHistorySyncNotification(notif *waE2E.HistorySyncNotific
|
|
|
479
634
|
}
|
|
480
635
|
}
|
|
481
636
|
|
|
482
|
-
func (cli *Client) handleAppStateSyncKeyShare(keys *waE2E.AppStateSyncKeyShare) {
|
|
637
|
+
func (cli *Client) handleAppStateSyncKeyShare(ctx context.Context, keys *waE2E.AppStateSyncKeyShare) {
|
|
483
638
|
onlyResyncIfNotSynced := true
|
|
484
639
|
|
|
485
640
|
cli.Log.Debugf("Got %d new app state keys", len(keys.GetKeys()))
|
|
@@ -494,7 +649,7 @@ func (cli *Client) handleAppStateSyncKeyShare(keys *waE2E.AppStateSyncKeyShare)
|
|
|
494
649
|
if isReRequest {
|
|
495
650
|
onlyResyncIfNotSynced = false
|
|
496
651
|
}
|
|
497
|
-
err = cli.Store.AppStateKeys.PutAppStateSyncKey(key.GetKeyID().GetKeyID(), store.AppStateSyncKey{
|
|
652
|
+
err = cli.Store.AppStateKeys.PutAppStateSyncKey(ctx, key.GetKeyID().GetKeyID(), store.AppStateSyncKey{
|
|
498
653
|
Data: key.GetKeyData().GetKeyData(),
|
|
499
654
|
Fingerprint: marshaledFingerprint,
|
|
500
655
|
Timestamp: key.GetKeyData().GetTimestamp(),
|
|
@@ -508,7 +663,7 @@ func (cli *Client) handleAppStateSyncKeyShare(keys *waE2E.AppStateSyncKeyShare)
|
|
|
508
663
|
cli.appStateKeyRequestsLock.RUnlock()
|
|
509
664
|
|
|
510
665
|
for _, name := range appstate.AllPatchNames {
|
|
511
|
-
err := cli.FetchAppState(name, false, onlyResyncIfNotSynced)
|
|
666
|
+
err := cli.FetchAppState(ctx, name, false, onlyResyncIfNotSynced)
|
|
512
667
|
if err != nil {
|
|
513
668
|
cli.Log.Errorf("Failed to do initial fetch of app state %s: %v", name, err)
|
|
514
669
|
}
|
|
@@ -534,7 +689,7 @@ func (cli *Client) handlePlaceholderResendResponse(msg *waE2E.PeerDataOperationR
|
|
|
534
689
|
}
|
|
535
690
|
}
|
|
536
691
|
|
|
537
|
-
func (cli *Client) handleProtocolMessage(info *types.MessageInfo, msg *waE2E.Message) {
|
|
692
|
+
func (cli *Client) handleProtocolMessage(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) {
|
|
538
693
|
protoMsg := msg.GetProtocolMessage()
|
|
539
694
|
|
|
540
695
|
if protoMsg.GetHistorySyncNotification() != nil && info.IsFromMe {
|
|
@@ -550,7 +705,7 @@ func (cli *Client) handleProtocolMessage(info *types.MessageInfo, msg *waE2E.Mes
|
|
|
550
705
|
}
|
|
551
706
|
|
|
552
707
|
if protoMsg.GetAppStateSyncKeyShare() != nil && info.IsFromMe {
|
|
553
|
-
go cli.handleAppStateSyncKeyShare(protoMsg.AppStateSyncKeyShare)
|
|
708
|
+
go cli.handleAppStateSyncKeyShare(context.WithoutCancel(ctx), protoMsg.AppStateSyncKeyShare)
|
|
554
709
|
}
|
|
555
710
|
|
|
556
711
|
if info.Category == "peer" {
|
|
@@ -558,7 +713,8 @@ func (cli *Client) handleProtocolMessage(info *types.MessageInfo, msg *waE2E.Mes
|
|
|
558
713
|
}
|
|
559
714
|
}
|
|
560
715
|
|
|
561
|
-
func (cli *Client) processProtocolParts(info *types.MessageInfo, msg *waE2E.Message) {
|
|
716
|
+
func (cli *Client) processProtocolParts(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) {
|
|
717
|
+
cli.storeMessageSecret(ctx, info, msg)
|
|
562
718
|
// Hopefully sender key distribution messages and protocol messages can't be inside ephemeral messages
|
|
563
719
|
if msg.GetDeviceSentMessage().GetMessage() != nil {
|
|
564
720
|
msg = msg.GetDeviceSentMessage().GetMessage()
|
|
@@ -567,20 +723,23 @@ func (cli *Client) processProtocolParts(info *types.MessageInfo, msg *waE2E.Mess
|
|
|
567
723
|
if !info.IsGroup {
|
|
568
724
|
cli.Log.Warnf("Got sender key distribution message in non-group chat from %s", info.Sender)
|
|
569
725
|
} else {
|
|
570
|
-
|
|
726
|
+
encryptionIdentity := info.Sender
|
|
727
|
+
if encryptionIdentity.Server == types.DefaultUserServer && info.SenderAlt.Server == types.HiddenUserServer {
|
|
728
|
+
encryptionIdentity = info.SenderAlt
|
|
729
|
+
}
|
|
730
|
+
cli.handleSenderKeyDistributionMessage(ctx, info.Chat, encryptionIdentity, msg.SenderKeyDistributionMessage.AxolotlSenderKeyDistributionMessage)
|
|
571
731
|
}
|
|
572
732
|
}
|
|
573
733
|
// N.B. Edits are protocol messages, but they're also wrapped inside EditedMessage,
|
|
574
734
|
// which is only unwrapped after processProtocolParts, so this won't trigger for edits.
|
|
575
735
|
if msg.GetProtocolMessage() != nil {
|
|
576
|
-
cli.handleProtocolMessage(info, msg)
|
|
736
|
+
cli.handleProtocolMessage(ctx, info, msg)
|
|
577
737
|
}
|
|
578
|
-
cli.storeMessageSecret(info, msg)
|
|
579
738
|
}
|
|
580
739
|
|
|
581
|
-
func (cli *Client) storeMessageSecret(info *types.MessageInfo, msg *waE2E.Message) {
|
|
740
|
+
func (cli *Client) storeMessageSecret(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) {
|
|
582
741
|
if msgSecret := msg.GetMessageContextInfo().GetMessageSecret(); len(msgSecret) > 0 {
|
|
583
|
-
err := cli.Store.MsgSecrets.PutMessageSecret(info.Chat, info.Sender, info.ID, msgSecret)
|
|
742
|
+
err := cli.Store.MsgSecrets.PutMessageSecret(ctx, info.Chat, info.Sender, info.ID, msgSecret)
|
|
584
743
|
if err != nil {
|
|
585
744
|
cli.Log.Errorf("Failed to store message secret key for %s: %v", info.ID, err)
|
|
586
745
|
} else {
|
|
@@ -589,7 +748,7 @@ func (cli *Client) storeMessageSecret(info *types.MessageInfo, msg *waE2E.Messag
|
|
|
589
748
|
}
|
|
590
749
|
}
|
|
591
750
|
|
|
592
|
-
func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.Conversation) {
|
|
751
|
+
func (cli *Client) storeHistoricalMessageSecrets(ctx context.Context, conversations []*waHistorySync.Conversation) {
|
|
593
752
|
var secrets []store.MessageSecretInsert
|
|
594
753
|
var privacyTokens []store.PrivacyToken
|
|
595
754
|
ownID := cli.getOwnID().ToNonAD()
|
|
@@ -639,7 +798,7 @@ func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.
|
|
|
639
798
|
}
|
|
640
799
|
if len(secrets) > 0 {
|
|
641
800
|
cli.Log.Debugf("Storing %d message secret keys in history sync", len(secrets))
|
|
642
|
-
err := cli.Store.MsgSecrets.PutMessageSecrets(secrets)
|
|
801
|
+
err := cli.Store.MsgSecrets.PutMessageSecrets(ctx, secrets)
|
|
643
802
|
if err != nil {
|
|
644
803
|
cli.Log.Errorf("Failed to store message secret keys in history sync: %v", err)
|
|
645
804
|
} else {
|
|
@@ -648,7 +807,7 @@ func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.
|
|
|
648
807
|
}
|
|
649
808
|
if len(privacyTokens) > 0 {
|
|
650
809
|
cli.Log.Debugf("Storing %d privacy tokens in history sync", len(privacyTokens))
|
|
651
|
-
err := cli.Store.PrivacyTokens.PutPrivacyTokens(privacyTokens...)
|
|
810
|
+
err := cli.Store.PrivacyTokens.PutPrivacyTokens(ctx, privacyTokens...)
|
|
652
811
|
if err != nil {
|
|
653
812
|
cli.Log.Errorf("Failed to store privacy tokens in history sync: %v", err)
|
|
654
813
|
} else {
|
|
@@ -657,8 +816,8 @@ func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.
|
|
|
657
816
|
}
|
|
658
817
|
}
|
|
659
818
|
|
|
660
|
-
func (cli *Client) handleDecryptedMessage(info *types.MessageInfo, msg *waE2E.Message, retryCount int) {
|
|
661
|
-
cli.processProtocolParts(info, msg)
|
|
819
|
+
func (cli *Client) handleDecryptedMessage(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message, retryCount int) {
|
|
820
|
+
cli.processProtocolParts(ctx, info, msg)
|
|
662
821
|
evt := &events.Message{Info: *info, RawMessage: msg, RetryCount: retryCount}
|
|
663
822
|
cli.dispatchEvent(evt.UnwrapRaw())
|
|
664
823
|
}
|