slidge-whatsapp 0.2.5__cp311-cp311-manylinux_2_36_aarch64.whl → 0.3.0__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.

Files changed (484) hide show
  1. slidge_whatsapp/config.py +3 -0
  2. slidge_whatsapp/contact.py +15 -3
  3. slidge_whatsapp/event.go +171 -70
  4. slidge_whatsapp/gateway.go +16 -68
  5. slidge_whatsapp/gateway.py +4 -5
  6. slidge_whatsapp/generated/_whatsapp.cpython-311-aarch64-linux-gnu.h +168 -151
  7. slidge_whatsapp/generated/_whatsapp.cpython-311-aarch64-linux-gnu.so +0 -0
  8. slidge_whatsapp/generated/build.py +142 -128
  9. slidge_whatsapp/generated/whatsapp.c +1689 -1417
  10. slidge_whatsapp/generated/whatsapp.go +1011 -900
  11. slidge_whatsapp/generated/whatsapp.py +1175 -1050
  12. slidge_whatsapp/generated/whatsapp_go.h +168 -151
  13. slidge_whatsapp/go.mod +21 -15
  14. slidge_whatsapp/go.sum +49 -31
  15. slidge_whatsapp/group.py +34 -30
  16. slidge_whatsapp/media/media.go +22 -12
  17. slidge_whatsapp/session.go +106 -82
  18. slidge_whatsapp/session.py +46 -14
  19. slidge_whatsapp/vendor/github.com/beeper/argo-go/LICENSE +9 -0
  20. slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockreader.go +329 -0
  21. slidge_whatsapp/vendor/github.com/beeper/argo-go/block/blockwriter.go +417 -0
  22. slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/decoder.go +652 -0
  23. slidge_whatsapp/vendor/github.com/beeper/argo-go/codec/encoder.go +985 -0
  24. slidge_whatsapp/vendor/github.com/beeper/argo-go/header/header.go +135 -0
  25. slidge_whatsapp/vendor/github.com/beeper/argo-go/internal/util/util.go +133 -0
  26. slidge_whatsapp/vendor/github.com/beeper/argo-go/label/label.go +384 -0
  27. slidge_whatsapp/vendor/github.com/beeper/argo-go/label/wiremarkers.go +37 -0
  28. slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/bitset/bitset.go +197 -0
  29. slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/buf/buf.go +420 -0
  30. slidge_whatsapp/vendor/github.com/beeper/argo-go/pkg/varint/varint.go +246 -0
  31. slidge_whatsapp/vendor/github.com/beeper/argo-go/wire/wire.go +614 -0
  32. slidge_whatsapp/vendor/github.com/beeper/argo-go/wirecodec/decode.go +341 -0
  33. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn.go +4 -4
  34. slidge_whatsapp/vendor/github.com/ebitengine/purego/dlfcn_darwin.go +0 -5
  35. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go +3 -0
  36. slidge_whatsapp/vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go +40 -20
  37. slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/LICENSE +21 -0
  38. slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/list.go +95 -0
  39. slidge_whatsapp/vendor/github.com/elliotchance/orderedmap/v3/orderedmap.go +187 -0
  40. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz.go +1 -0
  41. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_cgo.go +3 -0
  42. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/fitz_nocgo.go +4 -5
  43. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_darwin.go +11 -1
  44. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_linux.go +10 -0
  45. slidge_whatsapp/vendor/github.com/gen2brain/go-fitz/purego_windows.go +12 -0
  46. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/.gitignore +0 -2
  47. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/CHANGELOG.md +44 -1
  48. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/COPYRIGHT.txt +6 -1
  49. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/README.md +14 -17
  50. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi.go +1 -1
  51. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi2.go +7 -0
  52. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/LICENSE +21 -0
  53. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_amd64/libffi.8.dylib +0 -0
  54. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/darwin_arm64/libffi.8.dylib +0 -0
  55. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/assets/libffi/windows_amd64/libffi-8.dll +0 -0
  56. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif.go +15 -0
  57. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/cif_arm64.go +16 -0
  58. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed.go +49 -0
  59. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_amd64.go +10 -0
  60. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_darwin_arm64.go +10 -0
  61. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/embed_windows_amd64.go +10 -0
  62. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/ffi.go +53 -15
  63. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/fun.go +10 -2
  64. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/init.go +22 -9
  65. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib.go +1 -1
  66. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib_unix.go +1 -1
  67. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/lib_windows.go +1 -1
  68. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/README.md +4 -7
  69. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/callback.go +2 -1
  70. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.c +11545 -6680
  71. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3-binding.h +527 -273
  72. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3.go +57 -23
  73. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.c +4 -0
  74. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_unlock_notify.go +4 -0
  75. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3_opt_userauth.go +13 -140
  76. slidge_whatsapp/vendor/github.com/mattn/go-sqlite3/sqlite3ext.h +4 -0
  77. slidge_whatsapp/vendor/github.com/petermattis/goid/.gitignore +4 -0
  78. slidge_whatsapp/vendor/github.com/petermattis/goid/LICENSE +202 -0
  79. slidge_whatsapp/vendor/github.com/petermattis/goid/README.md +4 -0
  80. slidge_whatsapp/vendor/github.com/petermattis/goid/goid.go +35 -0
  81. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_gccgo.go +26 -0
  82. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.3.c +23 -0
  83. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.3.go +22 -0
  84. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.4.go +35 -0
  85. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.4.s +18 -0
  86. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.5.go +28 -0
  87. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_go1.5.s +44 -0
  88. slidge_whatsapp/vendor/github.com/petermattis/goid/goid_slow.go +24 -0
  89. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_gccgo_go1.8.go +17 -0
  90. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.23.go +38 -0
  91. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.25.go +37 -0
  92. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.5.go +57 -0
  93. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.6.go +43 -0
  94. slidge_whatsapp/vendor/github.com/petermattis/goid/runtime_go1.9.go +37 -0
  95. slidge_whatsapp/vendor/github.com/rs/zerolog/CONTRIBUTING.md +43 -0
  96. slidge_whatsapp/vendor/github.com/rs/zerolog/README.md +31 -0
  97. slidge_whatsapp/vendor/github.com/rs/zerolog/console.go +20 -5
  98. slidge_whatsapp/vendor/github.com/rs/zerolog/log/log.go +131 -0
  99. slidge_whatsapp/vendor/github.com/rs/zerolog/log.go +1 -1
  100. slidge_whatsapp/vendor/github.com/rs/zerolog/sampler.go +4 -1
  101. slidge_whatsapp/vendor/github.com/rs/zerolog/writer.go +9 -0
  102. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/LICENSE +19 -0
  103. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/argmap.go +37 -0
  104. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/collections.go +148 -0
  105. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/comment.go +31 -0
  106. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/decode.go +216 -0
  107. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/definition.go +110 -0
  108. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/directive.go +43 -0
  109. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/document.go +89 -0
  110. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/dumper.go +159 -0
  111. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/fragment.go +41 -0
  112. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/operation.go +32 -0
  113. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/path.go +72 -0
  114. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/selection.go +41 -0
  115. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/source.go +19 -0
  116. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/type.go +68 -0
  117. slidge_whatsapp/vendor/github.com/vektah/gqlparser/v2/ast/value.go +122 -0
  118. slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/GroupCipher.go +17 -6
  119. slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/GroupSessionBuilder.go +17 -7
  120. slidge_whatsapp/vendor/go.mau.fi/libsignal/groups/state/store/SenderKeyStore.go +4 -2
  121. slidge_whatsapp/vendor/go.mau.fi/libsignal/keys/chain/ChainKey.go +1 -0
  122. slidge_whatsapp/vendor/go.mau.fi/libsignal/keys/identity/IdentityKey.go +1 -0
  123. slidge_whatsapp/vendor/go.mau.fi/libsignal/logger/DefaultLogger.go +2 -2
  124. slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/FingerprintProtocol.pb.go +3 -2
  125. slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/LocalStorageProtocol.pb.go +3 -2
  126. slidge_whatsapp/vendor/go.mau.fi/libsignal/serialize/WhisperTextProtocol.pb.go +3 -2
  127. slidge_whatsapp/vendor/go.mau.fi/libsignal/session/Session.go +41 -17
  128. slidge_whatsapp/vendor/go.mau.fi/libsignal/session/SessionCipher.go +64 -30
  129. slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/IdentityKeyStore.go +5 -3
  130. slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/MessageKeyStore.go +6 -4
  131. slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/PreKeyStore.go +6 -4
  132. slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/SessionStore.go +8 -6
  133. slidge_whatsapp/vendor/go.mau.fi/libsignal/state/store/SignedPreKeyStore.go +7 -5
  134. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/connlog.go +257 -0
  135. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/database.go +309 -0
  136. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/iter.go +233 -0
  137. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/json.go +47 -0
  138. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/log.go +129 -0
  139. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/massinsert.go +164 -0
  140. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/queryhelper.go +137 -0
  141. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/reflectscan.go +30 -0
  142. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/transaction.go +180 -0
  143. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgrades.go +250 -0
  144. slidge_whatsapp/vendor/go.mau.fi/util/dbutil/upgradetable.go +331 -0
  145. slidge_whatsapp/vendor/go.mau.fi/util/exerrors/dualerror.go +33 -0
  146. slidge_whatsapp/vendor/go.mau.fi/util/exerrors/must.go +23 -0
  147. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/cors.go +32 -0
  148. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/handleerrors.go +98 -0
  149. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/json.go +36 -0
  150. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/middleware.go +30 -0
  151. slidge_whatsapp/vendor/go.mau.fi/util/exhttp/networkerror.go +38 -0
  152. slidge_whatsapp/vendor/go.mau.fi/util/exstrings/stringutil.go +104 -0
  153. slidge_whatsapp/vendor/go.mau.fi/util/exsync/event.go +104 -0
  154. slidge_whatsapp/vendor/go.mau.fi/util/exsync/returnonce.go +25 -0
  155. slidge_whatsapp/vendor/go.mau.fi/util/exsync/ringbuffer.go +139 -0
  156. slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncmap.go +94 -0
  157. slidge_whatsapp/vendor/go.mau.fi/util/exsync/syncset.go +136 -0
  158. slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/callermarshal.go +28 -0
  159. slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/defaults.go +32 -0
  160. slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/generics.go +45 -0
  161. slidge_whatsapp/vendor/go.mau.fi/util/exzerolog/writer.go +81 -0
  162. slidge_whatsapp/vendor/go.mau.fi/util/ptr/ptr.go +43 -0
  163. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/.pre-commit-config.yaml +3 -3
  164. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/decode.go +27 -26
  165. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/encode.go +4 -3
  166. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/hash.go +1 -1
  167. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate/keys.go +5 -4
  168. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/appstate.go +32 -26
  169. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo-wire-type-store.argo +63 -0
  170. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/argo.go +62 -0
  171. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/argo/name-to-queryids.json +306 -0
  172. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/armadillomessage.go +42 -8
  173. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/binary/encoder.go +1 -1
  174. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/broadcast.go +5 -4
  175. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/call.go +2 -1
  176. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/client.go +134 -55
  177. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/connectionevents.go +34 -11
  178. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download-to-file.go +63 -30
  179. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/download.go +78 -34
  180. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/errors.go +4 -0
  181. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/group.go +157 -55
  182. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/internals.go +202 -154
  183. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/keepalive.go +3 -2
  184. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaconn.go +5 -3
  185. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/mediaretry.go +2 -1
  186. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/message.go +448 -138
  187. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/msgsecret.go +106 -31
  188. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/newsletter.go +83 -7
  189. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/notification.go +83 -43
  190. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair-code.go +9 -6
  191. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/pair.go +42 -18
  192. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/prekeys.go +9 -5
  193. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/presence.go +17 -7
  194. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/privacysettings.go +10 -11
  195. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/extra.go +7 -0
  196. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.pb.go +983 -0
  197. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/InstamadilloAddMessage.proto +85 -0
  198. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloAddMessage/extra.go +3 -0
  199. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.pb.go +197 -0
  200. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeActionLog/InstamadilloCoreTypeActionLog.proto +13 -0
  201. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.pb.go +279 -0
  202. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeAdminMessage/InstamadilloCoreTypeAdminMessage.proto +21 -0
  203. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.pb.go +137 -0
  204. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeCollection/InstamadilloCoreTypeCollection.proto +10 -0
  205. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.pb.go +313 -0
  206. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeLink/InstamadilloCoreTypeLink.proto +27 -0
  207. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.pb.go +1299 -0
  208. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeMedia/InstamadilloCoreTypeMedia.proto +112 -0
  209. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.pb.go +514 -0
  210. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloCoreTypeText/InstamadilloCoreTypeText.proto +47 -0
  211. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.pb.go +123 -0
  212. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/InstamadilloDeleteMessage.proto +7 -0
  213. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloDeleteMessage/extra.go +3 -0
  214. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.pb.go +720 -0
  215. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/InstamadilloSupplementMessage.proto +59 -0
  216. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloSupplementMessage/extra.go +3 -0
  217. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.pb.go +365 -0
  218. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloTransportPayload/InstamadilloTransportPayload.proto +33 -0
  219. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.pb.go +1238 -0
  220. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/instamadilloXmaContentRef/InstamadilloXmaContentRef.proto +105 -0
  221. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.go +39 -9
  222. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.go +354 -175
  223. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.proto +5 -5
  224. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.go +170 -15
  225. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.proto +4 -0
  226. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.pb.go +5156 -0
  227. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waBotMetadata/WABotMetadata.proto +516 -0
  228. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.go +29 -9
  229. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.go +13 -9
  230. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.go +344 -31
  231. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.proto +26 -0
  232. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/{WAWebProtobufsCompanionReg.pb.go → WACompanionReg.pb.go} +211 -89
  233. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/{WAWebProtobufsCompanionReg.proto → WACompanionReg.proto} +5 -1
  234. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.go +173 -9
  235. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.go +78 -16
  236. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.proto +5 -0
  237. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.go +7463 -5180
  238. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.proto +366 -343
  239. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.go +485 -135
  240. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.proto +17 -0
  241. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.pb.go +198 -0
  242. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload/WAWebProtobufLidMigrationSyncPayload.proto +14 -0
  243. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.go +162 -9
  244. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.proto +1 -0
  245. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.go +32 -9
  246. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.proto +1 -0
  247. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.go +192 -52
  248. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.proto +8 -0
  249. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.go +60 -9
  250. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/extra.go +7 -6
  251. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.go +39 -9
  252. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.go +61 -9
  253. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.pb.go +952 -0
  254. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waStatusAttributions/WAStatusAttributions.proto +88 -0
  255. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.go +1802 -453
  256. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.proto +92 -0
  257. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.go +27 -9
  258. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.go +59 -9
  259. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.go +435 -109
  260. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.proto +11 -0
  261. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.go +563 -9
  262. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.proto +4 -0
  263. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/receipt.go +32 -9
  264. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingfields.json +1 -0
  265. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/reportingtoken.go +176 -0
  266. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/retry.go +39 -21
  267. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/send.go +267 -79
  268. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/sendfb.go +28 -16
  269. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/clientpayload.go +3 -1
  270. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/noop.go +87 -44
  271. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/signal.go +75 -88
  272. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/container.go +86 -65
  273. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/lidmap.go +186 -0
  274. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/store.go +314 -170
  275. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/00-latest-schema.sql +155 -0
  276. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/03-message-secrets.sql +11 -0
  277. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/04-privacy-tokens.sql +8 -0
  278. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/05-account-jid-format.sql +2 -0
  279. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/06-facebook-uuid.sql +2 -0
  280. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/07-account-lid.sql +2 -0
  281. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/08-lid-mapping.sql +5 -0
  282. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/09-decryption-buffer.sql +10 -0
  283. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/10-chat-db-lid-migration-ts.sql +2 -0
  284. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrades/upgrades.go +22 -0
  285. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/store.go +109 -56
  286. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/botmap.go +210 -0
  287. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/call.go +1 -0
  288. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/events/events.go +21 -2
  289. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/group.go +15 -6
  290. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/jid.go +9 -9
  291. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/message.go +18 -0
  292. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/types/user.go +2 -0
  293. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/update.go +3 -2
  294. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/upload.go +1 -1
  295. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/user.go +59 -37
  296. slidge_whatsapp/vendor/golang.org/x/crypto/curve25519/curve25519.go +1 -1
  297. slidge_whatsapp/vendor/golang.org/x/exp/LICENSE +27 -0
  298. slidge_whatsapp/vendor/golang.org/x/exp/PATENTS +22 -0
  299. slidge_whatsapp/vendor/golang.org/x/exp/constraints/constraints.go +54 -0
  300. slidge_whatsapp/vendor/golang.org/x/net/http/httpguts/guts.go +50 -0
  301. slidge_whatsapp/vendor/golang.org/x/net/http/httpguts/httplex.go +347 -0
  302. slidge_whatsapp/vendor/golang.org/x/net/http2/.gitignore +2 -0
  303. slidge_whatsapp/vendor/golang.org/x/net/http2/ascii.go +53 -0
  304. slidge_whatsapp/vendor/golang.org/x/net/http2/ciphers.go +641 -0
  305. slidge_whatsapp/vendor/golang.org/x/net/http2/client_conn_pool.go +311 -0
  306. slidge_whatsapp/vendor/golang.org/x/net/http2/config.go +164 -0
  307. slidge_whatsapp/vendor/golang.org/x/net/http2/databuffer.go +149 -0
  308. slidge_whatsapp/vendor/golang.org/x/net/http2/errors.go +145 -0
  309. slidge_whatsapp/vendor/golang.org/x/net/http2/flow.go +120 -0
  310. slidge_whatsapp/vendor/golang.org/x/net/http2/frame.go +1702 -0
  311. slidge_whatsapp/vendor/golang.org/x/net/http2/gotrack.go +181 -0
  312. slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/encode.go +245 -0
  313. slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/hpack.go +523 -0
  314. slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/huffman.go +226 -0
  315. slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/static_table.go +188 -0
  316. slidge_whatsapp/vendor/golang.org/x/net/http2/hpack/tables.go +403 -0
  317. slidge_whatsapp/vendor/golang.org/x/net/http2/http2.go +410 -0
  318. slidge_whatsapp/vendor/golang.org/x/net/http2/pipe.go +184 -0
  319. slidge_whatsapp/vendor/golang.org/x/net/http2/server.go +3332 -0
  320. slidge_whatsapp/vendor/golang.org/x/net/http2/transport.go +3233 -0
  321. slidge_whatsapp/vendor/golang.org/x/net/http2/unencrypted.go +32 -0
  322. slidge_whatsapp/vendor/golang.org/x/net/http2/write.go +381 -0
  323. slidge_whatsapp/vendor/golang.org/x/net/http2/writesched.go +251 -0
  324. slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_priority.go +451 -0
  325. slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_random.go +77 -0
  326. slidge_whatsapp/vendor/golang.org/x/net/http2/writesched_roundrobin.go +119 -0
  327. slidge_whatsapp/vendor/golang.org/x/net/idna/go118.go +13 -0
  328. slidge_whatsapp/vendor/golang.org/x/net/idna/idna10.0.0.go +769 -0
  329. slidge_whatsapp/vendor/golang.org/x/net/idna/idna9.0.0.go +717 -0
  330. slidge_whatsapp/vendor/golang.org/x/net/idna/pre_go118.go +11 -0
  331. slidge_whatsapp/vendor/golang.org/x/net/idna/punycode.go +217 -0
  332. slidge_whatsapp/vendor/golang.org/x/net/idna/tables10.0.0.go +4559 -0
  333. slidge_whatsapp/vendor/golang.org/x/net/idna/tables11.0.0.go +4653 -0
  334. slidge_whatsapp/vendor/golang.org/x/net/idna/tables12.0.0.go +4733 -0
  335. slidge_whatsapp/vendor/golang.org/x/net/idna/tables13.0.0.go +4959 -0
  336. slidge_whatsapp/vendor/golang.org/x/net/idna/tables15.0.0.go +5144 -0
  337. slidge_whatsapp/vendor/golang.org/x/net/idna/tables9.0.0.go +4486 -0
  338. slidge_whatsapp/vendor/golang.org/x/net/idna/trie.go +51 -0
  339. slidge_whatsapp/vendor/golang.org/x/net/idna/trie12.0.0.go +30 -0
  340. slidge_whatsapp/vendor/golang.org/x/net/idna/trie13.0.0.go +30 -0
  341. slidge_whatsapp/vendor/golang.org/x/net/idna/trieval.go +119 -0
  342. slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/ascii.go +53 -0
  343. slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/headermap.go +115 -0
  344. slidge_whatsapp/vendor/golang.org/x/net/internal/httpcommon/request.go +467 -0
  345. slidge_whatsapp/vendor/golang.org/x/sys/unix/affinity_linux.go +1 -3
  346. slidge_whatsapp/vendor/golang.org/x/sys/unix/mkerrors.sh +3 -0
  347. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_darwin.go +93 -0
  348. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_linux.go +16 -26
  349. slidge_whatsapp/vendor/golang.org/x/sys/unix/syscall_solaris.go +1 -1
  350. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux.go +47 -16
  351. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_386.go +3 -0
  352. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go +3 -0
  353. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm.go +3 -0
  354. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go +3 -0
  355. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go +3 -0
  356. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips.go +3 -0
  357. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go +3 -0
  358. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go +3 -0
  359. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go +3 -0
  360. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go +3 -0
  361. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go +3 -0
  362. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go +3 -0
  363. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go +3 -0
  364. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go +3 -0
  365. slidge_whatsapp/vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go +3 -0
  366. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +84 -0
  367. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +20 -0
  368. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +84 -0
  369. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +20 -0
  370. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsyscall_solaris_amd64.go +4 -4
  371. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_386.go +1 -0
  372. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go +1 -0
  373. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go +1 -0
  374. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go +1 -0
  375. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go +1 -0
  376. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go +1 -0
  377. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go +1 -0
  378. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go +1 -0
  379. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go +1 -0
  380. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go +1 -0
  381. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go +1 -0
  382. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go +1 -0
  383. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go +1 -0
  384. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go +1 -0
  385. slidge_whatsapp/vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go +1 -0
  386. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux.go +168 -12
  387. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_386.go +17 -1
  388. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go +16 -0
  389. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm.go +18 -2
  390. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go +16 -0
  391. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go +16 -0
  392. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips.go +17 -1
  393. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go +16 -0
  394. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go +16 -0
  395. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go +17 -1
  396. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go +18 -2
  397. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go +16 -0
  398. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go +16 -0
  399. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go +16 -0
  400. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go +16 -0
  401. slidge_whatsapp/vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go +16 -0
  402. slidge_whatsapp/vendor/golang.org/x/sys/windows/security_windows.go +44 -5
  403. slidge_whatsapp/vendor/golang.org/x/sys/windows/syscall_windows.go +4 -2
  404. slidge_whatsapp/vendor/golang.org/x/sys/windows/types_windows.go +245 -0
  405. slidge_whatsapp/vendor/golang.org/x/sys/windows/zsyscall_windows.go +491 -482
  406. slidge_whatsapp/vendor/golang.org/x/text/LICENSE +27 -0
  407. slidge_whatsapp/vendor/golang.org/x/text/PATENTS +22 -0
  408. slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule.go +336 -0
  409. slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule10.0.0.go +11 -0
  410. slidge_whatsapp/vendor/golang.org/x/text/secure/bidirule/bidirule9.0.0.go +14 -0
  411. slidge_whatsapp/vendor/golang.org/x/text/transform/transform.go +709 -0
  412. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/bidi.go +359 -0
  413. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/bracket.go +335 -0
  414. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/core.go +1071 -0
  415. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/prop.go +206 -0
  416. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables10.0.0.go +1815 -0
  417. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables11.0.0.go +1887 -0
  418. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables12.0.0.go +1923 -0
  419. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables13.0.0.go +1955 -0
  420. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables15.0.0.go +2042 -0
  421. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/tables9.0.0.go +1781 -0
  422. slidge_whatsapp/vendor/golang.org/x/text/unicode/bidi/trieval.go +48 -0
  423. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/composition.go +512 -0
  424. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/forminfo.go +279 -0
  425. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/input.go +109 -0
  426. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/iter.go +458 -0
  427. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/normalize.go +610 -0
  428. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/readwriter.go +125 -0
  429. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +7657 -0
  430. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +7693 -0
  431. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +7710 -0
  432. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +7760 -0
  433. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables15.0.0.go +7907 -0
  434. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +7637 -0
  435. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/transform.go +88 -0
  436. slidge_whatsapp/vendor/golang.org/x/text/unicode/norm/trie.go +54 -0
  437. slidge_whatsapp/vendor/google.golang.org/protobuf/encoding/protowire/wire.go +25 -1
  438. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/editiondefaults/editions_defaults.binpb +0 -0
  439. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/editions.go +13 -5
  440. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/filedesc/presence.go +33 -0
  441. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/api_gen.go +6 -0
  442. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/genid/descriptor_gen.go +81 -19
  443. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/codec_message_opaque.go +2 -1
  444. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/message_opaque.go +8 -37
  445. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/impl/presence.go +0 -3
  446. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/strs/{strings_unsafe_go121.go → strings_unsafe.go} +0 -2
  447. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/version/version.go +1 -1
  448. slidge_whatsapp/vendor/google.golang.org/protobuf/proto/merge.go +6 -0
  449. slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/source_gen.go +10 -0
  450. slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/{value_unsafe_go121.go → value_unsafe.go} +0 -2
  451. slidge_whatsapp/vendor/modules.txt +80 -21
  452. {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.3.0.dist-info}/METADATA +5 -4
  453. {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.3.0.dist-info}/RECORD +456 -263
  454. {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.3.0.dist-info}/WHEEL +1 -1
  455. slidge_whatsapp/vendor/github.com/jupiterrider/ffi/abi_amd64.go +0 -7
  456. slidge_whatsapp/vendor/github.com/rs/zerolog/CNAME +0 -1
  457. slidge_whatsapp/vendor/github.com/rs/zerolog/_config.yml +0 -1
  458. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waAdv/WAAdv.pb.raw +0 -0
  459. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloApplication/WAArmadilloApplication.pb.raw +0 -0
  460. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waArmadilloXMA/WAArmadilloXMA.pb.raw +0 -0
  461. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCert/WACert.pb.raw +0 -23
  462. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waChatLockSettings/WAProtobufsChatLockSettings.pb.raw +0 -7
  463. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCommon/WACommon.pb.raw +0 -0
  464. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waCompanionReg/WAWebProtobufsCompanionReg.pb.raw +0 -0
  465. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waConsumerApplication/WAConsumerApplication.pb.raw +0 -0
  466. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waDeviceCapabilities/WAProtobufsDeviceCapabilities.pb.raw +0 -0
  467. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waE2E/WAWebProtobufsE2E.pb.raw +0 -0
  468. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waHistorySync/WAWebProtobufsHistorySync.pb.raw +0 -0
  469. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMediaTransport/WAMediaTransport.pb.raw +0 -0
  470. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMmsRetry/WAMmsRetry.pb.raw +0 -0
  471. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgApplication/WAMsgApplication.pb.raw +0 -0
  472. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMsgTransport/WAMsgTransport.pb.raw +0 -0
  473. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waMultiDevice/WAMultiDevice.pb.raw +0 -0
  474. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waServerSync/WAServerSync.pb.raw +0 -0
  475. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waSyncAction/WASyncAction.pb.raw +0 -0
  476. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waUserPassword/WAProtobufsUserPassword.pb.raw +0 -0
  477. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waVnameCert/WAWebProtobufsVnameCert.pb.raw +0 -0
  478. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWa6/WAWebProtobufsWa6.pb.raw +0 -0
  479. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/proto/waWeb/WAWebProtobufsWeb.pb.raw +0 -0
  480. slidge_whatsapp/vendor/go.mau.fi/whatsmeow/store/sqlstore/upgrade.go +0 -296
  481. slidge_whatsapp/vendor/google.golang.org/protobuf/internal/strs/strings_unsafe_go120.go +0 -94
  482. slidge_whatsapp/vendor/google.golang.org/protobuf/reflect/protoreflect/value_unsafe_go120.go +0 -98
  483. {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.3.0.dist-info}/entry_points.txt +0 -0
  484. {slidge_whatsapp-0.2.5.dist-info → slidge_whatsapp-0.3.0.dist-info/licenses}/LICENSE +0 -0
@@ -9,13 +9,17 @@ 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"
15
17
  "io"
16
18
  "runtime/debug"
19
+ "strconv"
17
20
  "time"
18
21
 
22
+ "github.com/rs/zerolog"
19
23
  "go.mau.fi/libsignal/groups"
20
24
  "go.mau.fi/libsignal/protocol"
21
25
  "go.mau.fi/libsignal/session"
@@ -27,6 +31,7 @@ import (
27
31
  waBinary "go.mau.fi/whatsmeow/binary"
28
32
  "go.mau.fi/whatsmeow/proto/waE2E"
29
33
  "go.mau.fi/whatsmeow/proto/waHistorySync"
34
+ "go.mau.fi/whatsmeow/proto/waLidMigrationSyncPayload"
30
35
  "go.mau.fi/whatsmeow/proto/waWeb"
31
36
  "go.mau.fi/whatsmeow/store"
32
37
  "go.mau.fi/whatsmeow/types"
@@ -36,33 +41,42 @@ import (
36
41
  var pbSerializer = store.SignalProtobufSerializer
37
42
 
38
43
  func (cli *Client) handleEncryptedMessage(node *waBinary.Node) {
44
+ ctx := cli.BackgroundEventCtx
39
45
  info, err := cli.parseMessageInfo(node)
40
46
  if err != nil {
41
47
  cli.Log.Warnf("Failed to parse message: %v", err)
42
48
  } else {
49
+ if !info.SenderAlt.IsEmpty() {
50
+ cli.StoreLIDPNMapping(ctx, info.SenderAlt, info.Sender)
51
+ } else if !info.RecipientAlt.IsEmpty() {
52
+ cli.StoreLIDPNMapping(ctx, info.RecipientAlt, info.Chat)
53
+ }
43
54
  if info.VerifiedName != nil && len(info.VerifiedName.Details.GetVerifiedName()) > 0 {
44
- go cli.updateBusinessName(info.Sender, info, info.VerifiedName.Details.GetVerifiedName())
55
+ go cli.updateBusinessName(cli.BackgroundEventCtx, info.Sender, info, info.VerifiedName.Details.GetVerifiedName())
45
56
  }
46
- if len(info.PushName) > 0 && info.PushName != "-" {
47
- go cli.updatePushName(info.Sender, info, info.PushName)
57
+ if len(info.PushName) > 0 && info.PushName != "-" && (cli.MessengerConfig == nil || info.PushName != "username") {
58
+ go cli.updatePushName(cli.BackgroundEventCtx, info.Sender, info, info.PushName)
48
59
  }
49
- defer cli.maybeDeferredAck(node)()
60
+ var cancelled bool
61
+ defer cli.maybeDeferredAck(ctx, node)(&cancelled)
50
62
  if info.Sender.Server == types.NewsletterServer {
51
- cli.handlePlaintextMessage(info, node)
63
+ cancelled = cli.handlePlaintextMessage(ctx, info, node)
52
64
  } else {
53
- cli.decryptMessages(info, node)
65
+ cancelled = cli.decryptMessages(ctx, info, node)
54
66
  }
55
67
  }
56
68
  }
57
69
 
58
70
  func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bool) (source types.MessageSource, err error) {
59
71
  clientID := cli.getOwnID()
72
+ clientLID := cli.getOwnLID()
60
73
  if clientID.IsEmpty() {
61
74
  err = ErrNotLoggedIn
62
75
  return
63
76
  }
64
77
  ag := node.AttrGetter()
65
78
  from := ag.JID("from")
79
+ source.AddressingMode = types.AddressingMode(ag.OptionalString("addressing_mode"))
66
80
  if from.Server == types.GroupServer || from.Server == types.BroadcastServer {
67
81
  source.IsGroup = true
68
82
  source.Chat = from
@@ -71,7 +85,12 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
71
85
  } else {
72
86
  source.Sender = ag.OptionalJIDOrEmpty("participant")
73
87
  }
74
- if source.Sender.User == clientID.User {
88
+ if source.AddressingMode == types.AddressingModeLID {
89
+ source.SenderAlt = ag.OptionalJIDOrEmpty("participant_pn")
90
+ } else {
91
+ source.SenderAlt = ag.OptionalJIDOrEmpty("participant_lid")
92
+ }
93
+ if source.Sender.User == clientID.User || source.Sender.User == clientLID.User {
75
94
  source.IsFromMe = true
76
95
  }
77
96
  if from.Server == types.BroadcastServer {
@@ -81,7 +100,7 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
81
100
  source.Chat = from
82
101
  source.Sender = from
83
102
  // TODO IsFromMe?
84
- } else if from.User == clientID.User {
103
+ } else if from.User == clientID.User || from.User == clientLID.User {
85
104
  source.IsFromMe = true
86
105
  source.Sender = from
87
106
  recipient := ag.OptionalJID("recipient")
@@ -90,6 +109,11 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
90
109
  } else {
91
110
  source.Chat = from.ToNonAD()
92
111
  }
112
+ if source.Chat.Server == types.HiddenUserServer {
113
+ source.RecipientAlt = ag.OptionalJIDOrEmpty("peer_recipient_pn")
114
+ } else {
115
+ source.RecipientAlt = ag.OptionalJIDOrEmpty("peer_recipient_lid")
116
+ }
93
117
  } else if from.IsBot() {
94
118
  source.Sender = from
95
119
  meta := node.GetChildByTag("meta")
@@ -103,6 +127,14 @@ func (cli *Client) parseMessageSource(node *waBinary.Node, requireParticipant bo
103
127
  } else {
104
128
  source.Chat = from.ToNonAD()
105
129
  source.Sender = from
130
+ if source.Sender.Server == types.HiddenUserServer {
131
+ source.SenderAlt = ag.OptionalJIDOrEmpty("sender_pn")
132
+ } else {
133
+ source.SenderAlt = ag.OptionalJIDOrEmpty("sender_lid")
134
+ }
135
+ }
136
+ if !source.SenderAlt.IsEmpty() && source.SenderAlt.Device == 0 {
137
+ source.SenderAlt.Device = source.Sender.Device
106
138
  }
107
139
  err = ag.Error()
108
140
  return
@@ -125,11 +157,15 @@ func (cli *Client) parseMsgMetaInfo(node waBinary.Node) (metaInfo types.MsgMetaI
125
157
  metaNode := node.GetChildByTag("meta")
126
158
 
127
159
  ag := metaNode.AttrGetter()
128
- metaInfo.TargetID = types.MessageID(ag.String("target_id"))
129
- targetSenderJID := ag.OptionalJIDOrEmpty("target_sender_jid")
130
- if targetSenderJID.User != "" {
131
- metaInfo.TargetSender = targetSenderJID
160
+ metaInfo.TargetID = types.MessageID(ag.OptionalString("target_id"))
161
+ metaInfo.TargetSender = ag.OptionalJIDOrEmpty("target_sender_jid")
162
+ metaInfo.TargetChat = ag.OptionalJIDOrEmpty("target_chat_jid")
163
+ deprecatedLIDSession, ok := ag.GetBool("deprecated_lid_session", false)
164
+ if ok {
165
+ metaInfo.DeprecatedLIDSession = &deprecatedLIDSession
132
166
  }
167
+ metaInfo.ThreadMessageID = types.MessageID(ag.OptionalString("thread_msg_id"))
168
+ metaInfo.ThreadMessageSenderJID = ag.OptionalJIDOrEmpty("thread_msg_sender_jid")
133
169
  err = ag.Error()
134
170
  return
135
171
  }
@@ -168,8 +204,10 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er
168
204
  cli.Log.Warnf("Failed to parse <bot> node in %s: %v", info.ID, err)
169
205
  }
170
206
  case "meta":
171
- // TODO parse non-bot metadata too
172
- info.MsgMetaInfo, _ = cli.parseMsgMetaInfo(child)
207
+ info.MsgMetaInfo, err = cli.parseMsgMetaInfo(child)
208
+ if err != nil {
209
+ cli.Log.Warnf("Failed to parse <meta> node in %s: %v", info.ID, err)
210
+ }
173
211
  case "franking":
174
212
  // TODO
175
213
  case "trace":
@@ -184,7 +222,7 @@ func (cli *Client) parseMessageInfo(node *waBinary.Node) (*types.MessageInfo, er
184
222
  return &info, nil
185
223
  }
186
224
 
187
- func (cli *Client) handlePlaintextMessage(info *types.MessageInfo, node *waBinary.Node) {
225
+ func (cli *Client) handlePlaintextMessage(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) (handlerFailed bool) {
188
226
  // TODO edits have an additional <meta msg_edit_t="1696321271735" original_msg_t="1696321248"/> node
189
227
  plaintext, ok := node.GetOptionalChildByTag("plaintext")
190
228
  if !ok {
@@ -203,7 +241,7 @@ func (cli *Client) handlePlaintextMessage(info *types.MessageInfo, node *waBinar
203
241
  cli.Log.Warnf("Error unmarshaling plaintext message from %s: %v", info.SourceString(), err)
204
242
  return
205
243
  }
206
- cli.storeMessageSecret(info, &msg)
244
+ cli.storeMessageSecret(ctx, info, &msg)
207
245
  evt := &events.Message{
208
246
  Info: *info,
209
247
  RawMessage: &msg,
@@ -215,16 +253,26 @@ func (cli *Client) handlePlaintextMessage(info *types.MessageInfo, node *waBinar
215
253
  OriginalTS: meta.AttrGetter().UnixTime("original_msg_t"),
216
254
  }
217
255
  }
218
- cli.dispatchEvent(evt.UnwrapRaw())
219
- return
256
+ return cli.dispatchEvent(evt.UnwrapRaw())
220
257
  }
221
258
 
222
- func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node) {
259
+ func (cli *Client) migrateSessionStore(ctx context.Context, pn, lid types.JID) {
260
+ err := cli.Store.Sessions.MigratePNToLID(ctx, pn, lid)
261
+ if err != nil {
262
+ cli.Log.Errorf("Failed to migrate signal store from %s to %s: %v", pn, lid, err)
263
+ }
264
+ }
265
+
266
+ func (cli *Client) decryptMessages(ctx context.Context, info *types.MessageInfo, node *waBinary.Node) (handlerFailed bool) {
223
267
  unavailableNode, ok := node.GetOptionalChildByTag("unavailable")
224
268
  if ok && len(node.GetChildrenByTag("enc")) == 0 {
225
269
  uType := events.UnavailableType(unavailableNode.AttrGetter().String("type"))
226
270
  cli.Log.Warnf("Unavailable message %s from %s (type: %q)", info.ID, info.SourceString(), uType)
227
- go cli.delayedRequestMessageFromPhone(info)
271
+ if cli.SynchronousAck {
272
+ cli.immediateRequestMessageFromPhone(ctx, info)
273
+ } else {
274
+ go cli.delayedRequestMessageFromPhone(info)
275
+ }
228
276
  cli.dispatchEvent(&events.UndecryptableMessage{Info: *info, IsUnavailable: true, UnavailableType: uType})
229
277
  return
230
278
  }
@@ -233,6 +281,21 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node)
233
281
  cli.Log.Debugf("Decrypting message from %s", info.SourceString())
234
282
  handled := false
235
283
  containsDirectMsg := false
284
+ senderEncryptionJID := info.Sender
285
+ if info.Sender.Server == types.DefaultUserServer && !info.Sender.IsBot() {
286
+ if info.SenderAlt.Server == types.HiddenUserServer {
287
+ senderEncryptionJID = info.SenderAlt
288
+ cli.migrateSessionStore(ctx, info.Sender, info.SenderAlt)
289
+ } else if lid, err := cli.Store.LIDs.GetLIDForPN(ctx, info.Sender); err != nil {
290
+ cli.Log.Errorf("Failed to get LID for %s: %v", info.Sender, err)
291
+ } else if !lid.IsEmpty() {
292
+ cli.migrateSessionStore(ctx, info.Sender, lid)
293
+ senderEncryptionJID = lid
294
+ info.SenderAlt = lid
295
+ } else {
296
+ cli.Log.Warnf("No LID found for %s", info.Sender)
297
+ }
298
+ }
236
299
  for _, child := range children {
237
300
  if child.Tag != "enc" {
238
301
  continue
@@ -243,61 +306,62 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node)
243
306
  continue
244
307
  }
245
308
  var decrypted []byte
309
+ var ciphertextHash *[32]byte
246
310
  var err error
247
311
  if encType == "pkmsg" || encType == "msg" {
248
- decrypted, err = cli.decryptDM(&child, info.Sender, encType == "pkmsg")
312
+ decrypted, ciphertextHash, err = cli.decryptDM(ctx, &child, senderEncryptionJID, encType == "pkmsg", info.Timestamp)
249
313
  containsDirectMsg = true
250
314
  } else if info.IsGroup && encType == "skmsg" {
251
- decrypted, err = cli.decryptGroupMsg(&child, info.Sender, info.Chat)
315
+ decrypted, ciphertextHash, err = cli.decryptGroupMsg(ctx, &child, senderEncryptionJID, info.Chat, info.Timestamp)
252
316
  } else if encType == "msmsg" && info.Sender.IsBot() {
253
- // Meta AI / other bots (biz?):
254
-
255
- // step 1: get message secret
256
317
  targetSenderJID := info.MsgMetaInfo.TargetSender
257
318
  if targetSenderJID.User == "" {
258
- // if no targetSenderJID in <meta> this must be ourselves (one-one-one mode)
259
- targetSenderJID = cli.getOwnID()
319
+ if info.Sender.Server == types.BotServer {
320
+ targetSenderJID = cli.getOwnLID()
321
+ } else {
322
+ targetSenderJID = cli.getOwnID()
323
+ }
260
324
  }
261
-
262
- messageSecret, err := cli.Store.MsgSecrets.GetMessageSecret(info.Chat, targetSenderJID, info.MsgMetaInfo.TargetID)
263
- if err != nil || messageSecret == nil {
264
- cli.Log.Warnf("Error getting message secret for bot msg with id %s", node.AttrGetter().String("id"))
265
- continue
325
+ var decryptMessageID string
326
+ if info.MsgBotInfo.EditType == types.EditTypeInner || info.MsgBotInfo.EditType == types.EditTypeLast {
327
+ decryptMessageID = info.MsgBotInfo.EditTargetID
328
+ } else {
329
+ decryptMessageID = info.ID
266
330
  }
267
-
268
- // step 2: get MessageSecretMessage
269
- byteContents := child.Content.([]byte) // <enc> contents
270
331
  var msMsg waE2E.MessageSecretMessage
271
-
272
- err = proto.Unmarshal(byteContents, &msMsg)
273
- if err != nil {
274
- cli.Log.Warnf("Error decoding MessageSecretMesage protobuf %v", err)
275
- continue
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
332
+ var messageSecret []byte
333
+ if messageSecret, _, err = cli.Store.MsgSecrets.GetMessageSecret(ctx, info.Chat, targetSenderJID, info.MsgMetaInfo.TargetID); err != nil {
334
+ err = fmt.Errorf("failed to get message secret for %s: %v", info.MsgMetaInfo.TargetID, err)
335
+ } else if messageSecret == nil {
336
+ err = fmt.Errorf("message secret for %s not found", info.MsgMetaInfo.TargetID)
337
+ } else if err = proto.Unmarshal(child.Content.([]byte), &msMsg); err != nil {
338
+ err = fmt.Errorf("failed to unmarshal MessageSecretMessage protobuf: %v", err)
282
339
  } else {
283
- messageID = info.ID
340
+ decrypted, err = cli.decryptBotMessage(ctx, messageSecret, &msMsg, decryptMessageID, targetSenderJID, info)
284
341
  }
285
-
286
- // step 4: decrypt and voila
287
- decrypted, err = cli.decryptBotMessage(messageSecret, &msMsg, messageID, targetSenderJID, info)
288
342
  } else {
289
343
  cli.Log.Warnf("Unhandled encrypted message (type %s) from %s", encType, info.SourceString())
290
344
  continue
291
345
  }
292
346
 
293
- if err != nil {
294
- cli.Log.Warnf("Error decrypting message from %s: %v", info.SourceString(), err)
347
+ if errors.Is(err, EventAlreadyProcessed) {
348
+ cli.Log.Debugf("Ignoring message %s from %s: %v", info.ID, info.SourceString(), err)
349
+ return
350
+ } else if err != nil {
351
+ cli.Log.Warnf("Error decrypting message %s from %s: %v", info.ID, info.SourceString(), err)
352
+ if ctx.Err() != nil || errors.Is(err, context.Canceled) {
353
+ handlerFailed = true
354
+ return
355
+ }
295
356
  isUnavailable := encType == "skmsg" && !containsDirectMsg && errors.Is(err, signalerror.ErrNoSenderKeyForUser)
296
- // TODO figure out why @bot messages fail to decrypt
297
- if info.Chat.Server != types.BotServer {
298
- go cli.sendRetryReceipt(node, info, isUnavailable)
357
+ if encType != "msmsg" {
358
+ if cli.SynchronousAck {
359
+ cli.sendRetryReceipt(ctx, node, info, isUnavailable)
360
+ } else {
361
+ go cli.sendRetryReceipt(context.WithoutCancel(ctx), node, info, isUnavailable)
362
+ }
299
363
  }
300
- cli.dispatchEvent(&events.UndecryptableMessage{
364
+ handlerFailed = cli.dispatchEvent(&events.UndecryptableMessage{
301
365
  Info: *info,
302
366
  IsUnavailable: isUnavailable,
303
367
  DecryptFailMode: events.DecryptFailMode(ag.OptionalString("decrypt-fail")),
@@ -315,85 +379,187 @@ func (cli *Client) decryptMessages(info *types.MessageInfo, node *waBinary.Node)
315
379
  cli.Log.Warnf("Error unmarshaling decrypted message from %s: %v", info.SourceString(), err)
316
380
  continue
317
381
  }
318
- cli.handleDecryptedMessage(info, &msg, retryCount)
382
+ handlerFailed = cli.handleDecryptedMessage(ctx, info, &msg, retryCount)
319
383
  handled = true
320
384
  case 3:
321
- handled = cli.handleDecryptedArmadillo(info, decrypted, retryCount)
385
+ handled, handlerFailed = cli.handleDecryptedArmadillo(ctx, info, decrypted, retryCount)
322
386
  default:
323
387
  cli.Log.Warnf("Unknown version %d in decrypted message from %s", ag.Int("v"), info.SourceString())
324
388
  }
389
+ if handlerFailed {
390
+ cli.Log.Warnf("Handler for %s failed", info.ID)
391
+ }
392
+ if ciphertextHash != nil && cli.EnableDecryptedEventBuffer && !handlerFailed {
393
+ // Use the context passed to decryptMessages
394
+ err = cli.Store.EventBuffer.ClearBufferedEventPlaintext(ctx, *ciphertextHash)
395
+ if err != nil {
396
+ zerolog.Ctx(ctx).Err(err).
397
+ Hex("ciphertext_hash", ciphertextHash[:]).
398
+ Msg("Failed to clear buffered event plaintext")
399
+ } else {
400
+ zerolog.Ctx(ctx).Debug().
401
+ Hex("ciphertext_hash", ciphertextHash[:]).
402
+ Msg("Deleted event plaintext from buffer")
403
+ }
404
+
405
+ if time.Since(cli.lastDecryptedBufferClear) > 12*time.Hour && ctx.Err() == nil {
406
+ cli.lastDecryptedBufferClear = time.Now()
407
+ go func() {
408
+ err := cli.Store.EventBuffer.DeleteOldBufferedHashes(context.WithoutCancel(ctx))
409
+ if err != nil {
410
+ zerolog.Ctx(ctx).Err(err).Msg("Failed to delete old buffered hashes")
411
+ }
412
+ }()
413
+ }
414
+ }
325
415
  }
326
- if handled {
416
+ if handled && !handlerFailed {
327
417
  go cli.sendMessageReceipt(info)
328
418
  }
419
+ return
329
420
  }
330
421
 
331
- func (cli *Client) clearUntrustedIdentity(target types.JID) {
332
- err := cli.Store.Identities.DeleteIdentity(target.SignalAddress().String())
422
+ func (cli *Client) clearUntrustedIdentity(ctx context.Context, target types.JID) error {
423
+ err := cli.Store.Identities.DeleteIdentity(ctx, target.SignalAddress().String())
333
424
  if err != nil {
334
- cli.Log.Warnf("Failed to delete untrusted identity of %s from store: %v", target, err)
425
+ return fmt.Errorf("failed to delete identity: %w", err)
335
426
  }
336
- err = cli.Store.Sessions.DeleteSession(target.SignalAddress().String())
427
+ err = cli.Store.Sessions.DeleteSession(ctx, target.SignalAddress().String())
337
428
  if err != nil {
338
- cli.Log.Warnf("Failed to delete session with %s (untrusted identity) from store: %v", target, err)
429
+ return fmt.Errorf("failed to delete session: %w", err)
430
+ }
431
+ go cli.dispatchEvent(&events.IdentityChange{JID: target, Timestamp: time.Now(), Implicit: true})
432
+ return nil
433
+ }
434
+
435
+ var EventAlreadyProcessed = errors.New("event was already processed")
436
+
437
+ func (cli *Client) bufferedDecrypt(
438
+ ctx context.Context,
439
+ ciphertext []byte,
440
+ serverTimestamp time.Time,
441
+ decrypt func(context.Context) ([]byte, error),
442
+ ) (plaintext []byte, ciphertextHash [32]byte, err error) {
443
+ if !cli.EnableDecryptedEventBuffer {
444
+ plaintext, err = decrypt(ctx)
445
+ return
446
+ }
447
+ ciphertextHash = sha256.Sum256(ciphertext)
448
+ var buf *store.BufferedEvent
449
+ buf, err = cli.Store.EventBuffer.GetBufferedEvent(ctx, ciphertextHash)
450
+ if err != nil {
451
+ err = fmt.Errorf("failed to get buffered event: %w", err)
452
+ return
453
+ } else if buf != nil {
454
+ if buf.Plaintext == nil {
455
+ zerolog.Ctx(ctx).Debug().
456
+ Hex("ciphertext_hash", ciphertextHash[:]).
457
+ Time("insertion_time", buf.InsertTime).
458
+ Msg("Returning event already processed error")
459
+ err = fmt.Errorf("%w at %s", EventAlreadyProcessed, buf.InsertTime.String())
460
+ return
461
+ }
462
+ zerolog.Ctx(ctx).Debug().
463
+ Hex("ciphertext_hash", ciphertextHash[:]).
464
+ Time("insertion_time", buf.InsertTime).
465
+ Msg("Returning previously decrypted plaintext")
466
+ plaintext = buf.Plaintext
467
+ return
468
+ }
469
+
470
+ err = cli.Store.EventBuffer.DoDecryptionTxn(ctx, func(ctx context.Context) (innerErr error) {
471
+ plaintext, innerErr = decrypt(ctx)
472
+ if innerErr != nil {
473
+ return
474
+ }
475
+ innerErr = cli.Store.EventBuffer.PutBufferedEvent(ctx, ciphertextHash, plaintext, serverTimestamp)
476
+ if innerErr != nil {
477
+ innerErr = fmt.Errorf("failed to save decrypted event to buffer: %w", innerErr)
478
+ }
479
+ return
480
+ })
481
+ if err == nil {
482
+ zerolog.Ctx(ctx).Debug().
483
+ Hex("ciphertext_hash", ciphertextHash[:]).
484
+ Msg("Successfully decrypted and saved event")
339
485
  }
340
- cli.dispatchEvent(&events.IdentityChange{JID: target, Timestamp: time.Now(), Implicit: true})
486
+ return
341
487
  }
342
488
 
343
- func (cli *Client) decryptDM(child *waBinary.Node, from types.JID, isPreKey bool) ([]byte, error) {
344
- content, _ := child.Content.([]byte)
489
+ func (cli *Client) decryptDM(ctx context.Context, child *waBinary.Node, from types.JID, isPreKey bool, serverTS time.Time) ([]byte, *[32]byte, error) {
490
+ content, ok := child.Content.([]byte)
491
+ if !ok {
492
+ return nil, nil, fmt.Errorf("message content is not a byte slice")
493
+ }
345
494
 
346
495
  builder := session.NewBuilderFromSignal(cli.Store, from.SignalAddress(), pbSerializer)
347
496
  cipher := session.NewCipher(builder, from.SignalAddress())
348
497
  var plaintext []byte
498
+ var ciphertextHash [32]byte
349
499
  if isPreKey {
350
500
  preKeyMsg, err := protocol.NewPreKeySignalMessageFromBytes(content, pbSerializer.PreKeySignalMessage, pbSerializer.SignalMessage)
351
501
  if err != nil {
352
- return nil, fmt.Errorf("failed to parse prekey message: %w", err)
353
- }
354
- plaintext, _, err = cipher.DecryptMessageReturnKey(preKeyMsg)
355
- if cli.AutoTrustIdentity && errors.Is(err, signalerror.ErrUntrustedIdentity) {
356
- cli.Log.Warnf("Got %v error while trying to decrypt prekey message from %s, clearing stored identity and retrying", err, from)
357
- cli.clearUntrustedIdentity(from)
358
- plaintext, _, err = cipher.DecryptMessageReturnKey(preKeyMsg)
359
- }
502
+ return nil, nil, fmt.Errorf("failed to parse prekey message: %w", err)
503
+ }
504
+ plaintext, ciphertextHash, err = cli.bufferedDecrypt(ctx, content, serverTS, func(decryptCtx context.Context) ([]byte, error) {
505
+ pt, innerErr := cipher.DecryptMessage(decryptCtx, preKeyMsg)
506
+ if cli.AutoTrustIdentity && errors.Is(innerErr, signalerror.ErrUntrustedIdentity) {
507
+ cli.Log.Warnf("Got %v error while trying to decrypt prekey message from %s, clearing stored identity and retrying", innerErr, from)
508
+ if innerErr = cli.clearUntrustedIdentity(decryptCtx, from); innerErr != nil {
509
+ innerErr = fmt.Errorf("failed to clear untrusted identity: %w", innerErr)
510
+ return nil, innerErr
511
+ }
512
+ pt, innerErr = cipher.DecryptMessage(decryptCtx, preKeyMsg)
513
+ }
514
+ return pt, innerErr
515
+ })
360
516
  if err != nil {
361
- return nil, fmt.Errorf("failed to decrypt prekey message: %w", err)
517
+ return nil, nil, fmt.Errorf("failed to decrypt prekey message: %w", err)
362
518
  }
363
519
  } else {
364
520
  msg, err := protocol.NewSignalMessageFromBytes(content, pbSerializer.SignalMessage)
365
521
  if err != nil {
366
- return nil, fmt.Errorf("failed to parse normal message: %w", err)
522
+ return nil, nil, fmt.Errorf("failed to parse normal message: %w", err)
367
523
  }
368
- plaintext, err = cipher.Decrypt(msg)
524
+ plaintext, ciphertextHash, err = cli.bufferedDecrypt(ctx, content, serverTS, func(decryptCtx context.Context) ([]byte, error) {
525
+ return cipher.Decrypt(decryptCtx, msg)
526
+ })
369
527
  if err != nil {
370
- return nil, fmt.Errorf("failed to decrypt normal message: %w", err)
528
+ return nil, nil, fmt.Errorf("failed to decrypt normal message: %w", err)
371
529
  }
372
530
  }
373
- if child.AttrGetter().Int("v") == 3 {
374
- return plaintext, nil
531
+ var err error
532
+ plaintext, err = unpadMessage(plaintext, child.AttrGetter().Int("v"))
533
+ if err != nil {
534
+ return nil, nil, fmt.Errorf("failed to unpad message: %w", err)
375
535
  }
376
- return unpadMessage(plaintext)
536
+ return plaintext, &ciphertextHash, nil
377
537
  }
378
538
 
379
- func (cli *Client) decryptGroupMsg(child *waBinary.Node, from types.JID, chat types.JID) ([]byte, error) {
380
- content, _ := child.Content.([]byte)
539
+ func (cli *Client) decryptGroupMsg(ctx context.Context, child *waBinary.Node, from types.JID, chat types.JID, serverTS time.Time) ([]byte, *[32]byte, error) {
540
+ content, ok := child.Content.([]byte)
541
+ if !ok {
542
+ return nil, nil, fmt.Errorf("message content is not a byte slice")
543
+ }
381
544
 
382
545
  senderKeyName := protocol.NewSenderKeyName(chat.String(), from.SignalAddress())
383
546
  builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer)
384
547
  cipher := groups.NewGroupCipher(builder, senderKeyName, cli.Store)
385
548
  msg, err := protocol.NewSenderKeyMessageFromBytes(content, pbSerializer.SenderKeyMessage)
386
549
  if err != nil {
387
- return nil, fmt.Errorf("failed to parse group message: %w", err)
550
+ return nil, nil, fmt.Errorf("failed to parse group message: %w", err)
388
551
  }
389
- plaintext, err := cipher.Decrypt(msg)
552
+ plaintext, ciphertextHash, err := cli.bufferedDecrypt(ctx, content, serverTS, func(decryptCtx context.Context) ([]byte, error) {
553
+ return cipher.Decrypt(decryptCtx, msg)
554
+ })
390
555
  if err != nil {
391
- return nil, fmt.Errorf("failed to decrypt group message: %w", err)
556
+ return nil, nil, fmt.Errorf("failed to decrypt group message: %w", err)
392
557
  }
393
- if child.AttrGetter().Int("v") == 3 {
394
- return plaintext, nil
558
+ plaintext, err = unpadMessage(plaintext, child.AttrGetter().Int("v"))
559
+ if err != nil {
560
+ return nil, nil, err
395
561
  }
396
- return unpadMessage(plaintext)
562
+ return plaintext, &ciphertextHash, nil
397
563
  }
398
564
 
399
565
  const checkPadding = true
@@ -404,14 +570,16 @@ func isValidPadding(plaintext []byte) bool {
404
570
  return bytes.HasSuffix(plaintext, expectedPadding)
405
571
  }
406
572
 
407
- func unpadMessage(plaintext []byte) ([]byte, error) {
408
- if len(plaintext) == 0 {
573
+ func unpadMessage(plaintext []byte, version int) ([]byte, error) {
574
+ if version == 3 {
575
+ return plaintext, nil
576
+ } else if len(plaintext) == 0 {
409
577
  return nil, fmt.Errorf("plaintext is empty")
410
- }
411
- if checkPadding && !isValidPadding(plaintext) {
578
+ } else if checkPadding && !isValidPadding(plaintext) {
412
579
  return nil, fmt.Errorf("plaintext doesn't have expected padding")
580
+ } else {
581
+ return plaintext[:len(plaintext)-int(plaintext[len(plaintext)-1])], nil
413
582
  }
414
- return plaintext[:len(plaintext)-int(plaintext[len(plaintext)-1])], nil
415
583
  }
416
584
 
417
585
  func padMessage(plaintext []byte) []byte {
@@ -424,7 +592,7 @@ func padMessage(plaintext []byte) []byte {
424
592
  return plaintext
425
593
  }
426
594
 
427
- func (cli *Client) handleSenderKeyDistributionMessage(chat, from types.JID, axolotlSKDM []byte) {
595
+ func (cli *Client) handleSenderKeyDistributionMessage(ctx context.Context, chat, from types.JID, axolotlSKDM []byte) {
428
596
  builder := groups.NewGroupSessionBuilder(cli.Store, pbSerializer)
429
597
  senderKeyName := protocol.NewSenderKeyName(chat.String(), from.SignalAddress())
430
598
  sdkMsg, err := protocol.NewSenderKeyDistributionMessageFromBytes(axolotlSKDM, pbSerializer.SenderKeyDistributionMessage)
@@ -432,7 +600,11 @@ func (cli *Client) handleSenderKeyDistributionMessage(chat, from types.JID, axol
432
600
  cli.Log.Errorf("Failed to parse sender key distribution message from %s for %s: %v", from, chat, err)
433
601
  return
434
602
  }
435
- builder.Process(senderKeyName, sdkMsg)
603
+ err = builder.Process(ctx, senderKeyName, sdkMsg)
604
+ if err != nil {
605
+ cli.Log.Errorf("Failed to process sender key distribution message from %s for %s: %v", from, chat, err)
606
+ return
607
+ }
436
608
  cli.Log.Debugf("Processed sender key distribution message from %s in %s", senderKeyName.Sender().String(), senderKeyName.GroupID())
437
609
  }
438
610
 
@@ -451,35 +623,56 @@ func (cli *Client) handleHistorySyncNotificationLoop() {
451
623
  go cli.handleHistorySyncNotificationLoop()
452
624
  }
453
625
  }()
626
+ ctx := cli.BackgroundEventCtx
454
627
  for notif := range cli.historySyncNotifications {
455
- cli.handleHistorySyncNotification(notif)
628
+ blob, err := cli.DownloadHistorySync(ctx, notif, false)
629
+ if err != nil {
630
+ cli.Log.Errorf("Failed to download history sync: %v", err)
631
+ } else {
632
+ cli.dispatchEvent(&events.HistorySync{Data: blob})
633
+ }
456
634
  }
457
635
  }
458
636
 
459
- func (cli *Client) handleHistorySyncNotification(notif *waE2E.HistorySyncNotification) {
637
+ // DownloadHistorySync will download and parse the history sync blob from the given history sync notification.
638
+ //
639
+ // You only need to call this manually if you set [Client.ManualHistorySyncDownload] to true.
640
+ // By default, whatsmeow will call this automatically and dispatch an [events.HistorySync] with the parsed data.
641
+ func (cli *Client) DownloadHistorySync(ctx context.Context, notif *waE2E.HistorySyncNotification, synchronousStorage bool) (*waHistorySync.HistorySync, error) {
460
642
  var historySync waHistorySync.HistorySync
461
- if data, err := cli.Download(notif); err != nil {
462
- cli.Log.Errorf("Failed to download history sync data: %v", err)
643
+ if data, err := cli.Download(ctx, notif); err != nil {
644
+ return nil, fmt.Errorf("failed to download: %w", err)
463
645
  } else if reader, err := zlib.NewReader(bytes.NewReader(data)); err != nil {
464
- cli.Log.Errorf("Failed to create zlib reader for history sync data: %v", err)
646
+ return nil, fmt.Errorf("failed to prepare to decompress: %w", err)
465
647
  } else if rawData, err := io.ReadAll(reader); err != nil {
466
- cli.Log.Errorf("Failed to decompress history sync data: %v", err)
648
+ return nil, fmt.Errorf("failed to decompress: %w", err)
467
649
  } else if err = proto.Unmarshal(rawData, &historySync); err != nil {
468
- cli.Log.Errorf("Failed to unmarshal history sync data: %v", err)
650
+ return nil, fmt.Errorf("failed to unmarshal: %w", err)
469
651
  } else {
470
- cli.Log.Debugf("Received history sync (type %s, chunk %d)", historySync.GetSyncType(), historySync.GetChunkOrder())
471
- if historySync.GetSyncType() == waHistorySync.HistorySync_PUSH_NAME {
472
- go cli.handleHistoricalPushNames(historySync.GetPushnames())
473
- } else if len(historySync.GetConversations()) > 0 {
474
- go cli.storeHistoricalMessageSecrets(historySync.GetConversations())
475
- }
476
- cli.dispatchEvent(&events.HistorySync{
477
- Data: &historySync,
478
- })
652
+ cli.Log.Debugf("Received history sync (type %s, chunk %d, progress %d)", historySync.GetSyncType(), historySync.GetChunkOrder(), historySync.GetProgress())
653
+ doStorage := func(ctx context.Context) {
654
+ if historySync.GetSyncType() == waHistorySync.HistorySync_PUSH_NAME {
655
+ cli.handleHistoricalPushNames(ctx, historySync.GetPushnames())
656
+ } else if len(historySync.GetConversations()) > 0 {
657
+ cli.storeHistoricalMessageSecrets(ctx, historySync.GetConversations())
658
+ }
659
+ if len(historySync.GetPhoneNumberToLidMappings()) > 0 {
660
+ cli.storeHistoricalPNLIDMappings(ctx, historySync.GetPhoneNumberToLidMappings())
661
+ }
662
+ if historySync.GlobalSettings != nil {
663
+ cli.storeGlobalSettings(ctx, historySync.GlobalSettings)
664
+ }
665
+ }
666
+ if synchronousStorage {
667
+ doStorage(ctx)
668
+ } else {
669
+ go doStorage(context.WithoutCancel(ctx))
670
+ }
671
+ return &historySync, nil
479
672
  }
480
673
  }
481
674
 
482
- func (cli *Client) handleAppStateSyncKeyShare(keys *waE2E.AppStateSyncKeyShare) {
675
+ func (cli *Client) handleAppStateSyncKeyShare(ctx context.Context, keys *waE2E.AppStateSyncKeyShare) {
483
676
  onlyResyncIfNotSynced := true
484
677
 
485
678
  cli.Log.Debugf("Got %d new app state keys", len(keys.GetKeys()))
@@ -494,7 +687,7 @@ func (cli *Client) handleAppStateSyncKeyShare(keys *waE2E.AppStateSyncKeyShare)
494
687
  if isReRequest {
495
688
  onlyResyncIfNotSynced = false
496
689
  }
497
- err = cli.Store.AppStateKeys.PutAppStateSyncKey(key.GetKeyID().GetKeyID(), store.AppStateSyncKey{
690
+ err = cli.Store.AppStateKeys.PutAppStateSyncKey(ctx, key.GetKeyID().GetKeyID(), store.AppStateSyncKey{
498
691
  Data: key.GetKeyData().GetKeyData(),
499
692
  Fingerprint: marshaledFingerprint,
500
693
  Timestamp: key.GetKeyData().GetTimestamp(),
@@ -508,17 +701,18 @@ func (cli *Client) handleAppStateSyncKeyShare(keys *waE2E.AppStateSyncKeyShare)
508
701
  cli.appStateKeyRequestsLock.RUnlock()
509
702
 
510
703
  for _, name := range appstate.AllPatchNames {
511
- err := cli.FetchAppState(name, false, onlyResyncIfNotSynced)
704
+ err := cli.FetchAppState(ctx, name, false, onlyResyncIfNotSynced)
512
705
  if err != nil {
513
706
  cli.Log.Errorf("Failed to do initial fetch of app state %s: %v", name, err)
514
707
  }
515
708
  }
516
709
  }
517
710
 
518
- func (cli *Client) handlePlaceholderResendResponse(msg *waE2E.PeerDataOperationRequestResponseMessage) {
711
+ func (cli *Client) handlePlaceholderResendResponse(msg *waE2E.PeerDataOperationRequestResponseMessage) (ok bool) {
519
712
  reqID := msg.GetStanzaID()
520
713
  parts := msg.GetPeerDataOperationResult()
521
714
  cli.Log.Debugf("Handling response to placeholder resend request %s with %d items", reqID, len(parts))
715
+ ok = true
522
716
  for i, part := range parts {
523
717
  var webMsg waWeb.WebMessageInfo
524
718
  if resp := part.GetPlaceholderMessageResendResponse(); resp == nil {
@@ -529,36 +723,51 @@ func (cli *Client) handlePlaceholderResendResponse(msg *waE2E.PeerDataOperationR
529
723
  cli.Log.Warnf("Failed to parse web message info in item #%d of response to %s: %v", i+1, reqID, err)
530
724
  } else {
531
725
  msgEvt.UnavailableRequestID = reqID
532
- cli.dispatchEvent(msgEvt)
726
+ ok = cli.dispatchEvent(msgEvt) && ok
533
727
  }
534
728
  }
729
+ return
535
730
  }
536
731
 
537
- func (cli *Client) handleProtocolMessage(info *types.MessageInfo, msg *waE2E.Message) {
732
+ func (cli *Client) handleProtocolMessage(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) (ok bool) {
733
+ ok = true
538
734
  protoMsg := msg.GetProtocolMessage()
539
735
 
540
- if protoMsg.GetHistorySyncNotification() != nil && info.IsFromMe {
541
- cli.historySyncNotifications <- protoMsg.HistorySyncNotification
542
- if cli.historySyncHandlerStarted.CompareAndSwap(false, true) {
543
- go cli.handleHistorySyncNotificationLoop()
736
+ if !info.IsFromMe {
737
+ return
738
+ }
739
+
740
+ if protoMsg.GetHistorySyncNotification() != nil {
741
+ if !cli.ManualHistorySyncDownload {
742
+ cli.historySyncNotifications <- protoMsg.HistorySyncNotification
743
+ if cli.historySyncHandlerStarted.CompareAndSwap(false, true) {
744
+ go cli.handleHistorySyncNotificationLoop()
745
+ }
544
746
  }
545
747
  go cli.sendProtocolMessageReceipt(info.ID, types.ReceiptTypeHistorySync)
546
748
  }
547
749
 
750
+ if protoMsg.GetLidMigrationMappingSyncMessage() != nil {
751
+ cli.storeLIDSyncMessage(ctx, protoMsg.GetLidMigrationMappingSyncMessage().GetEncodedMappingPayload())
752
+ }
753
+
548
754
  if protoMsg.GetPeerDataOperationRequestResponseMessage().GetPeerDataOperationRequestType() == waE2E.PeerDataOperationRequestType_PLACEHOLDER_MESSAGE_RESEND {
549
- go cli.handlePlaceholderResendResponse(protoMsg.GetPeerDataOperationRequestResponseMessage())
755
+ ok = cli.handlePlaceholderResendResponse(protoMsg.GetPeerDataOperationRequestResponseMessage()) && ok
550
756
  }
551
757
 
552
- if protoMsg.GetAppStateSyncKeyShare() != nil && info.IsFromMe {
553
- go cli.handleAppStateSyncKeyShare(protoMsg.AppStateSyncKeyShare)
758
+ if protoMsg.GetAppStateSyncKeyShare() != nil {
759
+ go cli.handleAppStateSyncKeyShare(context.WithoutCancel(ctx), protoMsg.AppStateSyncKeyShare)
554
760
  }
555
761
 
556
762
  if info.Category == "peer" {
557
763
  go cli.sendProtocolMessageReceipt(info.ID, types.ReceiptTypePeerMsg)
558
764
  }
765
+ return
559
766
  }
560
767
 
561
- func (cli *Client) processProtocolParts(info *types.MessageInfo, msg *waE2E.Message) {
768
+ func (cli *Client) processProtocolParts(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) (ok bool) {
769
+ ok = true
770
+ cli.storeMessageSecret(ctx, info, msg)
562
771
  // Hopefully sender key distribution messages and protocol messages can't be inside ephemeral messages
563
772
  if msg.GetDeviceSentMessage().GetMessage() != nil {
564
773
  msg = msg.GetDeviceSentMessage().GetMessage()
@@ -567,20 +776,24 @@ func (cli *Client) processProtocolParts(info *types.MessageInfo, msg *waE2E.Mess
567
776
  if !info.IsGroup {
568
777
  cli.Log.Warnf("Got sender key distribution message in non-group chat from %s", info.Sender)
569
778
  } else {
570
- cli.handleSenderKeyDistributionMessage(info.Chat, info.Sender, msg.SenderKeyDistributionMessage.AxolotlSenderKeyDistributionMessage)
779
+ encryptionIdentity := info.Sender
780
+ if encryptionIdentity.Server == types.DefaultUserServer && info.SenderAlt.Server == types.HiddenUserServer {
781
+ encryptionIdentity = info.SenderAlt
782
+ }
783
+ cli.handleSenderKeyDistributionMessage(ctx, info.Chat, encryptionIdentity, msg.SenderKeyDistributionMessage.AxolotlSenderKeyDistributionMessage)
571
784
  }
572
785
  }
573
786
  // N.B. Edits are protocol messages, but they're also wrapped inside EditedMessage,
574
787
  // which is only unwrapped after processProtocolParts, so this won't trigger for edits.
575
788
  if msg.GetProtocolMessage() != nil {
576
- cli.handleProtocolMessage(info, msg)
789
+ ok = cli.handleProtocolMessage(ctx, info, msg) && ok
577
790
  }
578
- cli.storeMessageSecret(info, msg)
791
+ return
579
792
  }
580
793
 
581
- func (cli *Client) storeMessageSecret(info *types.MessageInfo, msg *waE2E.Message) {
794
+ func (cli *Client) storeMessageSecret(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message) {
582
795
  if msgSecret := msg.GetMessageContextInfo().GetMessageSecret(); len(msgSecret) > 0 {
583
- err := cli.Store.MsgSecrets.PutMessageSecret(info.Chat, info.Sender, info.ID, msgSecret)
796
+ err := cli.Store.MsgSecrets.PutMessageSecret(ctx, info.Chat, info.Sender, info.ID, msgSecret)
584
797
  if err != nil {
585
798
  cli.Log.Errorf("Failed to store message secret key for %s: %v", info.ID, err)
586
799
  } else {
@@ -589,7 +802,7 @@ func (cli *Client) storeMessageSecret(info *types.MessageInfo, msg *waE2E.Messag
589
802
  }
590
803
  }
591
804
 
592
- func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.Conversation) {
805
+ func (cli *Client) storeHistoricalMessageSecrets(ctx context.Context, conversations []*waHistorySync.Conversation) {
593
806
  var secrets []store.MessageSecretInsert
594
807
  var privacyTokens []store.PrivacyToken
595
808
  ownID := cli.getOwnID().ToNonAD()
@@ -639,7 +852,7 @@ func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.
639
852
  }
640
853
  if len(secrets) > 0 {
641
854
  cli.Log.Debugf("Storing %d message secret keys in history sync", len(secrets))
642
- err := cli.Store.MsgSecrets.PutMessageSecrets(secrets)
855
+ err := cli.Store.MsgSecrets.PutMessageSecrets(ctx, secrets)
643
856
  if err != nil {
644
857
  cli.Log.Errorf("Failed to store message secret keys in history sync: %v", err)
645
858
  } else {
@@ -648,7 +861,7 @@ func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.
648
861
  }
649
862
  if len(privacyTokens) > 0 {
650
863
  cli.Log.Debugf("Storing %d privacy tokens in history sync", len(privacyTokens))
651
- err := cli.Store.PrivacyTokens.PutPrivacyTokens(privacyTokens...)
864
+ err := cli.Store.PrivacyTokens.PutPrivacyTokens(ctx, privacyTokens...)
652
865
  if err != nil {
653
866
  cli.Log.Errorf("Failed to store privacy tokens in history sync: %v", err)
654
867
  } else {
@@ -657,10 +870,107 @@ func (cli *Client) storeHistoricalMessageSecrets(conversations []*waHistorySync.
657
870
  }
658
871
  }
659
872
 
660
- func (cli *Client) handleDecryptedMessage(info *types.MessageInfo, msg *waE2E.Message, retryCount int) {
661
- cli.processProtocolParts(info, msg)
873
+ func (cli *Client) storeLIDSyncMessage(ctx context.Context, msg []byte) {
874
+ var decoded waLidMigrationSyncPayload.LIDMigrationMappingSyncPayload
875
+ err := proto.Unmarshal(msg, &decoded)
876
+ if err != nil {
877
+ zerolog.Ctx(ctx).Err(err).Msg("Failed to unmarshal LID migration mapping sync payload")
878
+ return
879
+ }
880
+ if cli.Store.LIDMigrationTimestamp == 0 && decoded.GetChatDbMigrationTimestamp() > 0 {
881
+ cli.Store.LIDMigrationTimestamp = int64(decoded.GetChatDbMigrationTimestamp())
882
+ err = cli.Store.Save(ctx)
883
+ if err != nil {
884
+ zerolog.Ctx(ctx).Err(err).
885
+ Int64("lid_migration_timestamp", cli.Store.LIDMigrationTimestamp).
886
+ Msg("Failed to save chat DB LID migration timestamp")
887
+ } else {
888
+ zerolog.Ctx(ctx).Debug().
889
+ Int64("lid_migration_timestamp", cli.Store.LIDMigrationTimestamp).
890
+ Msg("Saved chat DB LID migration timestamp")
891
+ }
892
+ }
893
+ lidPairs := make([]store.LIDMapping, len(decoded.PnToLidMappings))
894
+ for i, mapping := range decoded.PnToLidMappings {
895
+ lidPairs[i] = store.LIDMapping{
896
+ LID: types.JID{User: strconv.FormatUint(mapping.GetAssignedLid(), 10), Server: types.HiddenUserServer},
897
+ PN: types.JID{User: strconv.FormatUint(mapping.GetPn(), 10), Server: types.DefaultUserServer},
898
+ }
899
+ }
900
+ err = cli.Store.LIDs.PutManyLIDMappings(ctx, lidPairs)
901
+ if err != nil {
902
+ zerolog.Ctx(ctx).Err(err).
903
+ Int("pair_count", len(lidPairs)).
904
+ Msg("Failed to store phone number to LID mappings from sync message")
905
+ } else {
906
+ zerolog.Ctx(ctx).Debug().
907
+ Int("pair_count", len(lidPairs)).
908
+ Msg("Stored PN-LID mappings from sync message")
909
+ }
910
+ }
911
+
912
+ func (cli *Client) storeGlobalSettings(ctx context.Context, settings *waHistorySync.GlobalSettings) {
913
+ if cli.Store.LIDMigrationTimestamp == 0 && settings.GetChatDbLidMigrationTimestamp() > 0 {
914
+ cli.Store.LIDMigrationTimestamp = settings.GetChatDbLidMigrationTimestamp()
915
+ err := cli.Store.Save(ctx)
916
+ if err != nil {
917
+ zerolog.Ctx(ctx).Err(err).
918
+ Int64("lid_migration_timestamp", cli.Store.LIDMigrationTimestamp).
919
+ Msg("Failed to save chat DB LID migration timestamp")
920
+ } else {
921
+ zerolog.Ctx(ctx).Debug().
922
+ Int64("lid_migration_timestamp", cli.Store.LIDMigrationTimestamp).
923
+ Msg("Saved chat DB LID migration timestamp")
924
+ }
925
+ }
926
+ }
927
+
928
+ func (cli *Client) storeHistoricalPNLIDMappings(ctx context.Context, mappings []*waHistorySync.PhoneNumberToLIDMapping) {
929
+ lidPairs := make([]store.LIDMapping, 0, len(mappings))
930
+ for _, mapping := range mappings {
931
+ pn, err := types.ParseJID(mapping.GetPnJID())
932
+ if err != nil {
933
+ zerolog.Ctx(ctx).Err(err).
934
+ Str("pn_jid", mapping.GetPnJID()).
935
+ Str("lid_jid", mapping.GetLidJID()).
936
+ Msg("Failed to parse phone number from history sync")
937
+ continue
938
+ }
939
+ if pn.Server == types.LegacyUserServer {
940
+ pn.Server = types.DefaultUserServer
941
+ }
942
+ lid, err := types.ParseJID(mapping.GetLidJID())
943
+ if err != nil {
944
+ zerolog.Ctx(ctx).Err(err).
945
+ Str("pn_jid", mapping.GetPnJID()).
946
+ Str("lid_jid", mapping.GetLidJID()).
947
+ Msg("Failed to parse LID from history sync")
948
+ continue
949
+ }
950
+ lidPairs = append(lidPairs, store.LIDMapping{
951
+ LID: lid,
952
+ PN: pn,
953
+ })
954
+ }
955
+ err := cli.Store.LIDs.PutManyLIDMappings(ctx, lidPairs)
956
+ if err != nil {
957
+ zerolog.Ctx(ctx).Err(err).
958
+ Int("pair_count", len(lidPairs)).
959
+ Msg("Failed to store phone number to LID mappings from history sync")
960
+ } else {
961
+ zerolog.Ctx(ctx).Debug().
962
+ Int("pair_count", len(lidPairs)).
963
+ Msg("Stored PN-LID mappings from history sync")
964
+ }
965
+ }
966
+
967
+ func (cli *Client) handleDecryptedMessage(ctx context.Context, info *types.MessageInfo, msg *waE2E.Message, retryCount int) bool {
968
+ ok := cli.processProtocolParts(ctx, info, msg)
969
+ if !ok {
970
+ return false
971
+ }
662
972
  evt := &events.Message{Info: *info, RawMessage: msg, RetryCount: retryCount}
663
- cli.dispatchEvent(evt.UnwrapRaw())
973
+ return cli.dispatchEvent(evt.UnwrapRaw())
664
974
  }
665
975
 
666
976
  func (cli *Client) sendProtocolMessageReceipt(id types.MessageID, msgType types.ReceiptType) {