mirror of
https://github.com/mautrix/signal.git
synced 2026-07-06 14:23:17 -04:00
Compare commits
57 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e7a2287ee | ||
|
|
8c4d5e1e7c | ||
|
|
facfe86a50 | ||
|
|
8217fb9e42 | ||
|
|
316e7b311d | ||
|
|
605693e294 | ||
|
|
2a8769e32a | ||
|
|
fe3a952c2f | ||
|
|
d54de94b9a | ||
|
|
04fc9acaf4 | ||
|
|
69aca6365f | ||
|
|
2252280617 | ||
|
|
dea24acc95 | ||
|
|
0c852df4cb | ||
|
|
0df937749b | ||
|
|
14592ffdcc | ||
|
|
41a37cd184 |
||
|
|
4545def017 | ||
|
|
9cdd4c9963 | ||
|
|
4f1ebf7aa2 | ||
|
|
06bdbfc2ca | ||
|
|
90487a25e0 | ||
|
|
0813d39095 | ||
|
|
0214ecc600 | ||
|
|
694858478c | ||
|
|
9ebd8d4dd0 | ||
|
|
1f1b645213 | ||
|
|
14559977fc | ||
|
|
a27b6745b2 | ||
|
|
9e9dc8b548 | ||
|
|
c2afb9f113 | ||
|
|
6beb2faa9f | ||
|
|
2b2a3b036f | ||
|
|
d4b2659f96 | ||
|
|
1f45d1af1a | ||
|
|
fd61f51ed9 | ||
|
|
e0901b648f | ||
|
|
2297e6b48b | ||
|
|
38f2ba9430 | ||
|
|
952e7c473b | ||
|
|
fdb9a61601 |
||
|
|
1c531e03da | ||
|
|
aad72ca39b | ||
|
|
53a3faa969 | ||
|
|
c2f0a1bbf7 | ||
|
|
59eaa36415 | ||
|
|
9d34e0d7fa | ||
|
|
e5a4f55e83 | ||
|
|
9257116792 | ||
|
|
426b1f8266 | ||
|
|
e9da747f37 | ||
|
|
40f320061c | ||
|
|
73a8a77e88 | ||
|
|
f49b11c4cb | ||
|
|
69f9b48e35 | ||
|
|
4842b35ab4 | ||
|
|
09bb6d7160 |
75 changed files with 4339 additions and 2435 deletions
14
.github/ISSUE_TEMPLATE/bug.md
vendored
14
.github/ISSUE_TEMPLATE/bug.md
vendored
|
|
@ -7,10 +7,12 @@ type: Bug
|
|||
|
||||
---
|
||||
|
||||
<!--
|
||||
Remember to include relevant logs, the bridge version and any other details.
|
||||
<!-- Include relevant logs, the bridge version and other important details here -->
|
||||
|
||||
It's always best to ask in the Matrix room first, especially if you aren't sure
|
||||
what details are needed. Issues with insufficient detail will likely just be
|
||||
ignored or closed immediately.
|
||||
-->
|
||||
### Checklist
|
||||
|
||||
<!-- All items below are mandatory. Issues not following the rules may be closed without comment. -->
|
||||
|
||||
* [ ] This is an actual bug, not just a setup issue (see the [troubleshooting docs](https://docs.mau.fi/bridges/general/troubleshooting.html) or ask in the Matrix room for setup help).
|
||||
* [ ] I am certain that sufficient information is included. Ask in the Matrix room first if not.
|
||||
* [ ] The bug is still present on the main branch. The `!signal version` command output is: ``
|
||||
|
|
|
|||
20
CHANGELOG.md
20
CHANGELOG.md
|
|
@ -1,3 +1,23 @@
|
|||
# v26.06
|
||||
|
||||
* Updated libsignal to v0.94.4
|
||||
* Updated mrenclave to fix looking up phone numbers.
|
||||
* Changed knock accept handling to auto-join the ghost user afterwards.
|
||||
|
||||
# v26.05
|
||||
|
||||
* Updated libsignal to v0.93.2.
|
||||
* Added support for importing sticker packs from Signal.
|
||||
|
||||
# v26.04
|
||||
|
||||
* Updated libsignal to v0.92.1.
|
||||
* Added support for admin message deletes from Signal.
|
||||
* Added support for binary service IDs in storage service.
|
||||
* Fixed `private_chat_portal_meta` option not setting DM room names correctly.
|
||||
* Fixed panic if user is logged out during initial chat sync.
|
||||
* Fixed avatar upload failing when creating new Signal group.
|
||||
|
||||
# v26.03
|
||||
|
||||
* Switched to sending binary service ID fields in outgoing messages.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# -- Build libsignal (with Rust) --
|
||||
FROM rust:1-alpine AS rust-builder
|
||||
RUN apk add --no-cache git make cmake protoc musl-dev g++ clang-dev
|
||||
RUN apk add --no-cache git make cmake protoc musl-dev g++ clang-dev protobuf-dev
|
||||
|
||||
WORKDIR /build
|
||||
# Copy all files needed for Rust build, and no Go files
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ var m = mxmain.BridgeMain{
|
|||
Name: "mautrix-signal",
|
||||
URL: "https://github.com/mautrix/signal",
|
||||
Description: "A Matrix-Signal puppeting bridge.",
|
||||
Version: "26.03",
|
||||
Version: "26.06",
|
||||
SemCalVer: true,
|
||||
|
||||
Connector: &connector.SignalConnector{},
|
||||
|
|
|
|||
36
go.mod
36
go.mod
|
|
@ -2,37 +2,38 @@ module go.mau.fi/mautrix-signal
|
|||
|
||||
go 1.25.0
|
||||
|
||||
toolchain go1.26.1
|
||||
toolchain go1.26.4
|
||||
|
||||
tool go.mau.fi/util/cmd/maubuild
|
||||
|
||||
require (
|
||||
github.com/coder/websocket v1.8.14
|
||||
github.com/coder/websocket v1.8.15
|
||||
github.com/emersion/go-vcard v0.0.0-20241024213814-c9703dde27ff
|
||||
github.com/google/uuid v1.6.0
|
||||
github.com/mattn/go-pointer v0.0.1
|
||||
github.com/rs/zerolog v1.34.0
|
||||
github.com/rs/zerolog v1.35.1
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/tidwall/gjson v1.18.0
|
||||
go.mau.fi/util v0.9.7
|
||||
golang.org/x/crypto v0.49.0
|
||||
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90
|
||||
golang.org/x/net v0.52.0
|
||||
github.com/tidwall/gjson v1.19.0
|
||||
go.mau.fi/util v0.9.10
|
||||
golang.org/x/crypto v0.53.0
|
||||
golang.org/x/exp v0.0.0-20260611194520-c48552f49976
|
||||
golang.org/x/net v0.56.0
|
||||
golang.org/x/sync v0.21.0
|
||||
google.golang.org/protobuf v1.36.11
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
maunium.net/go/mautrix v0.26.4
|
||||
maunium.net/go/mautrix v0.28.1
|
||||
)
|
||||
|
||||
require (
|
||||
filippo.io/edwards25519 v1.2.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.6.0 // indirect
|
||||
github.com/coreos/go-systemd/v22 v22.7.0 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/lib/pq v1.11.2 // indirect
|
||||
github.com/lib/pq v1.12.3 // indirect
|
||||
github.com/mattn/go-colorable v0.1.14 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.34 // indirect
|
||||
github.com/petermattis/goid v0.0.0-20260226131333-17d1149c6ac6 // indirect
|
||||
github.com/mattn/go-sqlite3 v1.14.45 // indirect
|
||||
github.com/petermattis/goid v0.0.0-20260330135022-df67b199bc81 // indirect
|
||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||
github.com/rogpeppe/go-internal v1.10.0 // indirect
|
||||
github.com/rs/xid v1.6.0 // indirect
|
||||
|
|
@ -40,12 +41,11 @@ require (
|
|||
github.com/tidwall/match v1.2.0 // indirect
|
||||
github.com/tidwall/pretty v1.2.1 // indirect
|
||||
github.com/tidwall/sjson v1.2.5 // indirect
|
||||
github.com/yuin/goldmark v1.7.16 // indirect
|
||||
github.com/yuin/goldmark v1.8.2 // indirect
|
||||
go.mau.fi/zeroconfig v0.2.0 // indirect
|
||||
golang.org/x/mod v0.34.0 // indirect
|
||||
golang.org/x/sync v0.20.0 // indirect
|
||||
golang.org/x/sys v0.42.0 // indirect
|
||||
golang.org/x/text v0.35.0 // indirect
|
||||
golang.org/x/mod v0.37.0 // indirect
|
||||
golang.org/x/sys v0.46.0 // indirect
|
||||
golang.org/x/text v0.38.0 // indirect
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
|
||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||
maunium.net/go/mauflag v1.0.0 // indirect
|
||||
|
|
|
|||
76
go.sum
76
go.sum
|
|
@ -2,17 +2,15 @@ filippo.io/edwards25519 v1.2.0 h1:crnVqOiS4jqYleHd9vaKZ+HKtHfllngJIiOpNpoJsjo=
|
|||
filippo.io/edwards25519 v1.2.0/go.mod h1:xzAOLCNug/yB62zG1bQ8uziwrIqIuxhctzJT18Q77mc=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2 h1:OcvFkGmslmlZibjAjaHm3L//6LiuBgolP7OputlJIzU=
|
||||
github.com/DATA-DOG/go-sqlmock v1.5.2/go.mod h1:88MAG/4G7SMwSE3CeA0ZKzrT5CiOU3OJ+JlNzwDqpNU=
|
||||
github.com/coder/websocket v1.8.14 h1:9L0p0iKiNOibykf283eHkKUHHrpG7f65OE3BhhO7v9g=
|
||||
github.com/coder/websocket v1.8.14/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
|
||||
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
|
||||
github.com/coreos/go-systemd/v22 v22.6.0 h1:aGVa/v8B7hpb0TKl0MWoAavPDmHvobFe5R5zn0bCJWo=
|
||||
github.com/coreos/go-systemd/v22 v22.6.0/go.mod h1:iG+pp635Fo7ZmV/j14KUcmEyWF+0X7Lua8rrTWzYgWU=
|
||||
github.com/coder/websocket v1.8.15 h1:6B2JPeOGlpff2Uz6vOEH1Vzpi0iUz20A+lPVhPHtNUA=
|
||||
github.com/coder/websocket v1.8.15/go.mod h1:NX3SzP+inril6yawo5CQXx8+fk145lPDC6pumgx0mVg=
|
||||
github.com/coreos/go-systemd/v22 v22.7.0 h1:LAEzFkke61DFROc7zNLX/WA2i5J8gYqe0rSj9KI28KA=
|
||||
github.com/coreos/go-systemd/v22 v22.7.0/go.mod h1:xNUYtjHu2EDXbsxz1i41wouACIwT7Ybq9o0BQhMwD0w=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emersion/go-vcard v0.0.0-20241024213814-c9703dde27ff h1:4N8wnS3f1hNHSmFD5zgFkWCyA4L1kCDkImPAtK7D6tg=
|
||||
github.com/emersion/go-vcard v0.0.0-20241024213814-c9703dde27ff/go.mod h1:HMJKR5wlh/ziNp+sHEDV2ltblO4JD2+IdDOWtGcQBTM=
|
||||
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
|
||||
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
|
|
@ -24,23 +22,19 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/lib/pq v1.11.2 h1:x6gxUeu39V0BHZiugWe8LXZYZ+Utk7hSJGThs8sdzfs=
|
||||
github.com/lib/pq v1.11.2/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ=
|
||||
github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA=
|
||||
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
|
||||
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o0=
|
||||
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
|
||||
github.com/mattn/go-sqlite3 v1.14.34 h1:3NtcvcUnFBPsuRcno8pUtupspG/GM+9nZ88zgJcp6Zk=
|
||||
github.com/mattn/go-sqlite3 v1.14.34/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
|
||||
github.com/petermattis/goid v0.0.0-20260226131333-17d1149c6ac6 h1:rh2lKw/P/EqHa724vYH2+VVQ1YnW4u6EOXl0PMAovZE=
|
||||
github.com/petermattis/goid v0.0.0-20260226131333-17d1149c6ac6/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
|
||||
github.com/mattn/go-sqlite3 v1.14.45 h1:6KA/spDguL3KV8rnybG7ezSaE4SeMR3KC9VbUoAQaIk=
|
||||
github.com/mattn/go-sqlite3 v1.14.45/go.mod h1:pjEuOr8IwzLJP2MfGeTb0A35jauH+C2kbHKBr7yXKVQ=
|
||||
github.com/petermattis/goid v0.0.0-20260330135022-df67b199bc81 h1:WDsQxOJDy0N1VRAjXLpi8sCEZRSGarLWQevDxpTBRrM=
|
||||
github.com/petermattis/goid v0.0.0-20260330135022-df67b199bc81/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
|
|
@ -48,15 +42,15 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR
|
|||
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
|
||||
github.com/rs/xid v1.6.0 h1:fV591PaemRlL6JfRxGDEPl69wICngIQ3shQtzfy2gxU=
|
||||
github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0=
|
||||
github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY=
|
||||
github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ=
|
||||
github.com/rs/zerolog v1.35.1 h1:m7xQeoiLIiV0BCEY4Hs+j2NG4Gp2o2KPKmhnnLiazKI=
|
||||
github.com/rs/zerolog v1.35.1/go.mod h1:EjML9kdfa/RMA7h/6z6pYmq1ykOuA8/mjWaEvGI+jcw=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e h1:MRM5ITcdelLK2j1vwZ3Je0FKVCfqOLp5zO6trqMLYs0=
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDqSt+GTGFMVlhk3ULuV0y9ZmzeVGR4mloJI3M=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.19.0 h1:xwxm7n691Uf3u5OFjzngavjGTh55KX5q/9w9xHW88JU=
|
||||
github.com/tidwall/gjson v1.19.0/go.mod h1:V37/opeE/JbLUOfH0QTXiNez2l0RUjYUhpT4szFQAfc=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/match v1.2.0 h1:0pt8FlkOwjN2fPt4bIl4BoNxb98gGHN2ObFEDkrfZnM=
|
||||
github.com/tidwall/match v1.2.0/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
|
|
@ -65,29 +59,27 @@ github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4=
|
|||
github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
github.com/yuin/goldmark v1.7.16 h1:n+CJdUxaFMiDUNnWC3dMWCIQJSkxH4uz3ZwQBkAlVNE=
|
||||
github.com/yuin/goldmark v1.7.16/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
|
||||
go.mau.fi/util v0.9.7 h1:AWGNbJfz1zRcQOKeOEYhKUG2fT+/26Gy6kyqcH8tnBg=
|
||||
go.mau.fi/util v0.9.7/go.mod h1:5T2f3ZWZFAGgmFwg3dGw7YK6kIsb9lryDzvynoR98pE=
|
||||
github.com/yuin/goldmark v1.8.2 h1:kEGpgqJXdgbkhcOgBxkC0X0PmoPG1ZyoZ117rDVp4zE=
|
||||
github.com/yuin/goldmark v1.8.2/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
|
||||
go.mau.fi/util v0.9.10 h1:wzvz5iDHyqDXB8vgisD4d3SzucLXNM3iNY+1O1RoHtg=
|
||||
go.mau.fi/util v0.9.10/go.mod h1:YQOxySn+ZE3qSYqNxvyX7Yi3suA8YK17PS6QqBREW7A=
|
||||
go.mau.fi/zeroconfig v0.2.0 h1:e/OGEERqVRRKlgaro7E6bh8xXiKFSXB3eNNIud7FUjU=
|
||||
go.mau.fi/zeroconfig v0.2.0/go.mod h1:J0Vn0prHNOm493oZoQ84kq83ZaNCYZnq+noI1b1eN8w=
|
||||
golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4=
|
||||
golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA=
|
||||
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA=
|
||||
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ=
|
||||
golang.org/x/mod v0.34.0 h1:xIHgNUUnW6sYkcM5Jleh05DvLOtwc6RitGHbDk4akRI=
|
||||
golang.org/x/mod v0.34.0/go.mod h1:ykgH52iCZe79kzLLMhyCUzhMci+nQj+0XkbXpNYtVjY=
|
||||
golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0=
|
||||
golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw=
|
||||
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/crypto v0.53.0 h1:QZ4Muo8THX6CizN2vPPd5fBGHyogrdK9fG4wLPFUsto=
|
||||
golang.org/x/crypto v0.53.0/go.mod h1:DNLU434OwVakk9PzuwV8w62mAJpRJL3vsgcfp4Qnsio=
|
||||
golang.org/x/exp v0.0.0-20260611194520-c48552f49976 h1:X8Hz2ImujgbmetVuW+w2YkyZChE3cBpZi2P158rTG9M=
|
||||
golang.org/x/exp v0.0.0-20260611194520-c48552f49976/go.mod h1:vnf4pv9iKZXY58sQE1L86zmNWJ4159e1RkcWiLCkeEY=
|
||||
golang.org/x/mod v0.37.0 h1:vF1DjpVEshcIqoEaauuHebaLk1O1forxjxBaVn884JQ=
|
||||
golang.org/x/mod v0.37.0/go.mod h1:m8S8VeM9r4dzDwjrKO0a1sZP3YjeMamRRlD+fmR2Q/0=
|
||||
golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o=
|
||||
golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec=
|
||||
golang.org/x/sync v0.21.0 h1:HLII4xRRTtCRkxYp4HNFF0Js/Og6q2i++KXbg0gHCwM=
|
||||
golang.org/x/sync v0.21.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
||||
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8=
|
||||
golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA=
|
||||
golang.org/x/sys v0.46.0 h1:noSf2Fq6F8DBgS+LysIkx7rIExoNHJsxOAtPp4rthXw=
|
||||
golang.org/x/sys v0.46.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||
golang.org/x/text v0.38.0 h1:sXmwo9DwP3OK9EZ7PqAdaooSGozfl/3a6/xJcbzPRhE=
|
||||
golang.org/x/text v0.38.0/go.mod h1:YXZt3QhHUKYT53r2lLKFIVi6Ao1jdzrTR/KQ09qyxF4=
|
||||
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
|
||||
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
|
|
@ -99,5 +91,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
|
||||
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
|
||||
maunium.net/go/mautrix v0.26.4 h1:enHSnkf0L2V9+VnfJfNhKSReSW6pBKS/x3Su+v+Vovs=
|
||||
maunium.net/go/mautrix v0.26.4/go.mod h1:YWw8NWTszsbyFAznboicBObwHPgTSLcuTbVX2kY7U2M=
|
||||
maunium.net/go/mautrix v0.28.1 h1:Hic3oDMPbLbQu1fhboTRAKZcORMjzzkjxsa+SGk60b0=
|
||||
maunium.net/go/mautrix v0.28.1/go.mod h1:mWXQNmOlrq4VTDU9f1HO03BSIswdUIyyY4wUKHqwzzY=
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ func (s *SignalClient) FetchMessages(ctx context.Context, params bridgev2.FetchM
|
|||
CompleteCallback: func() {
|
||||
// When reaching the last backwards backfill batch, delete the chat from the backup store.
|
||||
// If backwards backfilling isn't enabled, delete immediately after the first backfill request.
|
||||
if (!params.Forward && len(items) < params.Count) || (!s.Main.Bridge.Config.Backfill.Queue.Enabled && !s.Main.Bridge.Config.Backfill.WillPaginateManually) {
|
||||
if (!params.Forward && len(items) < params.Count) || !s.Main.Bridge.Config.Backfill.Queue.AnyEnabled() {
|
||||
err := s.Client.Store.BackupStore.DeleteBackupChat(ctx, chat.Id)
|
||||
if err != nil {
|
||||
zerolog.Ctx(ctx).Err(err).Msg("Failed to delete chat from backup store")
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ func supportedIfFFmpeg() event.CapabilitySupportLevel {
|
|||
}
|
||||
|
||||
func capID() string {
|
||||
base := "fi.mau.signal.capabilities.2025_12_09"
|
||||
base := "fi.mau.signal.capabilities.2026_05_12"
|
||||
if ffmpeg.Supported() {
|
||||
return base + "+ffmpeg"
|
||||
}
|
||||
|
|
@ -111,7 +111,8 @@ var signalCaps = &event.RoomFeatures{
|
|||
},
|
||||
event.CapMsgSticker: {
|
||||
MimeTypes: map[string]event.CapabilitySupportLevel{
|
||||
"image/webp": event.CapLevelFullySupported,
|
||||
// Signal clients will only render static webp, so apng is preferred
|
||||
"image/webp": event.CapLevelPartialSupport,
|
||||
"image/png": event.CapLevelFullySupported,
|
||||
"image/apng": event.CapLevelFullySupported,
|
||||
"image/gif": supportedIfFFmpeg(),
|
||||
|
|
@ -211,6 +212,7 @@ var signalGeneralCaps = &bridgev2.NetworkGeneralCapabilities{
|
|||
AggressiveUpdateInfo: true,
|
||||
ImplicitReadReceipts: true,
|
||||
Provisioning: bridgev2.ProvisioningCapabilities{
|
||||
ImagePackImport: true,
|
||||
ResolveIdentifier: bridgev2.ResolveIdentifierCapabilities{
|
||||
CreateDM: true,
|
||||
LookupPhone: true,
|
||||
|
|
@ -235,5 +237,5 @@ func (s *SignalConnector) GetCapabilities() *bridgev2.NetworkGeneralCapabilities
|
|||
}
|
||||
|
||||
func (s *SignalConnector) GetBridgeInfoVersion() (info, capabilities int) {
|
||||
return 1, 7
|
||||
return 1, 8
|
||||
}
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ func (s *SignalClient) CreateGroup(ctx context.Context, params *bridgev2.GroupCr
|
|||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to download avatar: %w", err)
|
||||
}
|
||||
group.AvatarPath, err = s.Client.UploadGroupAvatar(ctx, avatarBytes, group.GroupIdentifier)
|
||||
group.AvatarPath, err = s.Client.UploadGroupAvatar(ctx, avatarBytes, group.GroupIdentifier, group.GroupMasterKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to upload avatar: %w", err)
|
||||
}
|
||||
|
|
@ -362,7 +362,7 @@ func (s *SignalClient) CreateGroup(ctx context.Context, params *bridgev2.GroupCr
|
|||
return nil, fmt.Errorf("failed to set portal room ID: %w", err)
|
||||
}
|
||||
}
|
||||
resp, err := s.Client.CreateGroup(ctx, group, avatarBytes)
|
||||
resp, err := s.Client.CreateGroup(ctx, group)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create group: %w", err)
|
||||
}
|
||||
|
|
@ -414,7 +414,7 @@ func (s *SignalClient) GetContactList(ctx context.Context) ([]*bridgev2.ResolveI
|
|||
}
|
||||
|
||||
func (s *SignalClient) makeCreateDMResponse(ctx context.Context, recipient *types.Recipient, backupChat *store.BackupChat) *bridgev2.CreateChatResponse {
|
||||
name := ""
|
||||
namePtr := bridgev2.DefaultChatName
|
||||
topic := PrivateChatTopic
|
||||
selfUser := s.makeEventSender(s.Client.Store.ACI)
|
||||
members := &bridgev2.ChatMemberList{
|
||||
|
|
@ -441,7 +441,7 @@ func (s *SignalClient) makeCreateDMResponse(ctx context.Context, recipient *type
|
|||
var serviceID libsignalgo.ServiceID
|
||||
var avatar *bridgev2.Avatar
|
||||
if recipient.ACI == uuid.Nil {
|
||||
name = s.Main.Config.FormatDisplayname(recipient)
|
||||
namePtr = ptr.Ptr(s.Main.Config.FormatDisplayname(recipient))
|
||||
serviceID = libsignalgo.NewPNIServiceID(recipient.PNI)
|
||||
} else {
|
||||
if backupChat == nil {
|
||||
|
|
@ -453,7 +453,7 @@ func (s *SignalClient) makeCreateDMResponse(ctx context.Context, recipient *type
|
|||
}
|
||||
members.OtherUserID = signalid.MakeUserID(recipient.ACI)
|
||||
if recipient.ACI == s.Client.Store.ACI {
|
||||
name = NoteToSelfName
|
||||
namePtr = ptr.Ptr(NoteToSelfName)
|
||||
avatar = &bridgev2.Avatar{
|
||||
ID: networkid.AvatarID(s.Main.Config.NoteToSelfAvatar),
|
||||
Remove: len(s.Main.Config.NoteToSelfAvatar) == 0,
|
||||
|
|
@ -474,7 +474,7 @@ func (s *SignalClient) makeCreateDMResponse(ctx context.Context, recipient *type
|
|||
return &bridgev2.CreateChatResponse{
|
||||
PortalKey: s.makeDMPortalKey(serviceID),
|
||||
PortalInfo: &bridgev2.ChatInfo{
|
||||
Name: &name,
|
||||
Name: namePtr,
|
||||
Avatar: avatar,
|
||||
Topic: &topic,
|
||||
Members: members,
|
||||
|
|
|
|||
|
|
@ -32,10 +32,19 @@ import (
|
|||
"go.mau.fi/mautrix-signal/pkg/signalmeow/types"
|
||||
)
|
||||
|
||||
func (s *SignalClient) syncChats(ctx context.Context) {
|
||||
func (s *SignalClient) stopChatSync() {
|
||||
if cancel := s.cancelChatSync.Swap(nil); cancel != nil {
|
||||
(*cancel)()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SignalClient) syncChats(ctx context.Context, cancel context.CancelFunc) {
|
||||
defer cancel()
|
||||
|
||||
if s.UserLogin.Metadata.(*signalid.UserLoginMetadata).ChatsSynced {
|
||||
return
|
||||
}
|
||||
|
||||
if s.Client.Store.EphemeralBackupKey != nil {
|
||||
zerolog.Ctx(ctx).Info().Msg("Fetching transfer archive before syncing chats")
|
||||
meta, err := s.Client.WaitForTransfer(ctx)
|
||||
|
|
@ -65,10 +74,22 @@ func (s *SignalClient) syncChats(ctx context.Context) {
|
|||
}
|
||||
zerolog.Ctx(ctx).Info().Int("chat_count", len(chats)).Msg("Fetched chats to sync from database")
|
||||
for _, chat := range chats {
|
||||
if ctx.Err() != nil {
|
||||
zerolog.Ctx(ctx).Debug().
|
||||
AnErr("ctx_err", ctx.Err()).
|
||||
Msg("Context cancelled while syncing chats, stopping")
|
||||
return
|
||||
}
|
||||
recipient, err := s.Client.Store.BackupStore.GetBackupRecipient(ctx, chat.RecipientId)
|
||||
if err != nil {
|
||||
zerolog.Ctx(ctx).Err(err).Msg("Failed to get recipient for chat")
|
||||
continue
|
||||
} else if recipient == nil {
|
||||
zerolog.Ctx(ctx).Warn().
|
||||
Uint64("backup_chat_id", chat.Id).
|
||||
Uint64("backup_recipient_id", chat.RecipientId).
|
||||
Msg("No recipient found for chat")
|
||||
continue
|
||||
}
|
||||
resyncEvt := &simplevent.ChatResync{
|
||||
EventMeta: simplevent.EventMeta{
|
||||
|
|
@ -130,7 +151,10 @@ func (s *SignalClient) syncChats(ctx context.Context) {
|
|||
groupID := types.GroupIdentifier(base64.StdEncoding.EncodeToString(rawGroupID[:]))
|
||||
groupInfo, err := s.getGroupInfo(ctx, groupID, dest.Group.GetSnapshot().GetVersion(), chat)
|
||||
if err != nil {
|
||||
zerolog.Ctx(ctx).Err(err).Msg("Failed to get full group info")
|
||||
zerolog.Ctx(ctx).Err(err).
|
||||
Uint64("recipient_id", recipient.Id).
|
||||
Stringer("group_id", groupID).
|
||||
Msg("Failed to get full group info")
|
||||
continue
|
||||
}
|
||||
resyncEvt.PortalKey = s.makePortalKey(string(groupID))
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package connector
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
|
@ -26,6 +27,7 @@ import (
|
|||
"maunium.net/go/mautrix/bridgev2"
|
||||
"maunium.net/go/mautrix/bridgev2/networkid"
|
||||
"maunium.net/go/mautrix/bridgev2/status"
|
||||
"maunium.net/go/mautrix/event"
|
||||
|
||||
"go.mau.fi/mautrix-signal/pkg/signalid"
|
||||
"go.mau.fi/mautrix-signal/pkg/signalmeow"
|
||||
|
|
@ -39,11 +41,13 @@ type SignalClient struct {
|
|||
Ghost *bridgev2.Ghost
|
||||
|
||||
queueEmptyWaiter *exsync.Event
|
||||
cancelChatSync atomic.Pointer[context.CancelFunc]
|
||||
}
|
||||
|
||||
var (
|
||||
_ bridgev2.NetworkAPI = (*SignalClient)(nil)
|
||||
_ bridgev2.BackgroundSyncingNetworkAPI = (*SignalClient)(nil)
|
||||
_ bridgev2.StickerImportingNetworkAPI = (*SignalClient)(nil)
|
||||
)
|
||||
|
||||
var pushCfg = &bridgev2.PushConfig{
|
||||
|
|
@ -74,10 +78,19 @@ func (s *SignalClient) RegisterPushNotifications(ctx context.Context, pushType b
|
|||
}
|
||||
}
|
||||
|
||||
func (s *SignalClient) DownloadImagePack(ctx context.Context, url string) (*bridgev2.ImportedImagePack, error) {
|
||||
return s.Main.MsgConv.DownloadImagePack(ctx, url)
|
||||
}
|
||||
|
||||
func (s *SignalClient) ListImagePacks(ctx context.Context) ([]*event.ImagePackMetadata, error) {
|
||||
return []*event.ImagePackMetadata{}, nil
|
||||
}
|
||||
|
||||
func (s *SignalClient) LogoutRemote(ctx context.Context) {
|
||||
if s.Client == nil {
|
||||
return
|
||||
}
|
||||
s.stopChatSync()
|
||||
err := s.Client.Unlink(ctx)
|
||||
if err != nil {
|
||||
zerolog.Ctx(ctx).Err(err).Msg("Failed to unlink device")
|
||||
|
|
@ -176,6 +189,7 @@ func (s *SignalClient) bridgeStateLoop(statusChan <-chan signalmeow.SignalConnec
|
|||
}
|
||||
|
||||
case signalmeow.SignalConnectionEventLoggedOut:
|
||||
s.stopChatSync()
|
||||
s.UserLogin.Log.Debug().Msg("Sending BadCredentials BridgeState")
|
||||
if err == nil {
|
||||
s.UserLogin.BridgeState.Send(status.BridgeState{StateEvent: status.StateBadCredentials, Message: "You have been logged out of Signal, please reconnect"})
|
||||
|
|
@ -274,6 +288,7 @@ func (s *SignalClient) Disconnect() {
|
|||
if s.Client == nil {
|
||||
return
|
||||
}
|
||||
s.stopChatSync()
|
||||
err := s.Client.StopReceiveLoops()
|
||||
if err != nil {
|
||||
s.UserLogin.Log.Err(err).Msg("Failed to stop receive loops")
|
||||
|
|
@ -281,25 +296,18 @@ func (s *SignalClient) Disconnect() {
|
|||
}
|
||||
|
||||
func (s *SignalClient) postLoginConnect() {
|
||||
ctx := s.UserLogin.Log.WithContext(context.Background())
|
||||
// TODO it would be more proper to only connect after syncing,
|
||||
// but currently syncing will fetch group info online, so it has to be connected.
|
||||
ctx := s.UserLogin.Log.WithContext(s.Main.Bridge.BackgroundCtx)
|
||||
s.tryConnect(ctx, 0, false)
|
||||
if s.Client.Store.EphemeralBackupKey != nil {
|
||||
go func() {
|
||||
if s.Client.Store.MasterKey != nil {
|
||||
s.Client.SyncStorage(ctx)
|
||||
} else {
|
||||
s.UserLogin.Log.Warn().Msg("No master key for storage sync before backup sync")
|
||||
}
|
||||
s.syncChats(ctx)
|
||||
}()
|
||||
} else if s.Client.Store.MasterKey != nil {
|
||||
go s.Client.SyncStorage(ctx)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *SignalClient) tryConnect(ctx context.Context, retryCount int, doSync bool) {
|
||||
func (s *SignalClient) tryConnect(ctx context.Context, retryCount int, noLoginSync bool) {
|
||||
if ctx.Err() != nil {
|
||||
zerolog.Ctx(ctx).Debug().
|
||||
Int("retry_count", retryCount).
|
||||
AnErr("ctx_err", ctx.Err()).
|
||||
Msg("Context is canceled, not trying to connect")
|
||||
return
|
||||
}
|
||||
if retryCount == 0 {
|
||||
s.UserLogin.BridgeState.Send(status.BridgeState{StateEvent: status.StateConnecting})
|
||||
}
|
||||
|
|
@ -318,11 +326,33 @@ func (s *SignalClient) tryConnect(ctx context.Context, retryCount int, doSync bo
|
|||
zerolog.Ctx(ctx).Info().Msg("Context canceled, exit tryConnect")
|
||||
return
|
||||
}
|
||||
s.tryConnect(ctx, retryCount+1, doSync)
|
||||
s.tryConnect(ctx, retryCount+1, noLoginSync)
|
||||
return
|
||||
}
|
||||
syncCtx, cancel := context.WithCancel(ctx)
|
||||
if oldCancel := s.cancelChatSync.Swap(&cancel); oldCancel != nil {
|
||||
(*oldCancel)()
|
||||
}
|
||||
go s.bridgeStateLoop(ch)
|
||||
if noLoginSync {
|
||||
go s.syncChats(syncCtx, cancel)
|
||||
} else {
|
||||
go s.bridgeStateLoop(ch)
|
||||
if doSync {
|
||||
go s.syncChats(ctx)
|
||||
// TODO it would be more proper to only connect after syncing,
|
||||
// but currently syncing will fetch group info online, so it has to be connected.
|
||||
if s.Client.Store.EphemeralBackupKey != nil {
|
||||
go func() {
|
||||
if s.Client.Store.MasterKey != nil {
|
||||
s.Client.SyncStorage(ctx)
|
||||
} else {
|
||||
s.UserLogin.Log.Warn().Msg("No master key for storage sync before backup sync")
|
||||
}
|
||||
s.syncChats(syncCtx, cancel)
|
||||
}()
|
||||
} else {
|
||||
cancel()
|
||||
if s.Client.Store.MasterKey != nil {
|
||||
go s.Client.SyncStorage(ctx)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import (
|
|||
"context"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
"maunium.net/go/mautrix/bridgev2"
|
||||
|
|
@ -30,6 +29,7 @@ func (s *SignalConnector) Download(ctx context.Context, mediaID networkid.MediaI
|
|||
return nil, fmt.Errorf("failed to parse direct media id: %w", err)
|
||||
}
|
||||
|
||||
var rawDataResp []byte
|
||||
switch info := info.(type) {
|
||||
case *signalid.DirectMediaAttachment:
|
||||
log.Info().
|
||||
|
|
@ -76,18 +76,11 @@ func (s *SignalConnector) Download(ctx context.Context, mediaID networkid.MediaI
|
|||
return nil, fmt.Errorf("failed to to get group master key: %w", err)
|
||||
}
|
||||
|
||||
return &mediaproxy.GetMediaResponseCallback{
|
||||
Callback: func(w io.Writer) (int64, error) {
|
||||
data, err := client.Client.DownloadGroupAvatar(ctx, info.GroupAvatarPath, groupMasterKey)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Direct download failed")
|
||||
return 0, err
|
||||
}
|
||||
|
||||
_, err = w.Write(data)
|
||||
return int64(len(data)), err
|
||||
},
|
||||
}, nil
|
||||
rawDataResp, err = client.Client.DownloadGroupAvatar(ctx, info.GroupAvatarPath, groupMasterKey)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Direct download failed")
|
||||
return nil, err
|
||||
}
|
||||
case *signalid.DirectMediaProfileAvatar:
|
||||
log.Info().
|
||||
Stringer("user_id", info.UserID).
|
||||
|
|
@ -111,19 +104,27 @@ func (s *SignalConnector) Download(ctx context.Context, mediaID networkid.MediaI
|
|||
return nil, fmt.Errorf("profile key not found")
|
||||
}
|
||||
|
||||
return &mediaproxy.GetMediaResponseCallback{
|
||||
Callback: func(w io.Writer) (int64, error) {
|
||||
data, err := client.Client.DownloadUserAvatar(ctx, info.ProfileAvatarPath, *profileKey)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Direct download failed")
|
||||
return 0, err
|
||||
}
|
||||
rawDataResp, err = client.Client.DownloadUserAvatar(ctx, info.ProfileAvatarPath, *profileKey)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Direct download failed")
|
||||
return nil, err
|
||||
}
|
||||
case *signalid.DirectMediaSticker:
|
||||
log.Info().
|
||||
Hex("pack_id", info.PackID).
|
||||
Uint32("sticker_id", info.StickerID).
|
||||
Msg("Direct downloading sticker")
|
||||
|
||||
_, err = w.Write(data)
|
||||
return int64(len(data)), err
|
||||
},
|
||||
}, nil
|
||||
rawDataResp, err = signalmeow.DownloadStickerPackItem(ctx, info.PackID, info.PackKey, info.StickerID)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Direct download failed")
|
||||
return nil, err
|
||||
}
|
||||
default:
|
||||
return nil, fmt.Errorf("no downloader for direct media type: %T", info)
|
||||
}
|
||||
if rawDataResp == nil {
|
||||
return nil, fmt.Errorf("unexpected fallthrough with no data")
|
||||
}
|
||||
return mediaproxy.GetMediaResponseRawData(rawDataResp), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ func (s *SignalClient) doSendMessage(
|
|||
}
|
||||
msgID := signalid.MakeMessageID(s.Client.Store.ACI, ts)
|
||||
msg.AddPendingToIgnore(networkid.TransactionID(msgID))
|
||||
err := s.sendMessage(ctx, msg.Portal.ID, &signalpb.Content{DataMessage: converted})
|
||||
err := s.sendMessage(ctx, msg.Portal.ID, signalmeow.WrapDataMessage(converted))
|
||||
if err != nil {
|
||||
return nil, bridgev2.WrapErrorInStatus(err).WithSendNotice(true)
|
||||
}
|
||||
|
|
@ -173,10 +173,10 @@ func (s *SignalClient) HandleMatrixEdit(ctx context.Context, msg *bridgev2.Matri
|
|||
}
|
||||
ts := getTimestampForEvent(msg.InputTransactionID, msg.Event, msg.OrigSender)
|
||||
converted.Timestamp = &ts
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, &signalpb.Content{EditMessage: &signalpb.EditMessage{
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, signalmeow.WrapEditMessage(&signalpb.EditMessage{
|
||||
TargetSentTimestamp: proto.Uint64(targetSentTimestamp),
|
||||
DataMessage: converted,
|
||||
}})
|
||||
}))
|
||||
if err != nil {
|
||||
return bridgev2.WrapErrorInStatus(err).WithSendNotice(true)
|
||||
}
|
||||
|
|
@ -200,19 +200,16 @@ func (s *SignalClient) HandleMatrixReaction(ctx context.Context, msg *bridgev2.M
|
|||
return nil, fmt.Errorf("failed to parse target message ID: %w", err)
|
||||
}
|
||||
ts := getTimestampForEvent(msg.InputTransactionID, msg.Event, msg.OrigSender)
|
||||
wrappedContent := &signalpb.Content{
|
||||
DataMessage: &signalpb.DataMessage{
|
||||
Timestamp: proto.Uint64(ts),
|
||||
RequiredProtocolVersion: proto.Uint32(uint32(signalpb.DataMessage_REACTIONS)),
|
||||
Reaction: &signalpb.DataMessage_Reaction{
|
||||
Emoji: proto.String(msg.PreHandleResp.Emoji),
|
||||
Remove: proto.Bool(false),
|
||||
TargetAuthorAciBinary: targetAuthorACI[:],
|
||||
TargetSentTimestamp: proto.Uint64(targetSentTimestamp),
|
||||
},
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, signalmeow.WrapDataMessage(&signalpb.DataMessage{
|
||||
Timestamp: proto.Uint64(ts),
|
||||
RequiredProtocolVersion: proto.Uint32(uint32(signalpb.DataMessage_REACTIONS)),
|
||||
Reaction: &signalpb.DataMessage_Reaction{
|
||||
Emoji: proto.String(msg.PreHandleResp.Emoji),
|
||||
Remove: proto.Bool(false),
|
||||
TargetAuthorAciBinary: targetAuthorACI[:],
|
||||
TargetSentTimestamp: proto.Uint64(targetSentTimestamp),
|
||||
},
|
||||
}
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, wrappedContent)
|
||||
}))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -225,19 +222,16 @@ func (s *SignalClient) HandleMatrixReactionRemove(ctx context.Context, msg *brid
|
|||
return fmt.Errorf("failed to parse target message ID: %w", err)
|
||||
}
|
||||
ts := getTimestampForEvent(msg.InputTransactionID, msg.Event, msg.OrigSender)
|
||||
wrappedContent := &signalpb.Content{
|
||||
DataMessage: &signalpb.DataMessage{
|
||||
Timestamp: proto.Uint64(ts),
|
||||
RequiredProtocolVersion: proto.Uint32(uint32(signalpb.DataMessage_REACTIONS)),
|
||||
Reaction: &signalpb.DataMessage_Reaction{
|
||||
Emoji: proto.String(msg.TargetReaction.Emoji),
|
||||
Remove: proto.Bool(true),
|
||||
TargetAuthorAciBinary: targetAuthorACI[:],
|
||||
TargetSentTimestamp: proto.Uint64(targetSentTimestamp),
|
||||
},
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, signalmeow.WrapDataMessage(&signalpb.DataMessage{
|
||||
Timestamp: proto.Uint64(ts),
|
||||
RequiredProtocolVersion: proto.Uint32(uint32(signalpb.DataMessage_REACTIONS)),
|
||||
Reaction: &signalpb.DataMessage_Reaction{
|
||||
Emoji: proto.String(msg.TargetReaction.Emoji),
|
||||
Remove: proto.Bool(true),
|
||||
TargetAuthorAciBinary: targetAuthorACI[:],
|
||||
TargetSentTimestamp: proto.Uint64(targetSentTimestamp),
|
||||
},
|
||||
}
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, wrappedContent)
|
||||
}))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -252,15 +246,12 @@ func (s *SignalClient) HandleMatrixMessageRemove(ctx context.Context, msg *bridg
|
|||
return fmt.Errorf("cannot delete other people's messages")
|
||||
}
|
||||
ts := getTimestampForEvent(msg.InputTransactionID, msg.Event, msg.OrigSender)
|
||||
wrappedContent := &signalpb.Content{
|
||||
DataMessage: &signalpb.DataMessage{
|
||||
Timestamp: proto.Uint64(ts),
|
||||
Delete: &signalpb.DataMessage_Delete{
|
||||
TargetSentTimestamp: proto.Uint64(targetSentTimestamp),
|
||||
},
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, signalmeow.WrapDataMessage(&signalpb.DataMessage{
|
||||
Timestamp: proto.Uint64(ts),
|
||||
Delete: &signalpb.DataMessage_Delete{
|
||||
TargetSentTimestamp: proto.Uint64(targetSentTimestamp),
|
||||
},
|
||||
}
|
||||
err = s.sendMessage(ctx, msg.Portal.ID, wrappedContent)
|
||||
}))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
@ -387,7 +378,7 @@ func (s *SignalClient) HandleMatrixRoomAvatar(ctx context.Context, msg *bridgev2
|
|||
return false, fmt.Errorf("failed to download avatar: %w", err)
|
||||
}
|
||||
avatarHash = sha256.Sum256(data)
|
||||
avatarPath, err = s.Client.UploadGroupAvatar(ctx, data, groupID)
|
||||
avatarPath, err = s.Client.UploadGroupAvatar(ctx, data, groupID, "")
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to reupload avatar: %w", err)
|
||||
}
|
||||
|
|
@ -407,6 +398,9 @@ func (s *SignalClient) HandleMatrixRoomTopic(ctx context.Context, msg *bridgev2.
|
|||
}
|
||||
|
||||
func (s *SignalClient) HandleMatrixMembership(ctx context.Context, msg *bridgev2.MatrixMembershipChange) (*bridgev2.MatrixMembershipResult, error) {
|
||||
if msg.Type.IsSelf && msg.OrigSender != nil {
|
||||
return nil, nil
|
||||
}
|
||||
var targetIntent bridgev2.MatrixAPI
|
||||
var targetSignalID libsignalgo.ServiceID
|
||||
var err error
|
||||
|
|
@ -544,7 +538,7 @@ func (s *SignalClient) HandleMatrixMembership(ctx context.Context, msg *bridgev2
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if msg.Type == bridgev2.Invite && targetSignalID.Type != libsignalgo.ServiceIDTypePNI {
|
||||
if (msg.Type == bridgev2.Invite || msg.Type == bridgev2.AcceptKnock) && targetSignalID.Type != libsignalgo.ServiceIDTypePNI {
|
||||
err = targetIntent.EnsureJoined(ctx, msg.Portal.MXID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -685,13 +679,11 @@ func (s *SignalClient) HandleMatrixDisappearingTimer(ctx context.Context, msg *b
|
|||
})
|
||||
} else {
|
||||
ts := getTimestampForEvent(msg.InputTransactionID, msg.Event, msg.OrigSender)
|
||||
res := s.Client.SendMessage(ctx, userID, &signalpb.Content{
|
||||
DataMessage: &signalpb.DataMessage{
|
||||
Timestamp: ptr.Ptr(ts),
|
||||
Flags: ptr.Ptr(uint32(signalpb.DataMessage_EXPIRATION_TIMER_UPDATE)),
|
||||
ExpireTimer: ptr.Ptr(uint32(msg.Content.Timer.Seconds())),
|
||||
},
|
||||
})
|
||||
res := s.Client.SendMessage(ctx, userID, signalmeow.WrapDataMessage(&signalpb.DataMessage{
|
||||
Timestamp: ptr.Ptr(ts),
|
||||
Flags: ptr.Ptr(uint32(signalpb.DataMessage_EXPIRATION_TIMER_UPDATE)),
|
||||
ExpireTimer: ptr.Ptr(uint32(msg.Content.Timer.Seconds())),
|
||||
}))
|
||||
if !res.WasSuccessful {
|
||||
return false, res.Error
|
||||
}
|
||||
|
|
@ -770,8 +762,8 @@ func (s *SignalClient) HandleMatrixDeleteChat(ctx context.Context, msg *bridgev2
|
|||
|
||||
recipientID := s.Client.Store.ACIServiceID()
|
||||
// Send DeleteForMe sync message to self
|
||||
result := s.Client.SendMessage(ctx, recipientID, &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
result := s.Client.SendMessage(ctx, recipientID, signalmeow.WrapSyncMessage(&signalpb.SyncMessage{
|
||||
Content: &signalpb.SyncMessage_DeleteForMe_{
|
||||
DeleteForMe: &signalpb.SyncMessage_DeleteForMe{
|
||||
ConversationDeletes: []*signalpb.SyncMessage_DeleteForMe_ConversationDelete{{
|
||||
Conversation: conversationID,
|
||||
|
|
@ -780,7 +772,7 @@ func (s *SignalClient) HandleMatrixDeleteChat(ctx context.Context, msg *bridgev2
|
|||
}},
|
||||
},
|
||||
},
|
||||
})
|
||||
}))
|
||||
|
||||
zerolog.Ctx(ctx).Debug().
|
||||
Str("portal_id", string(msg.Portal.ID)).
|
||||
|
|
@ -865,11 +857,11 @@ func (s *SignalClient) syncMessageRequestResponse(
|
|||
} else {
|
||||
return fmt.Errorf("invalid portal ID for message request response: %s", portal.ID)
|
||||
}
|
||||
res := s.Client.SendMessage(ctx, libsignalgo.NewACIServiceID(s.Client.Store.ACI), &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
res := s.Client.SendMessage(ctx, libsignalgo.NewACIServiceID(s.Client.Store.ACI), signalmeow.WrapSyncMessage(&signalpb.SyncMessage{
|
||||
Content: &signalpb.SyncMessage_MessageRequestResponse_{
|
||||
MessageRequestResponse: accept,
|
||||
},
|
||||
})
|
||||
}))
|
||||
if !res.WasSuccessful {
|
||||
return res.Error
|
||||
}
|
||||
|
|
@ -902,13 +894,13 @@ func (s *SignalClient) HandleMatrixAcceptMessageRequest(ctx context.Context, msg
|
|||
}
|
||||
}
|
||||
res := s.Client.SendMessage(ctx, userID, &signalpb.Content{
|
||||
DataMessage: &signalpb.DataMessage{
|
||||
Content: &signalpb.Content_DataMessage{DataMessage: &signalpb.DataMessage{
|
||||
Flags: proto.Uint32(uint32(signalpb.DataMessage_PROFILE_KEY_UPDATE)),
|
||||
ProfileKey: profileKey.Slice(),
|
||||
Timestamp: proto.Uint64(getTimestampForEvent(msg.InputTransactionID, msg.Event, msg.OrigSender)),
|
||||
|
||||
RequiredProtocolVersion: proto.Uint32(0),
|
||||
},
|
||||
}},
|
||||
PniSignatureMessage: pniSig,
|
||||
})
|
||||
if !res.WasSuccessful {
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ func (evt *Bv2ChatEvent) GetType() bridgev2.RemoteEventType {
|
|||
return bridgev2.RemoteEventReactionRemove
|
||||
}
|
||||
return bridgev2.RemoteEventReaction
|
||||
case innerEvt.Delete != nil:
|
||||
case innerEvt.Delete != nil, innerEvt.AdminDelete != nil:
|
||||
return bridgev2.RemoteEventMessageRemove
|
||||
case innerEvt.GetGroupV2().GetGroupChange() != nil:
|
||||
return bridgev2.RemoteEventChatInfoChange
|
||||
|
|
@ -303,6 +303,11 @@ func (evt *Bv2ChatEvent) GetTargetMessage() networkid.MessageID {
|
|||
targetSentTS = innerEvt.Reaction.GetTargetSentTimestamp()
|
||||
case innerEvt.Delete != nil:
|
||||
targetSentTS = innerEvt.Delete.GetTargetSentTimestamp()
|
||||
case innerEvt.AdminDelete != nil:
|
||||
if len(innerEvt.AdminDelete.GetTargetAuthorAciBinary()) == 16 {
|
||||
targetAuthorACI = uuid.UUID(innerEvt.AdminDelete.GetTargetAuthorAciBinary())
|
||||
}
|
||||
targetSentTS = innerEvt.AdminDelete.GetTargetSentTimestamp()
|
||||
default:
|
||||
return ""
|
||||
}
|
||||
|
|
@ -421,7 +426,7 @@ func (b *Bv2Receipt) GetReadUpTo() time.Time {
|
|||
return time.Time{}
|
||||
}
|
||||
|
||||
var _ bridgev2.RemoteReceipt = (*Bv2Receipt)(nil)
|
||||
var _ bridgev2.RemoteReadReceipt = (*Bv2Receipt)(nil)
|
||||
|
||||
func convertReceipts[T any](ctx context.Context, input []T, getMessageFunc func(ctx context.Context, msgID T) (*database.Message, error)) map[networkid.PortalKey]*Bv2Receipt {
|
||||
log := zerolog.Ctx(ctx)
|
||||
|
|
@ -467,7 +472,7 @@ func (s *SignalClient) handleSignalReceipt(evt *events.Receipt) bool {
|
|||
Stringer("sender_id", evt.Sender).
|
||||
Stringer("receipt_type", evt.Content.GetType()).
|
||||
Logger()
|
||||
ctx := log.WithContext(context.TODO())
|
||||
ctx := log.WithContext(s.Main.Bridge.BackgroundCtx)
|
||||
receipts := convertReceipts(ctx, evt.Content.Timestamp, func(ctx context.Context, msgTS uint64) (*database.Message, error) {
|
||||
return s.Main.Bridge.DB.Message.GetFirstPartByID(ctx, s.UserLogin.ID, signalid.MakeMessageID(s.Client.Store.ACI, msgTS))
|
||||
})
|
||||
|
|
@ -478,7 +483,7 @@ func (s *SignalClient) handleSignalReadSelf(evt *events.ReadSelf) bool {
|
|||
log := s.UserLogin.Log.With().
|
||||
Str("action", "handle signal read self").
|
||||
Logger()
|
||||
ctx := log.WithContext(context.TODO())
|
||||
ctx := log.WithContext(s.Main.Bridge.BackgroundCtx)
|
||||
receipts := convertReceipts(ctx, evt.Messages, func(ctx context.Context, msgInfo *signalpb.SyncMessage_Read) (*database.Message, error) {
|
||||
aciUUID, err := signalmeow.ParseStringOrBinaryUUID(msgInfo.GetSenderAci(), msgInfo.GetSenderAciBinary())
|
||||
if err != nil {
|
||||
|
|
@ -688,7 +693,7 @@ func (s *SignalClient) handleSignalACIFound(evt *events.ACIFound) {
|
|||
Stringer("aci", evt.ACI).
|
||||
Stringer("pni", evt.PNI).
|
||||
Logger()
|
||||
ctx := log.WithContext(context.TODO())
|
||||
ctx := log.WithContext(s.Main.Bridge.BackgroundCtx)
|
||||
pniPortalKey := s.makeDMPortalKey(evt.PNI)
|
||||
aciPortalKey := s.makeDMPortalKey(evt.ACI)
|
||||
result, portal, err := s.Main.Bridge.ReIDPortal(ctx, pniPortalKey, aciPortalKey)
|
||||
|
|
@ -708,7 +713,7 @@ func (s *SignalClient) handleSignalACIFound(evt *events.ACIFound) {
|
|||
|
||||
func (s *SignalClient) handleSignalContactList(evt *events.ContactList) {
|
||||
log := s.UserLogin.Log.With().Str("action", "handle contact list").Logger()
|
||||
ctx := log.WithContext(context.TODO())
|
||||
ctx := log.WithContext(s.Main.Bridge.BackgroundCtx)
|
||||
for _, contact := range evt.Contacts {
|
||||
if contact.ACI == uuid.Nil {
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func (pa *Address) CancelFinalizer() {
|
|||
}
|
||||
|
||||
func (pa *Address) Name() (string, error) {
|
||||
var name *C.char
|
||||
var name C.SignalCStringPtr
|
||||
signalFfiError := C.signal_address_get_name(&name, pa.constPtr())
|
||||
runtime.KeepAlive(pa)
|
||||
if signalFfiError != nil {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ package libsignalgo
|
|||
import "C"
|
||||
import "unsafe"
|
||||
|
||||
func CopyCStringToString(cString *C.char) (s string) {
|
||||
func CopyCStringToString(cString C.SignalCStringPtr) (s string) {
|
||||
s = C.GoString(cString)
|
||||
C.signal_free_string(cString)
|
||||
return
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ func wrapError(signalError *C.SignalFfiError) error {
|
|||
}
|
||||
|
||||
func wrapSignalError(signalError *C.SignalFfiError, errorType C.uint32_t) error {
|
||||
var messageBytes *C.char
|
||||
var messageBytes C.SignalCStringPtr
|
||||
getMessageError := C.signal_error_get_message(&messageBytes, signalError)
|
||||
if getMessageError != nil {
|
||||
// Ignore any errors from this, it will just end up being an empty string.
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ func (f *Fingerprint) ScannableEncoding() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (f *Fingerprint) DisplayString() (string, error) {
|
||||
var displayString *C.char
|
||||
var displayString C.SignalCStringPtr
|
||||
signalFfiError := C.signal_fingerprint_display_string(&displayString, f.constPtr())
|
||||
runtime.KeepAlive(f)
|
||||
if signalFfiError != nil {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ package libsignalgo
|
|||
/*
|
||||
#include "./libsignal-ffi.h"
|
||||
|
||||
extern int signal_get_identity_key_pair_callback(void *store_ctx, SignalMutPointerPrivateKey *keyp);
|
||||
extern int signal_get_identity_key_pair_callback(void *store_ctx, SignalPairOfMutPointerPrivateKeyMutPointerPublicKey *keyp);
|
||||
extern int signal_get_local_registration_id_callback(void *store_ctx, uint32_t *idp);
|
||||
extern int signal_save_identity_key_callback(void *store_ctx, uint8_t *out, SignalMutPointerProtocolAddress address, SignalMutPointerPublicKey public_key);
|
||||
extern int signal_get_identity_key_callback(void *store_ctx, SignalMutPointerPublicKey *public_keyp, SignalMutPointerProtocolAddress address);
|
||||
|
|
@ -49,22 +49,29 @@ type IdentityKeyStore interface {
|
|||
}
|
||||
|
||||
//export signal_get_identity_key_pair_callback
|
||||
func signal_get_identity_key_pair_callback(storeCtx unsafe.Pointer, keyp *C.SignalMutPointerPrivateKey) C.int {
|
||||
func signal_get_identity_key_pair_callback(storeCtx unsafe.Pointer, keyp *C.SignalPairOfMutPointerPrivateKeyMutPointerPublicKey) C.int {
|
||||
return wrapStoreCallback(storeCtx, func(store IdentityKeyStore, ctx context.Context) error {
|
||||
key, err := store.GetIdentityKeyPair(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if key == nil {
|
||||
keyp.raw = nil
|
||||
} else {
|
||||
clone, err := key.privateKey.Clone()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
clone.CancelFinalizer()
|
||||
keyp.raw = clone.ptr
|
||||
keyp.first.raw = nil
|
||||
keyp.second.raw = nil
|
||||
return nil
|
||||
}
|
||||
privClone, err := key.privateKey.Clone()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pubClone, err := key.publicKey.Clone()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
privClone.CancelFinalizer()
|
||||
pubClone.CancelFinalizer()
|
||||
keyp.first.raw = privClone.ptr
|
||||
keyp.second.raw = pubClone.ptr
|
||||
return err
|
||||
})
|
||||
}
|
||||
|
|
@ -151,12 +158,12 @@ func signal_destroy_identity_key_store_callback(storeCtx unsafe.Pointer) {
|
|||
|
||||
func (ctx *CallbackContext) wrapIdentityKeyStore(store IdentityKeyStore) C.SignalConstPointerFfiIdentityKeyStoreStruct {
|
||||
return C.SignalConstPointerFfiIdentityKeyStoreStruct{&C.SignalIdentityKeyStore{
|
||||
ctx: wrapStore(ctx, store),
|
||||
get_local_identity_private_key: C.SignalFfiBridgeIdentityKeyStoreGetLocalIdentityPrivateKey(C.signal_get_identity_key_pair_callback),
|
||||
get_local_registration_id: C.SignalFfiBridgeIdentityKeyStoreGetLocalRegistrationId(C.signal_get_local_registration_id_callback),
|
||||
get_identity_key: C.SignalFfiBridgeIdentityKeyStoreGetIdentityKey(C.signal_get_identity_key_callback),
|
||||
save_identity_key: C.SignalFfiBridgeIdentityKeyStoreSaveIdentityKey(C.signal_save_identity_key_callback),
|
||||
is_trusted_identity: C.SignalFfiBridgeIdentityKeyStoreIsTrustedIdentity(C.signal_is_trusted_identity_callback),
|
||||
destroy: C.SignalFfiBridgeIdentityKeyStoreDestroy(C.signal_destroy_identity_key_store_callback),
|
||||
ctx: wrapStore(ctx, store),
|
||||
get_local_identity_key_pair: C.SignalFfiIdentityKeyStoreGetLocalIdentityKeyPair(C.signal_get_identity_key_pair_callback),
|
||||
get_local_registration_id: C.SignalFfiIdentityKeyStoreGetLocalRegistrationId(C.signal_get_local_registration_id_callback),
|
||||
get_identity_key: C.SignalFfiIdentityKeyStoreGetIdentityKey(C.signal_get_identity_key_callback),
|
||||
save_identity_key: C.SignalFfiIdentityKeyStoreSaveIdentityKey(C.signal_save_identity_key_callback),
|
||||
is_trusted_identity: C.SignalFfiIdentityKeyStoreIsTrustedIdentity(C.signal_is_trusted_identity_callback),
|
||||
destroy: C.SignalFfiIdentityKeyStoreDestroy(C.signal_destroy_identity_key_store_callback),
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,9 +77,9 @@ func signal_destroy_kyber_pre_key_store_callback(storeCtx unsafe.Pointer) {
|
|||
func (ctx *CallbackContext) wrapKyberPreKeyStore(store KyberPreKeyStore) C.SignalConstPointerFfiKyberPreKeyStoreStruct {
|
||||
return C.SignalConstPointerFfiKyberPreKeyStoreStruct{&C.SignalKyberPreKeyStore{
|
||||
ctx: wrapStore(ctx, store),
|
||||
load_kyber_pre_key: C.SignalFfiBridgeKyberPreKeyStoreLoadKyberPreKey(C.signal_load_kyber_pre_key_callback),
|
||||
store_kyber_pre_key: C.SignalFfiBridgeKyberPreKeyStoreStoreKyberPreKey(C.signal_store_kyber_pre_key_callback),
|
||||
mark_kyber_pre_key_used: C.SignalFfiBridgeKyberPreKeyStoreMarkKyberPreKeyUsed(C.signal_mark_kyber_pre_key_used_callback),
|
||||
destroy: C.SignalFfiBridgeKyberPreKeyStoreDestroy(C.signal_destroy_kyber_pre_key_store_callback),
|
||||
load_kyber_pre_key: C.SignalFfiKyberPreKeyStoreLoadKyberPreKey(C.signal_load_kyber_pre_key_callback),
|
||||
store_kyber_pre_key: C.SignalFfiKyberPreKeyStoreStoreKyberPreKey(C.signal_store_kyber_pre_key_callback),
|
||||
mark_kyber_pre_key_used: C.SignalFfiKyberPreKeyStoreMarkKyberPreKeyUsed(C.signal_mark_kyber_pre_key_used_callback),
|
||||
destroy: C.SignalFfiKyberPreKeyStoreDestroy(C.signal_destroy_kyber_pre_key_store_callback),
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ffaa9f0435569d6775d8be636f268f882ed67ce3
|
||||
Subproject commit 38428a7bb70509910d72b3f78208c1daf33774d8
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -19,8 +19,9 @@ package libsignalgo
|
|||
/*
|
||||
#include <./libsignal-ffi.h>
|
||||
|
||||
extern void signal_log_callback(void *ctx, SignalLogLevel level, char *file, uint32_t line, char *message);
|
||||
extern void signal_log_callback(void *ctx, SignalLogLevel level, SignalCStringPtr file, uint32_t line, SignalCStringPtr message);
|
||||
extern void signal_log_flush_callback(void *ctx);
|
||||
extern void signal_log_destroy_callback(void *ctx);
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
|
|
@ -31,7 +32,7 @@ import (
|
|||
var ffiLogger Logger
|
||||
|
||||
//export signal_log_callback
|
||||
func signal_log_callback(ctx unsafe.Pointer, level C.SignalLogLevel, file *C.char, line C.uint32_t, message *C.char) {
|
||||
func signal_log_callback(ctx unsafe.Pointer, level C.SignalLogLevel, file C.SignalCStringPtr, line C.uint32_t, message C.SignalCStringPtr) {
|
||||
ffiLogger.Log(LogLevel(int(level)), C.GoString(file), uint(line), C.GoString(message))
|
||||
}
|
||||
|
||||
|
|
@ -40,6 +41,11 @@ func signal_log_flush_callback(ctx unsafe.Pointer) {
|
|||
ffiLogger.Flush()
|
||||
}
|
||||
|
||||
//export signal_log_destroy_callback
|
||||
func signal_log_destroy_callback(ctx unsafe.Pointer) {
|
||||
ffiLogger.Destroy()
|
||||
}
|
||||
|
||||
type LogLevel int
|
||||
|
||||
const (
|
||||
|
|
@ -53,12 +59,14 @@ const (
|
|||
type Logger interface {
|
||||
Log(level LogLevel, file string, line uint, message string)
|
||||
Flush()
|
||||
Destroy()
|
||||
}
|
||||
|
||||
func InitLogger(level LogLevel, logger Logger) {
|
||||
ffiLogger = logger
|
||||
C.signal_init_logger(C.SignalLogLevel(level), C.SignalFfiLogger{
|
||||
log: C.SignalLogCallback(C.signal_log_callback),
|
||||
flush: C.SignalLogFlushCallback(C.signal_log_flush_callback),
|
||||
C.signal_init_logger(C.SignalLogLevel(level), C.SignalFfiLoggerStruct{
|
||||
log: C.SignalFfiLoggerLog(C.signal_log_callback),
|
||||
flush: C.SignalFfiLoggerFlush(C.signal_log_flush_callback),
|
||||
destroy: C.SignalFfiLoggerDestroy(C.signal_log_destroy_callback),
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func Encrypt(ctx context.Context, plaintext []byte, forAddress *Address, sessionStore SessionStore, identityKeyStore IdentityKeyStore) (*CiphertextMessage, error) {
|
||||
func Encrypt(ctx context.Context, plaintext []byte, forAddress, localAddress *Address, sessionStore SessionStore, identityKeyStore IdentityKeyStore) (*CiphertextMessage, error) {
|
||||
var ciphertextMessage C.SignalMutPointerCiphertextMessage
|
||||
var now C.uint64_t = C.uint64_t(time.Now().Unix())
|
||||
callbackCtx := NewCallbackContext(ctx)
|
||||
|
|
@ -36,6 +36,7 @@ func Encrypt(ctx context.Context, plaintext []byte, forAddress *Address, session
|
|||
&ciphertextMessage,
|
||||
BytesToBuffer(plaintext),
|
||||
forAddress.constPtr(),
|
||||
localAddress.constPtr(),
|
||||
callbackCtx.wrapSessionStore(sessionStore),
|
||||
callbackCtx.wrapIdentityKeyStore(identityKeyStore),
|
||||
now,
|
||||
|
|
@ -48,7 +49,7 @@ func Encrypt(ctx context.Context, plaintext []byte, forAddress *Address, session
|
|||
return wrapCiphertextMessage(ciphertextMessage.raw), nil
|
||||
}
|
||||
|
||||
func Decrypt(ctx context.Context, message *Message, fromAddress *Address, sessionStore SessionStore, identityStore IdentityKeyStore) ([]byte, error) {
|
||||
func Decrypt(ctx context.Context, message *Message, fromAddress, localAddress *Address, sessionStore SessionStore, identityStore IdentityKeyStore) ([]byte, error) {
|
||||
callbackCtx := NewCallbackContext(ctx)
|
||||
defer callbackCtx.Unref()
|
||||
var decrypted C.SignalOwnedBuffer = C.SignalOwnedBuffer{}
|
||||
|
|
@ -56,6 +57,7 @@ func Decrypt(ctx context.Context, message *Message, fromAddress *Address, sessio
|
|||
&decrypted,
|
||||
message.constPtr(),
|
||||
fromAddress.constPtr(),
|
||||
localAddress.constPtr(),
|
||||
callbackCtx.wrapSessionStore(sessionStore),
|
||||
callbackCtx.wrapIdentityKeyStore(identityStore),
|
||||
)
|
||||
|
|
@ -154,22 +156,3 @@ func (m *Message) GetCounter() (uint32, error) {
|
|||
}
|
||||
return uint32(counter), nil
|
||||
}
|
||||
|
||||
func (m *Message) VerifyMAC(sender, receiver *PublicKey, macKey []byte) (bool, error) {
|
||||
var result C.bool
|
||||
signalFfiError := C.signal_message_verify_mac(
|
||||
&result,
|
||||
m.constPtr(),
|
||||
sender.constPtr(),
|
||||
receiver.constPtr(),
|
||||
BytesToBuffer(macKey),
|
||||
)
|
||||
runtime.KeepAlive(m)
|
||||
runtime.KeepAlive(sender)
|
||||
runtime.KeepAlive(receiver)
|
||||
runtime.KeepAlive(macKey)
|
||||
if signalFfiError != nil {
|
||||
return false, wrapError(signalFfiError)
|
||||
}
|
||||
return bool(result), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ import (
|
|||
"runtime"
|
||||
)
|
||||
|
||||
func DecryptPreKey(ctx context.Context, preKeyMessage *PreKeyMessage, fromAddress *Address, sessionStore SessionStore, identityStore IdentityKeyStore, preKeyStore PreKeyStore, signedPreKeyStore SignedPreKeyStore, kyberPreKeyStore KyberPreKeyStore) ([]byte, error) {
|
||||
func DecryptPreKey(ctx context.Context, preKeyMessage *PreKeyMessage, fromAddress, localAddress *Address, sessionStore SessionStore, identityStore IdentityKeyStore, preKeyStore PreKeyStore, signedPreKeyStore SignedPreKeyStore, kyberPreKeyStore KyberPreKeyStore) ([]byte, error) {
|
||||
callbackCtx := NewCallbackContext(ctx)
|
||||
defer callbackCtx.Unref()
|
||||
var decrypted C.SignalOwnedBuffer = C.SignalOwnedBuffer{}
|
||||
|
|
@ -34,6 +34,7 @@ func DecryptPreKey(ctx context.Context, preKeyMessage *PreKeyMessage, fromAddres
|
|||
&decrypted,
|
||||
preKeyMessage.constPtr(),
|
||||
fromAddress.constPtr(),
|
||||
localAddress.constPtr(),
|
||||
callbackCtx.wrapSessionStore(sessionStore),
|
||||
callbackCtx.wrapIdentityKeyStore(identityStore),
|
||||
callbackCtx.wrapPreKeyStore(preKeyStore),
|
||||
|
|
|
|||
|
|
@ -27,13 +27,14 @@ import (
|
|||
"time"
|
||||
)
|
||||
|
||||
func ProcessPreKeyBundle(ctx context.Context, bundle *PreKeyBundle, forAddress *Address, sessionStore SessionStore, identityStore IdentityKeyStore) error {
|
||||
func ProcessPreKeyBundle(ctx context.Context, bundle *PreKeyBundle, forAddress, localAddress *Address, sessionStore SessionStore, identityStore IdentityKeyStore) error {
|
||||
callbackCtx := NewCallbackContext(ctx)
|
||||
defer callbackCtx.Unref()
|
||||
var now C.uint64_t = C.uint64_t(time.Now().Unix())
|
||||
signalFfiError := C.signal_process_prekey_bundle(
|
||||
bundle.constPtr(),
|
||||
forAddress.constPtr(),
|
||||
localAddress.constPtr(),
|
||||
callbackCtx.wrapSessionStore(sessionStore),
|
||||
callbackCtx.wrapIdentityKeyStore(identityStore),
|
||||
now,
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ func signal_destroy_pre_key_store_callback(storeCtx unsafe.Pointer) {
|
|||
func (ctx *CallbackContext) wrapPreKeyStore(store PreKeyStore) C.SignalConstPointerFfiPreKeyStoreStruct {
|
||||
return C.SignalConstPointerFfiPreKeyStoreStruct{&C.SignalPreKeyStore{
|
||||
ctx: wrapStore(ctx, store),
|
||||
load_pre_key: C.SignalFfiBridgePreKeyStoreLoadPreKey(C.signal_load_pre_key_callback),
|
||||
store_pre_key: C.SignalFfiBridgePreKeyStoreStorePreKey(C.signal_store_pre_key_callback),
|
||||
remove_pre_key: C.SignalFfiBridgePreKeyStoreRemovePreKey(C.signal_remove_pre_key_callback),
|
||||
destroy: C.SignalFfiBridgePreKeyStoreDestroy(C.signal_destroy_pre_key_store_callback),
|
||||
load_pre_key: C.SignalFfiPreKeyStoreLoadPreKey(C.signal_load_pre_key_callback),
|
||||
store_pre_key: C.SignalFfiPreKeyStoreStorePreKey(C.signal_store_pre_key_callback),
|
||||
remove_pre_key: C.SignalFfiPreKeyStoreRemovePreKey(C.signal_remove_pre_key_callback),
|
||||
destroy: C.SignalFfiPreKeyStoreDestroy(C.signal_destroy_pre_key_store_callback),
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,8 +44,17 @@ func NewSealedSenderAddress(e164 string, uuid uuid.UUID, deviceID uint32) *Seale
|
|||
}
|
||||
}
|
||||
|
||||
func SealedSenderEncryptPlaintext(ctx context.Context, message []byte, contentHint UnidentifiedSenderMessageContentHint, forAddress *Address, fromSenderCert *SenderCertificate, sessionStore SessionStore, identityStore IdentityKeyStore, groupID *GroupIdentifier) ([]byte, error) {
|
||||
ciphertextMessage, err := Encrypt(ctx, message, forAddress, sessionStore, identityStore)
|
||||
func SealedSenderEncryptPlaintext(
|
||||
ctx context.Context,
|
||||
message []byte,
|
||||
contentHint UnidentifiedSenderMessageContentHint,
|
||||
forAddress, localAddress *Address,
|
||||
fromSenderCert *SenderCertificate,
|
||||
sessionStore SessionStore,
|
||||
identityStore IdentityKeyStore,
|
||||
groupID *GroupIdentifier,
|
||||
) ([]byte, error) {
|
||||
ciphertextMessage, err := Encrypt(ctx, message, forAddress, localAddress, sessionStore, identityStore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ func (sc *SenderCertificate) GetSignature() ([]byte, error) {
|
|||
}
|
||||
|
||||
func (sc *SenderCertificate) GetSenderUUID() (uuid.UUID, error) {
|
||||
var rawUUID *C.char
|
||||
var rawUUID C.SignalCStringPtr
|
||||
signalFfiError := C.signal_sender_certificate_get_sender_uuid(&rawUUID, sc.constPtr())
|
||||
runtime.KeepAlive(sc)
|
||||
if signalFfiError != nil {
|
||||
|
|
@ -145,7 +145,7 @@ func (sc *SenderCertificate) GetSenderUUID() (uuid.UUID, error) {
|
|||
}
|
||||
|
||||
func (sc *SenderCertificate) GetSenderE164() (string, error) {
|
||||
var e164 *C.char
|
||||
var e164 C.SignalCStringPtr
|
||||
signalFfiError := C.signal_sender_certificate_get_sender_e164(&e164, sc.constPtr())
|
||||
runtime.KeepAlive(sc)
|
||||
if signalFfiError != nil {
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ func signal_destroy_sender_key_store_callback(storeCtx unsafe.Pointer) {
|
|||
func (ctx *CallbackContext) wrapSenderKeyStore(store SenderKeyStore) C.SignalConstPointerFfiSenderKeyStoreStruct {
|
||||
return C.SignalConstPointerFfiSenderKeyStoreStruct{&C.SignalSenderKeyStore{
|
||||
ctx: wrapStore(ctx, store),
|
||||
load_sender_key: C.SignalFfiBridgeSenderKeyStoreLoadSenderKey(C.signal_load_sender_key_callback),
|
||||
store_sender_key: C.SignalFfiBridgeSenderKeyStoreStoreSenderKey(C.signal_store_sender_key_callback),
|
||||
destroy: C.SignalFfiBridgeSenderKeyStoreDestroy(C.signal_destroy_sender_key_store_callback),
|
||||
load_sender_key: C.SignalFfiSenderKeyStoreLoadSenderKey(C.signal_load_sender_key_callback),
|
||||
store_sender_key: C.SignalFfiSenderKeyStoreStoreSenderKey(C.signal_store_sender_key_callback),
|
||||
destroy: C.SignalFfiSenderKeyStoreDestroy(C.signal_destroy_sender_key_store_callback),
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import (
|
|||
"go.mau.fi/mautrix-signal/pkg/libsignalgo"
|
||||
)
|
||||
|
||||
func initializeSessions(t *testing.T, aliceStore, bobStore *InMemorySignalProtocolStore, bobAddress *libsignalgo.Address) {
|
||||
func initializeSessions(t *testing.T, aliceStore, bobStore *InMemorySignalProtocolStore, bobAddress, aliceAddress *libsignalgo.Address) {
|
||||
ctx := context.TODO()
|
||||
|
||||
bobPreKey, err := libsignalgo.GeneratePrivateKey()
|
||||
|
|
@ -86,7 +86,7 @@ func initializeSessions(t *testing.T, aliceStore, bobStore *InMemorySignalProtoc
|
|||
assert.NoError(t, err)
|
||||
|
||||
// Alice processes the bundle
|
||||
err = libsignalgo.ProcessPreKeyBundle(ctx, bobBundle, bobAddress, aliceStore, aliceStore)
|
||||
err = libsignalgo.ProcessPreKeyBundle(ctx, bobBundle, bobAddress, aliceAddress, aliceStore, aliceStore)
|
||||
assert.NoError(t, err)
|
||||
|
||||
record, err := aliceStore.LoadSession(ctx, bobAddress)
|
||||
|
|
@ -132,11 +132,11 @@ func TestSessionCipher(t *testing.T) {
|
|||
aliceStore := NewInMemorySignalProtocolStore()
|
||||
bobStore := NewInMemorySignalProtocolStore()
|
||||
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress)
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress, aliceAddress)
|
||||
|
||||
alicePlaintext := []byte{8, 6, 7, 5, 3, 0, 9}
|
||||
|
||||
aliceCiphertext, err := libsignalgo.Encrypt(ctx, alicePlaintext, bobAddress, aliceStore, aliceStore)
|
||||
aliceCiphertext, err := libsignalgo.Encrypt(ctx, alicePlaintext, bobAddress, aliceAddress, aliceStore, aliceStore)
|
||||
assert.NoError(t, err)
|
||||
aliceCiphertextMessageType, err := aliceCiphertext.MessageType()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -147,13 +147,13 @@ func TestSessionCipher(t *testing.T) {
|
|||
bobCiphertext, err := libsignalgo.DeserializePreKeyMessage(aliceCiphertextSerialized)
|
||||
assert.NoError(t, err)
|
||||
|
||||
bobPlaintext, err := libsignalgo.DecryptPreKey(ctx, bobCiphertext, aliceAddress, bobStore, bobStore, bobStore, bobStore, bobStore)
|
||||
bobPlaintext, err := libsignalgo.DecryptPreKey(ctx, bobCiphertext, aliceAddress, bobAddress, bobStore, bobStore, bobStore, bobStore, bobStore)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, alicePlaintext, bobPlaintext)
|
||||
|
||||
bobPlaintext2 := []byte{23}
|
||||
|
||||
bobCiphertext2, err := libsignalgo.Encrypt(ctx, bobPlaintext2, aliceAddress, bobStore, bobStore)
|
||||
bobCiphertext2, err := libsignalgo.Encrypt(ctx, bobPlaintext2, aliceAddress, bobAddress, bobStore, bobStore)
|
||||
assert.NoError(t, err)
|
||||
bobCiphertext2MessageType, err := bobCiphertext2.MessageType()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -163,7 +163,7 @@ func TestSessionCipher(t *testing.T) {
|
|||
assert.NoError(t, err)
|
||||
aliceCiphertext2, err := libsignalgo.DeserializeMessage(bobCiphertext2Serialized)
|
||||
assert.NoError(t, err)
|
||||
alicePlaintext2, err := libsignalgo.Decrypt(ctx, aliceCiphertext2, bobAddress, aliceStore, aliceStore)
|
||||
alicePlaintext2, err := libsignalgo.Decrypt(ctx, aliceCiphertext2, bobAddress, aliceAddress, aliceStore, aliceStore)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, bobPlaintext2, alicePlaintext2)
|
||||
}
|
||||
|
|
@ -183,11 +183,11 @@ func TestSessionCipherWithBadStore(t *testing.T) {
|
|||
aliceStore := NewInMemorySignalProtocolStore()
|
||||
bobStore := &BadInMemorySignalProtocolStore{NewInMemorySignalProtocolStore()}
|
||||
|
||||
initializeSessions(t, aliceStore, bobStore.InMemorySignalProtocolStore, bobAddress)
|
||||
initializeSessions(t, aliceStore, bobStore.InMemorySignalProtocolStore, bobAddress, aliceAddress)
|
||||
|
||||
alicePlaintext := []byte{8, 6, 7, 5, 3, 0, 9}
|
||||
|
||||
aliceCiphertext, err := libsignalgo.Encrypt(ctx, alicePlaintext, bobAddress, aliceStore, aliceStore)
|
||||
aliceCiphertext, err := libsignalgo.Encrypt(ctx, alicePlaintext, bobAddress, aliceAddress, aliceStore, aliceStore)
|
||||
assert.NoError(t, err)
|
||||
aliceCiphertextMessageType, err := aliceCiphertext.MessageType()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -198,7 +198,7 @@ func TestSessionCipherWithBadStore(t *testing.T) {
|
|||
bobCiphertext, err := libsignalgo.DeserializePreKeyMessage(aliceCiphertextSerialized)
|
||||
assert.NoError(t, err)
|
||||
t.Skip("This test is broken") // TODO fix
|
||||
_, err = libsignalgo.DecryptPreKey(ctx, bobCiphertext, aliceAddress, bobStore, bobStore, bobStore, bobStore, bobStore)
|
||||
_, err = libsignalgo.DecryptPreKey(ctx, bobCiphertext, aliceAddress, bobAddress, bobStore, bobStore, bobStore, bobStore, bobStore)
|
||||
require.Error(t, err)
|
||||
assert.Equal(t, "Test error", err.Error())
|
||||
}
|
||||
|
|
@ -216,7 +216,7 @@ func TestSealedSenderEncrypt_Repeated(t *testing.T) {
|
|||
aliceStore := NewInMemorySignalProtocolStore()
|
||||
bobStore := NewInMemorySignalProtocolStore()
|
||||
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress)
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress, aliceAddress)
|
||||
|
||||
trustRoot, err := libsignalgo.GenerateIdentityKeyPair()
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -241,7 +241,7 @@ func TestSealedSenderEncrypt_Repeated(t *testing.T) {
|
|||
}()
|
||||
for i := 0; i < 100; i++ {
|
||||
message := []byte(fmt.Sprintf("%04d vision", i))
|
||||
ciphertext, err := libsignalgo.SealedSenderEncryptPlaintext(ctx, message, libsignalgo.UnidentifiedSenderMessageContentHintDefault, bobAddress, senderCert, aliceStore, aliceStore, nil)
|
||||
ciphertext, err := libsignalgo.SealedSenderEncryptPlaintext(ctx, message, libsignalgo.UnidentifiedSenderMessageContentHintDefault, bobAddress, aliceAddress, senderCert, aliceStore, aliceStore, nil)
|
||||
require.NoError(t, err)
|
||||
assert.NotNil(t, ciphertext)
|
||||
}
|
||||
|
|
@ -252,15 +252,18 @@ func TestArchiveSession(t *testing.T) {
|
|||
ctx := context.TODO()
|
||||
setupLogging()
|
||||
|
||||
aliceACI := uuid.New()
|
||||
bobACI := uuid.New()
|
||||
|
||||
aliceAddress, err := libsignalgo.NewACIServiceID(aliceACI).Address(1)
|
||||
assert.NoError(t, err)
|
||||
bobAddress, err := libsignalgo.NewACIServiceID(bobACI).Address(1)
|
||||
assert.NoError(t, err)
|
||||
|
||||
aliceStore := NewInMemorySignalProtocolStore()
|
||||
bobStore := NewInMemorySignalProtocolStore()
|
||||
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress)
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress, aliceAddress)
|
||||
|
||||
session, err := aliceStore.LoadSession(ctx, bobAddress)
|
||||
assert.NoError(t, err)
|
||||
|
|
@ -315,7 +318,7 @@ func TestSealedSenderGroupCipher(t *testing.T) {
|
|||
|
||||
bobStore := NewInMemorySignalProtocolStore()
|
||||
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress)
|
||||
initializeSessions(t, aliceStore, bobStore, bobAddress, aliceAddress)
|
||||
|
||||
trustRoot, err := libsignalgo.GenerateIdentityKeyPair()
|
||||
assert.NoError(t, err)
|
||||
|
|
|
|||
|
|
@ -105,6 +105,7 @@ func (sr *SessionRecord) HasCurrentState() (bool, error) {
|
|||
signalFfiError := C.signal_session_record_has_usable_sender_chain(
|
||||
&result,
|
||||
sr.constPtr(),
|
||||
C.double(0.0),
|
||||
C.uint64_t(time.Now().Unix()),
|
||||
)
|
||||
runtime.KeepAlive(sr)
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ func signal_destroy_session_store_callback(storeCtx unsafe.Pointer) {
|
|||
func (ctx *CallbackContext) wrapSessionStore(store SessionStore) C.SignalConstPointerFfiSessionStoreStruct {
|
||||
return C.SignalConstPointerFfiSessionStoreStruct{&C.SignalSessionStore{
|
||||
ctx: wrapStore(ctx, store),
|
||||
load_session: C.SignalFfiBridgeSessionStoreLoadSession(C.signal_load_session_callback),
|
||||
store_session: C.SignalFfiBridgeSessionStoreStoreSession(C.signal_store_session_callback),
|
||||
destroy: C.SignalFfiBridgeSessionStoreDestroy(C.signal_destroy_session_store_callback),
|
||||
load_session: C.SignalFfiSessionStoreLoadSession(C.signal_load_session_callback),
|
||||
store_session: C.SignalFfiSessionStoreStoreSession(C.signal_store_session_callback),
|
||||
destroy: C.SignalFfiSessionStoreDestroy(C.signal_destroy_session_store_callback),
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,6 +54,8 @@ func (FFILogger) Log(level libsignalgo.LogLevel, file string, line uint, message
|
|||
|
||||
func (FFILogger) Flush() {}
|
||||
|
||||
func (FFILogger) Destroy() {}
|
||||
|
||||
var loggingSetup = false
|
||||
|
||||
func setupLogging() {
|
||||
|
|
|
|||
|
|
@ -67,8 +67,8 @@ func signal_destroy_signed_pre_key_store_callback(storeCtx unsafe.Pointer) {
|
|||
func (ctx *CallbackContext) wrapSignedPreKeyStore(store SignedPreKeyStore) C.SignalConstPointerFfiSignedPreKeyStoreStruct {
|
||||
return C.SignalConstPointerFfiSignedPreKeyStoreStruct{&C.SignalSignedPreKeyStore{
|
||||
ctx: wrapStore(ctx, store),
|
||||
load_signed_pre_key: C.SignalFfiBridgeSignedPreKeyStoreLoadSignedPreKey(C.signal_load_signed_pre_key_callback),
|
||||
store_signed_pre_key: C.SignalFfiBridgeSignedPreKeyStoreStoreSignedPreKey(C.signal_store_signed_pre_key_callback),
|
||||
destroy: C.SignalFfiBridgeSignedPreKeyStoreDestroy(C.signal_destroy_signed_pre_key_store_callback),
|
||||
load_signed_pre_key: C.SignalFfiSignedPreKeyStoreLoadSignedPreKey(C.signal_load_signed_pre_key_callback),
|
||||
store_signed_pre_key: C.SignalFfiSignedPreKeyStoreStoreSignedPreKey(C.signal_store_signed_pre_key_callback),
|
||||
destroy: C.SignalFfiSignedPreKeyStoreDestroy(C.signal_destroy_signed_pre_key_store_callback),
|
||||
}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
package libsignalgo
|
||||
|
||||
const Version = "v0.87.5"
|
||||
const Version = "v0.96.2"
|
||||
|
|
|
|||
|
|
@ -110,21 +110,24 @@ func (mc *MessageConverter) ToSignal(
|
|||
return nil, fmt.Errorf("failed to convert sticker: %w", err)
|
||||
}
|
||||
att.Flags = proto.Uint32(uint32(signalpb.AttachmentPointer_BORDERLESS))
|
||||
var emoji *string
|
||||
// TODO check for single grapheme cluster?
|
||||
if len([]rune(content.Body)) == 1 {
|
||||
emoji = proto.String(variationselector.Remove(content.Body))
|
||||
}
|
||||
dm.Sticker = &signalpb.DataMessage_Sticker{
|
||||
// Signal iOS validates that pack id/key are of the correct length.
|
||||
// Android is fine with any non-nil values (like a zero-length byte string).
|
||||
PackId: make([]byte, 16),
|
||||
PackKey: make([]byte, 32),
|
||||
StickerId: proto.Uint32(0),
|
||||
|
||||
Data: att,
|
||||
Emoji: emoji,
|
||||
dm.Sticker = ParseStickerMeta(content.Info.BridgedSticker)
|
||||
if dm.Sticker == nil {
|
||||
var emoji *string
|
||||
// TODO check for single grapheme cluster?
|
||||
if len([]rune(content.Body)) == 1 {
|
||||
emoji = proto.String(variationselector.Remove(content.Body))
|
||||
}
|
||||
dm.Sticker = &signalpb.DataMessage_Sticker{
|
||||
// Signal iOS validates that pack id/key are of the correct length.
|
||||
// Android is fine with any non-nil values (like a zero-length byte string).
|
||||
PackId: make([]byte, 16),
|
||||
PackKey: make([]byte, 32),
|
||||
StickerId: proto.Uint32(0),
|
||||
Emoji: emoji,
|
||||
}
|
||||
}
|
||||
dm.Sticker.Data = att
|
||||
case event.MsgLocation:
|
||||
lat, lon, err := parseGeoURI(content.GeoURI)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -179,7 +179,10 @@ func (mc *MessageConverter) ToMatrix(
|
|||
if dm.Quote != nil {
|
||||
authorACI, err := signalmeow.ParseStringOrBinaryUUID(dm.Quote.GetAuthorAci(), dm.Quote.GetAuthorAciBinary())
|
||||
if err != nil {
|
||||
zerolog.Ctx(ctx).Err(err).Str("author_aci", dm.Quote.GetAuthorAci()).Msg("Failed to parse quote author ACI")
|
||||
zerolog.Ctx(ctx).Err(err).
|
||||
Str("author_aci", dm.Quote.GetAuthorAci()).
|
||||
Hex("author_aci_binary", dm.Quote.GetAuthorAciBinary()).
|
||||
Msg("Failed to parse quote author ACI")
|
||||
} else {
|
||||
cm.ReplyTo = &networkid.MessageOptionalPartID{
|
||||
MessageID: signalid.MakeMessageID(authorACI, dm.Quote.GetId()),
|
||||
|
|
@ -465,20 +468,16 @@ func (mc *MessageConverter) convertStickerToMatrix(ctx context.Context, sticker
|
|||
converted.Content.Info.Height = 200
|
||||
}
|
||||
converted.Content.Body = sticker.GetEmoji()
|
||||
if len(sticker.GetPackId()) == PackIDLength && len(sticker.GetPackKey()) == PackKeyLength && !bytes.Equal(sticker.GetPackId(), zeroPackID) {
|
||||
converted.Content.Info.BridgedSticker = &event.BridgedSticker{
|
||||
Network: StickerSourceID,
|
||||
ID: strconv.FormatUint(uint64(sticker.GetStickerId()), 10),
|
||||
Emoji: sticker.GetEmoji(),
|
||||
PackURL: fmt.Sprintf(PackURLFormat, sticker.GetPackId(), sticker.GetPackKey()),
|
||||
}
|
||||
}
|
||||
converted.Type = event.EventSticker
|
||||
converted.Content.MsgType = ""
|
||||
if converted.Extra == nil {
|
||||
converted.Extra = map[string]any{}
|
||||
}
|
||||
// TODO fetch full pack metadata like the old bridge did?
|
||||
converted.Extra["fi.mau.signal.sticker"] = map[string]any{
|
||||
"id": sticker.GetStickerId(),
|
||||
"emoji": sticker.GetEmoji(),
|
||||
"pack": map[string]any{
|
||||
"id": sticker.GetPackId(),
|
||||
"key": sticker.GetPackKey(),
|
||||
},
|
||||
}
|
||||
return converted
|
||||
}
|
||||
|
||||
|
|
|
|||
199
pkg/msgconv/imagepack.go
Normal file
199
pkg/msgconv/imagepack.go
Normal file
|
|
@ -0,0 +1,199 @@
|
|||
// mautrix-signal - A Matrix-Signal puppeting bridge.
|
||||
// Copyright (C) 2026 Tulir Asokan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package msgconv
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"go.mau.fi/util/emojishortcodes"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"maunium.net/go/mautrix"
|
||||
"maunium.net/go/mautrix/bridgev2"
|
||||
"maunium.net/go/mautrix/bridgev2/database"
|
||||
"maunium.net/go/mautrix/event"
|
||||
"maunium.net/go/mautrix/id"
|
||||
|
||||
"go.mau.fi/mautrix-signal/pkg/signalid"
|
||||
"go.mau.fi/mautrix-signal/pkg/signalmeow"
|
||||
signalpb "go.mau.fi/mautrix-signal/pkg/signalmeow/protobuf"
|
||||
)
|
||||
|
||||
const StickerSourceID = "signal"
|
||||
const PackURLFormat = "https://signal.art/addstickers/#pack_id=%x&pack_key=%x"
|
||||
|
||||
const PackIDLength = 16
|
||||
const PackKeyLength = 32
|
||||
const PackURLLength = len(PackURLFormat) - len("%x")*2 + PackIDLength*2 + PackKeyLength*2
|
||||
|
||||
var zeroPackID = make([]byte, PackIDLength)
|
||||
|
||||
func ParseStickerMeta(info *event.BridgedSticker) *signalpb.DataMessage_Sticker {
|
||||
if info == nil || info.Network != StickerSourceID || len(info.PackURL) != PackURLLength {
|
||||
return nil
|
||||
}
|
||||
stickerID, err := strconv.ParseUint(info.ID, 10, 32)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
packID, packKey, err := parsePackURL(info.PackURL)
|
||||
if err != nil || len(packID) != PackIDLength || len(packKey) != PackKeyLength || bytes.Equal(packID, zeroPackID) {
|
||||
return nil
|
||||
}
|
||||
return &signalpb.DataMessage_Sticker{
|
||||
PackId: packID,
|
||||
PackKey: packKey,
|
||||
StickerId: proto.Uint32(uint32(stickerID)),
|
||||
Emoji: &info.Emoji,
|
||||
}
|
||||
}
|
||||
|
||||
func parsePackURL(rawURL string) (packID, packKey []byte, err error) {
|
||||
parsed, err := url.Parse(rawURL)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("invalid URL: %w", err)
|
||||
} else if parsed.Host != "signal.art" || !strings.HasPrefix(parsed.Path, "/addstickers") {
|
||||
return nil, nil, fmt.Errorf("invalid host or path in URL")
|
||||
}
|
||||
q, err := url.ParseQuery(parsed.Fragment)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("invalid URL fragment: %w", err)
|
||||
}
|
||||
packID, err = hex.DecodeString(q.Get("pack_id"))
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("invalid pack ID in URL: %w", err)
|
||||
}
|
||||
packKey, err = hex.DecodeString(q.Get("pack_key"))
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("invalid pack key in URL: %w", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (mc *MessageConverter) DownloadImagePack(ctx context.Context, url string) (*bridgev2.ImportedImagePack, error) {
|
||||
packID, packKey, err := parsePackURL(url)
|
||||
if err != nil {
|
||||
return nil, bridgev2.WrapRespErr(err, mautrix.MNotFound)
|
||||
}
|
||||
manifest, err := signalmeow.DownloadStickerPackManifest(ctx, packID, packKey)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to download sticker pack manifest: %w", err)
|
||||
}
|
||||
topLevelExtra := map[string]any{
|
||||
"fi.mau.signal.stickerpack": map[string]any{
|
||||
"pack_id": hex.EncodeToString(packID),
|
||||
"pack_key": hex.EncodeToString(packKey),
|
||||
},
|
||||
}
|
||||
content := &event.ImagePackEventContent{
|
||||
Images: make(map[string]*event.ImagePackImage, len(manifest.Stickers)),
|
||||
Metadata: event.ImagePackMetadata{
|
||||
DisplayName: manifest.GetTitle(),
|
||||
AvatarURL: "",
|
||||
Usage: []event.ImagePackUsage{event.ImagePackUsageSticker},
|
||||
Attribution: manifest.GetAuthor(),
|
||||
BridgedPack: &event.BridgedStickerPack{
|
||||
Network: StickerSourceID,
|
||||
URL: fmt.Sprintf(PackURLFormat, packID, packKey),
|
||||
},
|
||||
},
|
||||
}
|
||||
imagesByID := make(map[uint32]id.ContentURIString, len(manifest.Stickers))
|
||||
uploadImage := func(sticker *signalpb.Pack_Sticker) (id.ContentURIString, error) {
|
||||
stickerID := sticker.GetId()
|
||||
existing, ok := imagesByID[stickerID]
|
||||
if ok {
|
||||
return existing, nil
|
||||
}
|
||||
var mxc id.ContentURIString
|
||||
if mc.DirectMedia {
|
||||
mediaID, err := signalid.DirectMediaSticker{
|
||||
PackID: packID,
|
||||
PackKey: packKey,
|
||||
StickerID: stickerID,
|
||||
}.AsMediaID()
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to create media ID for sticker %d: %w", stickerID, err)
|
||||
}
|
||||
mxc, err = mc.Bridge.Matrix.GenerateContentURI(ctx, mediaID)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to generate content URI for sticker %d: %w", stickerID, err)
|
||||
}
|
||||
} else {
|
||||
dbKey := database.Key(fmt.Sprintf("stickercache:%x:%d", packID, stickerID))
|
||||
if cached := mc.Bridge.DB.KV.Get(ctx, dbKey); cached != "" {
|
||||
mxc = id.ContentURIString(cached)
|
||||
imagesByID[stickerID] = mxc
|
||||
return mxc, nil
|
||||
}
|
||||
data, err := signalmeow.DownloadStickerPackItem(ctx, packID, packKey, stickerID)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to download sticker %d: %w", stickerID, err)
|
||||
}
|
||||
mxc, _, err = mc.Bridge.Bot.UploadMedia(ctx, "", data, "", sticker.GetContentType())
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("failed to upload sticker %d: %w", stickerID, err)
|
||||
}
|
||||
mc.Bridge.DB.KV.Set(ctx, dbKey, string(mxc))
|
||||
}
|
||||
imagesByID[stickerID] = mxc
|
||||
return mxc, nil
|
||||
}
|
||||
for _, sticker := range manifest.Stickers {
|
||||
mxc, err := uploadImage(sticker)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
shortcode := emojishortcodes.Get(sticker.GetEmoji())
|
||||
realShortcode := shortcode
|
||||
i := 2
|
||||
for _, alreadyExists := content.Images[realShortcode]; alreadyExists; i++ {
|
||||
realShortcode = fmt.Sprintf("%s_%d", shortcode, i)
|
||||
}
|
||||
content.Images[realShortcode] = &event.ImagePackImage{
|
||||
URL: mxc,
|
||||
Body: sticker.GetEmoji(),
|
||||
Info: &event.FileInfo{
|
||||
MimeType: sticker.GetContentType(),
|
||||
Width: 200,
|
||||
Height: 200,
|
||||
BridgedSticker: &event.BridgedSticker{
|
||||
Network: StickerSourceID,
|
||||
ID: strconv.FormatUint(uint64(sticker.GetId()), 10),
|
||||
Emoji: sticker.GetEmoji(),
|
||||
PackURL: content.Metadata.BridgedPack.URL,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
if manifest.Cover != nil {
|
||||
content.Metadata.AvatarURL, err = uploadImage(manifest.Cover)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to upload sticker pack cover: %w", err)
|
||||
}
|
||||
}
|
||||
return &bridgev2.ImportedImagePack{
|
||||
Content: content,
|
||||
Extra: topLevelExtra,
|
||||
Shortcode: hex.EncodeToString(packID),
|
||||
}, nil
|
||||
}
|
||||
|
|
@ -34,6 +34,7 @@ const (
|
|||
directMediaTypeGroupAvatar directMediaType = 1
|
||||
directMediaTypeProfileAvatar directMediaType = 2
|
||||
directMediaTypePlaintextDigestAttachment directMediaType = 3
|
||||
directMediaTypeSticker directMediaType = 4
|
||||
)
|
||||
|
||||
type DirectMediaInfo interface {
|
||||
|
|
@ -44,6 +45,7 @@ var (
|
|||
_ DirectMediaInfo = (*DirectMediaAttachment)(nil)
|
||||
_ DirectMediaInfo = (*DirectMediaGroupAvatar)(nil)
|
||||
_ DirectMediaInfo = (*DirectMediaProfileAvatar)(nil)
|
||||
_ DirectMediaInfo = (*DirectMediaSticker)(nil)
|
||||
)
|
||||
|
||||
type DirectMediaAttachment struct {
|
||||
|
|
@ -127,6 +129,30 @@ func (m DirectMediaProfileAvatar) AsMediaID() (mediaID networkid.MediaID, err er
|
|||
return networkid.MediaID(buf.Bytes()), nil
|
||||
}
|
||||
|
||||
type DirectMediaSticker struct {
|
||||
PackID []byte
|
||||
PackKey []byte
|
||||
StickerID uint32
|
||||
}
|
||||
|
||||
const packIDLen = 16
|
||||
const packKeyLen = 32
|
||||
const directMediaStickerLen = 1 + packIDLen + packKeyLen + 4
|
||||
|
||||
func (m DirectMediaSticker) AsMediaID() (mediaID networkid.MediaID, err error) {
|
||||
if len(m.PackID) != packIDLen {
|
||||
return nil, fmt.Errorf("invalid pack ID length: %d", len(m.PackID))
|
||||
} else if len(m.PackKey) != packKeyLen {
|
||||
return nil, fmt.Errorf("invalid pack key length: %d", len(m.PackKey))
|
||||
}
|
||||
mediaID = make(networkid.MediaID, directMediaStickerLen)
|
||||
mediaID[0] = byte(directMediaTypeSticker)
|
||||
copy(mediaID[1:], m.PackID)
|
||||
copy(mediaID[1+packIDLen:], m.PackKey)
|
||||
binary.BigEndian.PutUint32(mediaID[1+packIDLen+packKeyLen:], m.StickerID)
|
||||
return mediaID, nil
|
||||
}
|
||||
|
||||
func ParseDirectMediaInfo(mediaID networkid.MediaID) (_ DirectMediaInfo, err error) {
|
||||
mediaIDLen := len(mediaID)
|
||||
if mediaIDLen == 0 {
|
||||
|
|
@ -200,6 +226,15 @@ func ParseDirectMediaInfo(mediaID networkid.MediaID) (_ DirectMediaInfo, err err
|
|||
info.ProfileAvatarPath = string(profileAvatarPath)
|
||||
}
|
||||
return &info, nil
|
||||
case directMediaTypeSticker:
|
||||
var info DirectMediaSticker
|
||||
if len(mediaID) != directMediaStickerLen {
|
||||
return info, fmt.Errorf("invalid media ID length for sticker: %d", len(mediaID))
|
||||
}
|
||||
info.PackID = mediaID[1 : 1+packIDLen]
|
||||
info.PackKey = mediaID[1+packIDLen : 1+packIDLen+packKeyLen]
|
||||
info.StickerID = binary.BigEndian.Uint32(mediaID[1+packIDLen+packKeyLen:])
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("invalid direct media type %d", mediaType)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ import (
|
|||
|
||||
"github.com/rs/zerolog"
|
||||
"go.mau.fi/util/fallocate"
|
||||
"go.mau.fi/util/pkcs7"
|
||||
"go.mau.fi/util/random"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
|
|
@ -93,9 +94,15 @@ func DownloadAttachment(
|
|||
|
||||
var body []byte
|
||||
var downloadedSize int64
|
||||
if into == nil || resp.StatusCode > 400 {
|
||||
body = make([]byte, resp.ContentLength)
|
||||
_, err = io.ReadFull(resp.Body, body)
|
||||
if resp.StatusCode > 400 {
|
||||
body, err = io.ReadAll(io.LimitReader(resp.Body, 4096))
|
||||
} else if into == nil {
|
||||
if resp.ContentLength > 0 {
|
||||
body = make([]byte, resp.ContentLength)
|
||||
_, err = io.ReadFull(resp.Body, body)
|
||||
} else {
|
||||
body, err = io.ReadAll(http.MaxBytesReader(nil, resp.Body, max(int64(size), 32*1024)*2))
|
||||
}
|
||||
} else {
|
||||
err = fallocate.Fallocate(into, int(resp.ContentLength))
|
||||
if err != nil {
|
||||
|
|
@ -130,6 +137,15 @@ func DownloadAttachment(
|
|||
const MACLength = 32
|
||||
const IVLength = 16
|
||||
|
||||
func macAndAESDecrypt(body, key []byte) ([]byte, error) {
|
||||
l := len(body) - MACLength
|
||||
if !verifyMAC(key[MACLength:], body[:l], body[l:]) {
|
||||
return nil, ErrInvalidMACForAttachment
|
||||
}
|
||||
|
||||
return aesDecrypt(key[:MACLength], body[:l])
|
||||
}
|
||||
|
||||
func decryptAttachment(body, key, digest []byte, plaintextDigest bool, size uint32) ([]byte, error) {
|
||||
if !plaintextDigest {
|
||||
hash := sha256.Sum256(body)
|
||||
|
|
@ -137,12 +153,7 @@ func decryptAttachment(body, key, digest []byte, plaintextDigest bool, size uint
|
|||
return nil, ErrInvalidDigestForAttachment
|
||||
}
|
||||
}
|
||||
l := len(body) - MACLength
|
||||
if !verifyMAC(key[MACLength:], body[:l], body[l:]) {
|
||||
return nil, ErrInvalidMACForAttachment
|
||||
}
|
||||
|
||||
decrypted, err := aesDecrypt(key[:MACLength], body[:l])
|
||||
decrypted, err := macAndAESDecrypt(body, key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
|
@ -234,6 +245,14 @@ func extend(data []byte, paddedLen int) []byte {
|
|||
}
|
||||
}
|
||||
|
||||
func macAndAESEncrypt(keys, plaintext []byte) ([]byte, error) {
|
||||
encrypted, err := aesEncrypt(keys[:32], plaintext)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return appendMAC(keys[32:], encrypted), nil
|
||||
}
|
||||
|
||||
func (cli *Client) UploadAttachment(ctx context.Context, body []byte) (*signalpb.AttachmentPointer, error) {
|
||||
log := zerolog.Ctx(ctx).With().Str("func", "upload attachment").Logger()
|
||||
keys := random.Bytes(64) // combined AES and MAC keys
|
||||
|
|
@ -249,11 +268,10 @@ func (cli *Client) UploadAttachment(ctx context.Context, body []byte) (*signalpb
|
|||
}
|
||||
body = extend(body, paddedLen)
|
||||
|
||||
encrypted, err := aesEncrypt(keys[:32], body)
|
||||
encryptedWithMAC, err := macAndAESEncrypt(keys, body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
encryptedWithMAC := appendMAC(keys[32:], encrypted)
|
||||
|
||||
// Get upload attributes from Signal server
|
||||
attributesPath := "/v4/attachments/form/upload"
|
||||
|
|
@ -363,12 +381,17 @@ func (cli *Client) uploadAttachmentTUS(
|
|||
return nil
|
||||
}
|
||||
|
||||
func (cli *Client) UploadGroupAvatar(ctx context.Context, avatarBytes []byte, gid types.GroupIdentifier) (string, error) {
|
||||
func (cli *Client) UploadGroupAvatar(ctx context.Context, avatarBytes []byte, gid types.GroupIdentifier, groupMasterKey types.SerializedGroupMasterKey) (string, error) {
|
||||
log := zerolog.Ctx(ctx)
|
||||
groupMasterKey, err := cli.Store.GroupStore.MasterKeyFromGroupIdentifier(ctx, gid)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Could not get master key from group id")
|
||||
return "", err
|
||||
if groupMasterKey == "" {
|
||||
var err error
|
||||
groupMasterKey, err = cli.Store.GroupStore.MasterKeyFromGroupIdentifier(ctx, gid)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Could not get master key from group id")
|
||||
return "", err
|
||||
} else if groupMasterKey == "" {
|
||||
return "", fmt.Errorf("no master key found for group %s", gid)
|
||||
}
|
||||
}
|
||||
groupAuth, err := cli.GetAuthorizationForToday(ctx, masterKeyToBytes(groupMasterKey))
|
||||
if err != nil {
|
||||
|
|
@ -456,13 +479,10 @@ func aesDecrypt(key, ciphertext []byte) ([]byte, error) {
|
|||
}
|
||||
|
||||
iv := ciphertext[:IVLength]
|
||||
ciphertext = ciphertext[IVLength:]
|
||||
mode := cipher.NewCBCDecrypter(block, iv)
|
||||
mode.CryptBlocks(ciphertext, ciphertext)
|
||||
pad := ciphertext[len(ciphertext)-1]
|
||||
if pad > aes.BlockSize {
|
||||
return nil, fmt.Errorf("pad value (%d) larger than AES blocksize (%d)", pad, aes.BlockSize)
|
||||
}
|
||||
return ciphertext[aes.BlockSize : len(ciphertext)-int(pad)], nil
|
||||
return pkcs7.Unpad(ciphertext)
|
||||
}
|
||||
|
||||
func aesDecryptFile(key []byte, file *os.File, downloadedSize int64) (int64, error) {
|
||||
|
|
@ -522,14 +542,11 @@ func aesEncrypt(key, plaintext []byte) ([]byte, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
pad := aes.BlockSize - len(plaintext)%aes.BlockSize
|
||||
plaintext = append(plaintext, bytes.Repeat([]byte{byte(pad)}, pad)...)
|
||||
|
||||
ciphertext := make([]byte, len(plaintext))
|
||||
plaintext = pkcs7.Pad(plaintext, aes.BlockSize)
|
||||
iv := random.Bytes(16)
|
||||
|
||||
mode := cipher.NewCBCEncrypter(block, iv)
|
||||
mode.CryptBlocks(ciphertext, plaintext)
|
||||
mode.CryptBlocks(plaintext, plaintext)
|
||||
|
||||
return append(iv, ciphertext...), nil
|
||||
return append(iv, plaintext...), nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,7 +282,11 @@ func (cli *Client) WaitForTransfer(ctx context.Context) (*TransferArchiveMetadat
|
|||
}
|
||||
reqDuration := time.Since(reqStart)
|
||||
if reqDuration < reqTimeout-10*time.Second {
|
||||
time.Sleep(15 * time.Second)
|
||||
select {
|
||||
case <-time.After(15 * time.Second):
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,12 +35,14 @@ import (
|
|||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"go.mau.fi/mautrix-signal/pkg/libsignalgo"
|
||||
signalpb "go.mau.fi/mautrix-signal/pkg/signalmeow/protobuf"
|
||||
"go.mau.fi/mautrix-signal/pkg/signalmeow/protobuf/cds2pb"
|
||||
"go.mau.fi/mautrix-signal/pkg/signalmeow/web"
|
||||
)
|
||||
|
||||
// ProdContactDiscoveryMrenclave should always match ENCLAVE_ID_CDSI_PROD from libsignal
|
||||
// https://github.com/signalapp/libsignal/blob/main/rust/attest/src/constants.rs#L69
|
||||
const ProdContactDiscoveryMrenclave = "15637fa1e54fe655176d3df1a9f94b87c01ed377acaa570682dc5d72c95ef07b"
|
||||
const ProdContactDiscoveryServer = "cdsi.signal.org"
|
||||
const ProdContactDiscoveryMrenclave = "ee9503070127120074612b6688e593b67e486b1541449f54d71e387484eb40a3"
|
||||
const ContactDiscoveryAuthTTL = 23 * time.Hour
|
||||
|
||||
const rateLimitCloseCode = websocket.StatusCode(4008)
|
||||
|
|
@ -81,7 +83,7 @@ func (cli *Client) LookupPhone(ctx context.Context, e164s ...uint64) (ContactDis
|
|||
}
|
||||
ctx, cancel := context.WithTimeout(ctx, 20*time.Second)
|
||||
defer cancel()
|
||||
resp, token, err := cli.doContactDiscovery(ctx, &signalpb.CDSClientRequest{
|
||||
resp, token, err := cli.doContactDiscovery(ctx, &cds2pb.ClientRequest{
|
||||
// TODO figure out if tokens are useful
|
||||
// (it's meant for old_e164s)
|
||||
//Token: cli.cdToken,
|
||||
|
|
@ -93,7 +95,7 @@ func (cli *Client) LookupPhone(ctx context.Context, e164s ...uint64) (ContactDis
|
|||
return resp, err
|
||||
}
|
||||
|
||||
func (cli *Client) doContactDiscovery(ctx context.Context, req *signalpb.CDSClientRequest) (ContactDiscoveryResponse, []byte, error) {
|
||||
func (cli *Client) doContactDiscovery(ctx context.Context, req *cds2pb.ClientRequest) (ContactDiscoveryResponse, []byte, error) {
|
||||
creds, err := cli.getContactDiscoveryCredentials(ctx)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to fetch contact discovery auth: %w", err)
|
||||
|
|
@ -185,7 +187,7 @@ func (cdc *ContactDiscoveryClient) Handshake(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (cdc *ContactDiscoveryClient) SendRequest(ctx context.Context, req *signalpb.CDSClientRequest) error {
|
||||
func (cdc *ContactDiscoveryClient) SendRequest(ctx context.Context, req *cds2pb.ClientRequest) error {
|
||||
plaintext, err := proto.Marshal(req)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to marshal request: %w", err)
|
||||
|
|
@ -222,15 +224,15 @@ func (cdc *ContactDiscoveryClient) handleResponse(ctx context.Context, msg []byt
|
|||
if err != nil {
|
||||
return fmt.Errorf("failed to decrypt message: %w", err)
|
||||
}
|
||||
var cdsClientResp signalpb.CDSClientResponse
|
||||
var cdsClientResp cds2pb.ClientResponse
|
||||
err = proto.Unmarshal(decrypted, &cdsClientResp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to unmarshal message: %w", err)
|
||||
}
|
||||
if cdsClientResp.Token != nil {
|
||||
cdc.Token = cdsClientResp.Token
|
||||
err = cdc.SendRequest(ctx, &signalpb.CDSClientRequest{
|
||||
TokenAck: proto.Bool(true),
|
||||
err = cdc.SendRequest(ctx, &cds2pb.ClientRequest{
|
||||
TokenAck: true,
|
||||
})
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to send token ack request: %w", err)
|
||||
|
|
|
|||
|
|
@ -619,7 +619,7 @@ func (cli *Client) fetchGroupByID(ctx context.Context, gid types.GroupIdentifier
|
|||
return nil, fmt.Errorf("failed to get group master key: %w", err)
|
||||
}
|
||||
if groupMasterKey == "" {
|
||||
return nil, fmt.Errorf("No group master key found for group identifier %s", gid)
|
||||
return nil, fmt.Errorf("%w for %s", ErrGroupMasterKeyNotFound, gid)
|
||||
}
|
||||
return cli.fetchGroupWithMasterKey(ctx, groupMasterKey)
|
||||
}
|
||||
|
|
@ -641,7 +641,7 @@ func (cli *Client) fetchGroupWithMasterKey(ctx context.Context, groupMasterKey t
|
|||
return nil, err
|
||||
}
|
||||
if response.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("fetchGroupByID SendHTTPRequest bad status: %d", response.StatusCode)
|
||||
return nil, fmt.Errorf("unexpected response status: %d", response.StatusCode)
|
||||
}
|
||||
return cli.parseGroupResponse(ctx, response, groupMasterKey)
|
||||
}
|
||||
|
|
@ -1513,11 +1513,15 @@ func (cli *Client) patchGroup(ctx context.Context, groupChange *signalpb.GroupCh
|
|||
return &changeResp, nil
|
||||
}
|
||||
|
||||
var ErrGroupMasterKeyNotFound = errors.New("group master key not found in store")
|
||||
|
||||
func (cli *Client) UpdateGroup(ctx context.Context, groupChange *GroupChange, gid types.GroupIdentifier) (uint32, error) {
|
||||
log := zerolog.Ctx(ctx).With().Str("action", "UpdateGroup").Logger()
|
||||
groupMasterKey, err := cli.Store.GroupStore.MasterKeyFromGroupIdentifier(ctx, gid)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("failed to get master key for group: %w", err)
|
||||
} else if groupMasterKey == "" {
|
||||
return 0, ErrGroupMasterKeyNotFound
|
||||
}
|
||||
groupChange.GroupMasterKey = groupMasterKey
|
||||
masterKeyBytes := masterKeyToBytes(groupMasterKey)
|
||||
|
|
@ -1662,7 +1666,7 @@ func PrepareGroupCreation(decryptedGroup *Group) (libsignalgo.GroupMasterKey, er
|
|||
return masterKeyBytes, nil
|
||||
}
|
||||
|
||||
func (cli *Client) createGroupOnServer(ctx context.Context, decryptedGroup *Group, avatarBytes []byte) (*Group, error) {
|
||||
func (cli *Client) createGroupOnServer(ctx context.Context, decryptedGroup *Group) (*Group, error) {
|
||||
log := zerolog.Ctx(ctx).With().Str("action", "CreateGroupOnServer").Logger()
|
||||
masterKeyBytes, err := PrepareGroupCreation(decryptedGroup)
|
||||
if err != nil {
|
||||
|
|
@ -1677,14 +1681,6 @@ func (cli *Client) createGroupOnServer(ctx context.Context, decryptedGroup *Grou
|
|||
log.Err(err).Msg("DeriveGroupSecretParamsFromMasterKey error")
|
||||
return nil, err
|
||||
}
|
||||
if len(avatarBytes) > 0 {
|
||||
avatarPath, err := cli.UploadGroupAvatar(ctx, avatarBytes, decryptedGroup.GroupIdentifier)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to upload group avatar")
|
||||
return nil, err
|
||||
}
|
||||
decryptedGroup.AvatarPath = avatarPath
|
||||
}
|
||||
encryptedGroup, err := cli.EncryptGroup(ctx, decryptedGroup, groupSecretParams)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to encrypt group")
|
||||
|
|
@ -1735,9 +1731,9 @@ func GenerateInviteLinkPassword() types.SerializedInviteLinkPassword {
|
|||
return InviteLinkPasswordFromBytes(random.Bytes(16))
|
||||
}
|
||||
|
||||
func (cli *Client) CreateGroup(ctx context.Context, decryptedGroup *Group, avatarBytes []byte) (*Group, error) {
|
||||
func (cli *Client) CreateGroup(ctx context.Context, decryptedGroup *Group) (*Group, error) {
|
||||
log := zerolog.Ctx(ctx).With().Str("action", "CreateGroup").Logger()
|
||||
group, err := cli.createGroupOnServer(ctx, decryptedGroup, avatarBytes)
|
||||
group, err := cli.createGroupOnServer(ctx, decryptedGroup)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Error creating group on server")
|
||||
return nil, err
|
||||
|
|
@ -1760,7 +1756,7 @@ func (cli *Client) GetGroupHistoryPage(ctx context.Context, gid types.GroupIdent
|
|||
return nil, err
|
||||
}
|
||||
if groupMasterKey == "" {
|
||||
return nil, fmt.Errorf("No group master key found for group identifier %s", gid)
|
||||
return nil, ErrGroupMasterKeyNotFound
|
||||
}
|
||||
masterKeyBytes := masterKeyToBytes(groupMasterKey)
|
||||
groupAuth, err := cli.GetAuthorizationForToday(ctx, masterKeyBytes)
|
||||
|
|
@ -1784,7 +1780,7 @@ func (cli *Client) GetGroupHistoryPage(ctx context.Context, gid types.GroupIdent
|
|||
return nil, err
|
||||
}
|
||||
if response.StatusCode != 200 {
|
||||
return nil, fmt.Errorf("fetchGroupByID SendHTTPRequest bad status: %d", response.StatusCode)
|
||||
return nil, fmt.Errorf("unexpected response status: %d", response.StatusCode)
|
||||
}
|
||||
var encryptedGroupChanges signalpb.GroupChanges
|
||||
groupChangesBytes, err := io.ReadAll(response.Body)
|
||||
|
|
|
|||
|
|
@ -413,6 +413,10 @@ func (cli *Client) FetchAndProcessPreKey(ctx context.Context, theirServiceID lib
|
|||
if cli.Store.RecipientStore.IsUnregistered(ctx, theirServiceID) {
|
||||
return fmt.Errorf("%w (cached)", ErrUnregisteredUser)
|
||||
}
|
||||
localAddress, err := cli.Store.ACIServiceID().Address(uint(cli.Store.DeviceID))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to get own address: %w", err)
|
||||
}
|
||||
// Fetch prekey
|
||||
deviceIDPath := "/*"
|
||||
if specificDeviceID >= 0 {
|
||||
|
|
@ -518,6 +522,7 @@ func (cli *Client) FetchAndProcessPreKey(ctx context.Context, theirServiceID lib
|
|||
ctx,
|
||||
preKeyBundle,
|
||||
address,
|
||||
localAddress,
|
||||
cli.Store.ACISessionStore,
|
||||
cli.Store.ACIIdentityStore,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ func (l FFILogger) Log(level libsignalgo.LogLevel, file string, line uint, messa
|
|||
|
||||
func (FFILogger) Flush() {}
|
||||
|
||||
func (FFILogger) Destroy() {}
|
||||
|
||||
// Ensure FFILogger implements the Logger interface
|
||||
var _ libsignalgo.Logger = FFILogger{}
|
||||
|
||||
|
|
|
|||
272
pkg/signalmeow/protobuf/ContactDiscovery.pb.go
generated
272
pkg/signalmeow/protobuf/ContactDiscovery.pb.go
generated
|
|
@ -1,272 +0,0 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// source: ContactDiscovery.proto
|
||||
|
||||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
package signalpb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type CDSClientRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Each ACI/UAK pair is a 32-byte buffer, containing the 16-byte ACI followed
|
||||
// by its 16-byte UAK.
|
||||
AciUakPairs []byte `protobuf:"bytes,1,opt,name=aci_uak_pairs,json=aciUakPairs" json:"aci_uak_pairs,omitempty"`
|
||||
// Each E164 is an 8-byte big-endian number, as 8 bytes.
|
||||
PrevE164S []byte `protobuf:"bytes,2,opt,name=prev_e164s,json=prevE164s" json:"prev_e164s,omitempty"`
|
||||
NewE164S []byte `protobuf:"bytes,3,opt,name=new_e164s,json=newE164s" json:"new_e164s,omitempty"`
|
||||
DiscardE164S []byte `protobuf:"bytes,4,opt,name=discard_e164s,json=discardE164s" json:"discard_e164s,omitempty"`
|
||||
// If true, the client has more pairs or e164s to send. If false or unset,
|
||||
// this is the client's last request, and processing should commence.
|
||||
HasMore *bool `protobuf:"varint,5,opt,name=has_more,json=hasMore" json:"has_more,omitempty"`
|
||||
// If set, a token which allows rate limiting to discount the e164s in
|
||||
// the request's prev_e164s, only counting new_e164s. If not set, then
|
||||
// rate limiting considers both prev_e164s' and new_e164s' size.
|
||||
Token []byte `protobuf:"bytes,6,opt,name=token" json:"token,omitempty"`
|
||||
// After receiving a new token from the server, send back a message just
|
||||
// containing a token_ack.
|
||||
TokenAck *bool `protobuf:"varint,7,opt,name=token_ack,json=tokenAck" json:"token_ack,omitempty"`
|
||||
// Request that, if the server allows, both ACI and PNI be returned even
|
||||
// if the aci_uak_pairs don't match.
|
||||
ReturnAcisWithoutUaks *bool `protobuf:"varint,8,opt,name=return_acis_without_uaks,json=returnAcisWithoutUaks" json:"return_acis_without_uaks,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) Reset() {
|
||||
*x = CDSClientRequest{}
|
||||
mi := &file_ContactDiscovery_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CDSClientRequest) ProtoMessage() {}
|
||||
|
||||
func (x *CDSClientRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ContactDiscovery_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CDSClientRequest.ProtoReflect.Descriptor instead.
|
||||
func (*CDSClientRequest) Descriptor() ([]byte, []int) {
|
||||
return file_ContactDiscovery_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetAciUakPairs() []byte {
|
||||
if x != nil {
|
||||
return x.AciUakPairs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetPrevE164S() []byte {
|
||||
if x != nil {
|
||||
return x.PrevE164S
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetNewE164S() []byte {
|
||||
if x != nil {
|
||||
return x.NewE164S
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetDiscardE164S() []byte {
|
||||
if x != nil {
|
||||
return x.DiscardE164S
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetHasMore() bool {
|
||||
if x != nil && x.HasMore != nil {
|
||||
return *x.HasMore
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetToken() []byte {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetTokenAck() bool {
|
||||
if x != nil && x.TokenAck != nil {
|
||||
return *x.TokenAck
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *CDSClientRequest) GetReturnAcisWithoutUaks() bool {
|
||||
if x != nil && x.ReturnAcisWithoutUaks != nil {
|
||||
return *x.ReturnAcisWithoutUaks
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type CDSClientResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Each triple is an 8-byte e164, a 16-byte PNI, and a 16-byte ACI.
|
||||
// If the e164 was not found, PNI and ACI are all zeros. If the PNI
|
||||
// was found but the ACI was not, the PNI will be non-zero and the ACI
|
||||
// will be all zeros. ACI will be returned if one of the returned
|
||||
// PNIs has an ACI/UAK pair that matches.
|
||||
//
|
||||
// Should the request be successful (IE: a successful status returned),
|
||||
// |e164_pni_aci_triple| will always equal |e164| of the request,
|
||||
// so the entire marshalled size of the response will be (2+32)*|e164|,
|
||||
// where the additional 2 bytes are the id/type/length additions of the
|
||||
// protobuf marshaling added to each byte array. This avoids any data
|
||||
// leakage based on the size of the encrypted output.
|
||||
E164PniAciTriples []byte `protobuf:"bytes,1,opt,name=e164_pni_aci_triples,json=e164PniAciTriples" json:"e164_pni_aci_triples,omitempty"`
|
||||
// A token which allows subsequent calls' rate limiting to discount the
|
||||
// e164s sent up in this request, only counting those in the next
|
||||
// request's new_e164s.
|
||||
Token []byte `protobuf:"bytes,3,opt,name=token" json:"token,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *CDSClientResponse) Reset() {
|
||||
*x = CDSClientResponse{}
|
||||
mi := &file_ContactDiscovery_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *CDSClientResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*CDSClientResponse) ProtoMessage() {}
|
||||
|
||||
func (x *CDSClientResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_ContactDiscovery_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use CDSClientResponse.ProtoReflect.Descriptor instead.
|
||||
func (*CDSClientResponse) Descriptor() ([]byte, []int) {
|
||||
return file_ContactDiscovery_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *CDSClientResponse) GetE164PniAciTriples() []byte {
|
||||
if x != nil {
|
||||
return x.E164PniAciTriples
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *CDSClientResponse) GetToken() []byte {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_ContactDiscovery_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_ContactDiscovery_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x16ContactDiscovery.proto\x12\rsignalservice\"\x9e\x02\n" +
|
||||
"\x10CDSClientRequest\x12\"\n" +
|
||||
"\raci_uak_pairs\x18\x01 \x01(\fR\vaciUakPairs\x12\x1d\n" +
|
||||
"\n" +
|
||||
"prev_e164s\x18\x02 \x01(\fR\tprevE164s\x12\x1b\n" +
|
||||
"\tnew_e164s\x18\x03 \x01(\fR\bnewE164s\x12#\n" +
|
||||
"\rdiscard_e164s\x18\x04 \x01(\fR\fdiscardE164s\x12\x19\n" +
|
||||
"\bhas_more\x18\x05 \x01(\bR\ahasMore\x12\x14\n" +
|
||||
"\x05token\x18\x06 \x01(\fR\x05token\x12\x1b\n" +
|
||||
"\ttoken_ack\x18\a \x01(\bR\btokenAck\x127\n" +
|
||||
"\x18return_acis_without_uaks\x18\b \x01(\bR\x15returnAcisWithoutUaks\"Z\n" +
|
||||
"\x11CDSClientResponse\x12/\n" +
|
||||
"\x14e164_pni_aci_triples\x18\x01 \x01(\fR\x11e164PniAciTriples\x12\x14\n" +
|
||||
"\x05token\x18\x03 \x01(\fR\x05token"
|
||||
|
||||
var (
|
||||
file_ContactDiscovery_proto_rawDescOnce sync.Once
|
||||
file_ContactDiscovery_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_ContactDiscovery_proto_rawDescGZIP() []byte {
|
||||
file_ContactDiscovery_proto_rawDescOnce.Do(func() {
|
||||
file_ContactDiscovery_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_ContactDiscovery_proto_rawDesc), len(file_ContactDiscovery_proto_rawDesc)))
|
||||
})
|
||||
return file_ContactDiscovery_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_ContactDiscovery_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_ContactDiscovery_proto_goTypes = []any{
|
||||
(*CDSClientRequest)(nil), // 0: signalservice.CDSClientRequest
|
||||
(*CDSClientResponse)(nil), // 1: signalservice.CDSClientResponse
|
||||
}
|
||||
var file_ContactDiscovery_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_ContactDiscovery_proto_init() }
|
||||
func file_ContactDiscovery_proto_init() {
|
||||
if File_ContactDiscovery_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_ContactDiscovery_proto_rawDesc), len(file_ContactDiscovery_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_ContactDiscovery_proto_goTypes,
|
||||
DependencyIndexes: file_ContactDiscovery_proto_depIdxs,
|
||||
MessageInfos: file_ContactDiscovery_proto_msgTypes,
|
||||
}.Build()
|
||||
File_ContactDiscovery_proto = out.File
|
||||
file_ContactDiscovery_proto_goTypes = nil
|
||||
file_ContactDiscovery_proto_depIdxs = nil
|
||||
}
|
||||
2
pkg/signalmeow/protobuf/DeviceName.pb.go
generated
2
pkg/signalmeow/protobuf/DeviceName.pb.go
generated
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// protoc v7.34.1
|
||||
// source: DeviceName.proto
|
||||
|
||||
// Copyright 2018 Signal Messenger, LLC
|
||||
|
|
|
|||
273
pkg/signalmeow/protobuf/Groups.pb.go
generated
273
pkg/signalmeow/protobuf/Groups.pb.go
generated
|
|
@ -5,7 +5,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// protoc v7.34.1
|
||||
// source: Groups.proto
|
||||
|
||||
package signalpb
|
||||
|
|
@ -498,6 +498,7 @@ type AccessControl struct {
|
|||
Attributes AccessControl_AccessRequired `protobuf:"varint,1,opt,name=attributes,proto3,enum=signal.AccessControl_AccessRequired" json:"attributes,omitempty"`
|
||||
Members AccessControl_AccessRequired `protobuf:"varint,2,opt,name=members,proto3,enum=signal.AccessControl_AccessRequired" json:"members,omitempty"`
|
||||
AddFromInviteLink AccessControl_AccessRequired `protobuf:"varint,3,opt,name=addFromInviteLink,proto3,enum=signal.AccessControl_AccessRequired" json:"addFromInviteLink,omitempty"`
|
||||
MemberLabel AccessControl_AccessRequired `protobuf:"varint,4,opt,name=memberLabel,proto3,enum=signal.AccessControl_AccessRequired" json:"memberLabel,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -553,6 +554,13 @@ func (x *AccessControl) GetAddFromInviteLink() AccessControl_AccessRequired {
|
|||
return AccessControl_UNKNOWN
|
||||
}
|
||||
|
||||
func (x *AccessControl) GetMemberLabel() AccessControl_AccessRequired {
|
||||
if x != nil {
|
||||
return x.MemberLabel
|
||||
}
|
||||
return AccessControl_UNKNOWN
|
||||
}
|
||||
|
||||
type Group struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
PublicKey []byte `protobuf:"bytes,1,opt,name=publicKey,proto3" json:"publicKey,omitempty"`
|
||||
|
|
@ -569,7 +577,8 @@ type Group struct {
|
|||
MembersPendingAdminApproval []*MemberPendingAdminApproval `protobuf:"bytes,9,rep,name=membersPendingAdminApproval,proto3" json:"membersPendingAdminApproval,omitempty"`
|
||||
InviteLinkPassword []byte `protobuf:"bytes,10,opt,name=inviteLinkPassword,proto3" json:"inviteLinkPassword,omitempty"`
|
||||
AnnouncementsOnly bool `protobuf:"varint,12,opt,name=announcements_only,json=announcementsOnly,proto3" json:"announcements_only,omitempty"`
|
||||
MembersBanned []*MemberBanned `protobuf:"bytes,13,rep,name=members_banned,json=membersBanned,proto3" json:"members_banned,omitempty"` // next: 14
|
||||
MembersBanned []*MemberBanned `protobuf:"bytes,13,rep,name=members_banned,json=membersBanned,proto3" json:"members_banned,omitempty"`
|
||||
Terminated bool `protobuf:"varint,14,opt,name=terminated,proto3" json:"terminated,omitempty"` // next: 15
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -695,6 +704,13 @@ func (x *Group) GetMembersBanned() []*MemberBanned {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *Group) GetTerminated() bool {
|
||||
if x != nil {
|
||||
return x.Terminated
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type GroupAttributeBlob struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Types that are valid to be assigned to Content:
|
||||
|
|
@ -1317,6 +1333,8 @@ type GroupChange_Actions struct {
|
|||
DeleteMembersBanned []*GroupChange_Actions_DeleteMemberBannedAction `protobuf:"bytes,23,rep,name=delete_members_banned,json=deleteMembersBanned,proto3" json:"delete_members_banned,omitempty"` // change epoch = 4
|
||||
PromoteMembersPendingPniAciProfileKey []*GroupChange_Actions_PromoteMemberPendingPniAciProfileKeyAction `protobuf:"bytes,24,rep,name=promote_members_pending_pni_aci_profile_key,json=promoteMembersPendingPniAciProfileKey,proto3" json:"promote_members_pending_pni_aci_profile_key,omitempty"` // change epoch = 5
|
||||
ModifyMemberLabels []*GroupChange_Actions_ModifyMemberLabelAction `protobuf:"bytes,26,rep,name=modifyMemberLabels,proto3" json:"modifyMemberLabels,omitempty"` // change epoch = 6;
|
||||
ModifyMemberLabelAccess *GroupChange_Actions_ModifyMemberLabelAccessControlAction `protobuf:"bytes,27,opt,name=modifyMemberLabelAccess,proto3" json:"modifyMemberLabelAccess,omitempty"` // change epoch = 6
|
||||
TerminateGroup *GroupChange_Actions_TerminateGroupAction `protobuf:"bytes,28,opt,name=terminate_group,json=terminateGroup,proto3" json:"terminate_group,omitempty"` // change epoch = 7
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -1533,6 +1551,20 @@ func (x *GroupChange_Actions) GetModifyMemberLabels() []*GroupChange_Actions_Mod
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions) GetModifyMemberLabelAccess() *GroupChange_Actions_ModifyMemberLabelAccessControlAction {
|
||||
if x != nil {
|
||||
return x.ModifyMemberLabelAccess
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions) GetTerminateGroup() *GroupChange_Actions_TerminateGroupAction {
|
||||
if x != nil {
|
||||
return x.TerminateGroup
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type GroupChange_Actions_AddMemberAction struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Added *Member `protobuf:"bytes,1,opt,name=added,proto3" json:"added,omitempty"`
|
||||
|
|
@ -2553,6 +2585,50 @@ func (x *GroupChange_Actions_ModifyAddFromInviteLinkAccessControlAction) GetAddF
|
|||
return AccessControl_UNKNOWN
|
||||
}
|
||||
|
||||
type GroupChange_Actions_ModifyMemberLabelAccessControlAction struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
MemberLabelAccess AccessControl_AccessRequired `protobuf:"varint,1,opt,name=memberLabelAccess,proto3,enum=signal.AccessControl_AccessRequired" json:"memberLabelAccess,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyMemberLabelAccessControlAction) Reset() {
|
||||
*x = GroupChange_Actions_ModifyMemberLabelAccessControlAction{}
|
||||
mi := &file_Groups_proto_msgTypes[38]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyMemberLabelAccessControlAction) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GroupChange_Actions_ModifyMemberLabelAccessControlAction) ProtoMessage() {}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyMemberLabelAccessControlAction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_Groups_proto_msgTypes[38]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GroupChange_Actions_ModifyMemberLabelAccessControlAction.ProtoReflect.Descriptor instead.
|
||||
func (*GroupChange_Actions_ModifyMemberLabelAccessControlAction) Descriptor() ([]byte, []int) {
|
||||
return file_Groups_proto_rawDescGZIP(), []int{10, 0, 21}
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyMemberLabelAccessControlAction) GetMemberLabelAccess() AccessControl_AccessRequired {
|
||||
if x != nil {
|
||||
return x.MemberLabelAccess
|
||||
}
|
||||
return AccessControl_UNKNOWN
|
||||
}
|
||||
|
||||
type GroupChange_Actions_ModifyInviteLinkPasswordAction struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
InviteLinkPassword []byte `protobuf:"bytes,1,opt,name=inviteLinkPassword,proto3" json:"inviteLinkPassword,omitempty"`
|
||||
|
|
@ -2562,7 +2638,7 @@ type GroupChange_Actions_ModifyInviteLinkPasswordAction struct {
|
|||
|
||||
func (x *GroupChange_Actions_ModifyInviteLinkPasswordAction) Reset() {
|
||||
*x = GroupChange_Actions_ModifyInviteLinkPasswordAction{}
|
||||
mi := &file_Groups_proto_msgTypes[38]
|
||||
mi := &file_Groups_proto_msgTypes[39]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -2574,7 +2650,7 @@ func (x *GroupChange_Actions_ModifyInviteLinkPasswordAction) String() string {
|
|||
func (*GroupChange_Actions_ModifyInviteLinkPasswordAction) ProtoMessage() {}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyInviteLinkPasswordAction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_Groups_proto_msgTypes[38]
|
||||
mi := &file_Groups_proto_msgTypes[39]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -2587,7 +2663,7 @@ func (x *GroupChange_Actions_ModifyInviteLinkPasswordAction) ProtoReflect() prot
|
|||
|
||||
// Deprecated: Use GroupChange_Actions_ModifyInviteLinkPasswordAction.ProtoReflect.Descriptor instead.
|
||||
func (*GroupChange_Actions_ModifyInviteLinkPasswordAction) Descriptor() ([]byte, []int) {
|
||||
return file_Groups_proto_rawDescGZIP(), []int{10, 0, 21}
|
||||
return file_Groups_proto_rawDescGZIP(), []int{10, 0, 22}
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyInviteLinkPasswordAction) GetInviteLinkPassword() []byte {
|
||||
|
|
@ -2606,7 +2682,7 @@ type GroupChange_Actions_ModifyAnnouncementsOnlyAction struct {
|
|||
|
||||
func (x *GroupChange_Actions_ModifyAnnouncementsOnlyAction) Reset() {
|
||||
*x = GroupChange_Actions_ModifyAnnouncementsOnlyAction{}
|
||||
mi := &file_Groups_proto_msgTypes[39]
|
||||
mi := &file_Groups_proto_msgTypes[40]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -2618,7 +2694,7 @@ func (x *GroupChange_Actions_ModifyAnnouncementsOnlyAction) String() string {
|
|||
func (*GroupChange_Actions_ModifyAnnouncementsOnlyAction) ProtoMessage() {}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyAnnouncementsOnlyAction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_Groups_proto_msgTypes[39]
|
||||
mi := &file_Groups_proto_msgTypes[40]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -2631,7 +2707,7 @@ func (x *GroupChange_Actions_ModifyAnnouncementsOnlyAction) ProtoReflect() proto
|
|||
|
||||
// Deprecated: Use GroupChange_Actions_ModifyAnnouncementsOnlyAction.ProtoReflect.Descriptor instead.
|
||||
func (*GroupChange_Actions_ModifyAnnouncementsOnlyAction) Descriptor() ([]byte, []int) {
|
||||
return file_Groups_proto_rawDescGZIP(), []int{10, 0, 22}
|
||||
return file_Groups_proto_rawDescGZIP(), []int{10, 0, 23}
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions_ModifyAnnouncementsOnlyAction) GetAnnouncementsOnly() bool {
|
||||
|
|
@ -2641,6 +2717,42 @@ func (x *GroupChange_Actions_ModifyAnnouncementsOnlyAction) GetAnnouncementsOnly
|
|||
return false
|
||||
}
|
||||
|
||||
type GroupChange_Actions_TerminateGroupAction struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions_TerminateGroupAction) Reset() {
|
||||
*x = GroupChange_Actions_TerminateGroupAction{}
|
||||
mi := &file_Groups_proto_msgTypes[41]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GroupChange_Actions_TerminateGroupAction) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GroupChange_Actions_TerminateGroupAction) ProtoMessage() {}
|
||||
|
||||
func (x *GroupChange_Actions_TerminateGroupAction) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_Groups_proto_msgTypes[41]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GroupChange_Actions_TerminateGroupAction.ProtoReflect.Descriptor instead.
|
||||
func (*GroupChange_Actions_TerminateGroupAction) Descriptor() ([]byte, []int) {
|
||||
return file_Groups_proto_rawDescGZIP(), []int{10, 0, 24}
|
||||
}
|
||||
|
||||
type GroupChanges_GroupChangeState struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
GroupChange *GroupChange `protobuf:"bytes,1,opt,name=groupChange,proto3" json:"groupChange,omitempty"`
|
||||
|
|
@ -2651,7 +2763,7 @@ type GroupChanges_GroupChangeState struct {
|
|||
|
||||
func (x *GroupChanges_GroupChangeState) Reset() {
|
||||
*x = GroupChanges_GroupChangeState{}
|
||||
mi := &file_Groups_proto_msgTypes[40]
|
||||
mi := &file_Groups_proto_msgTypes[42]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -2663,7 +2775,7 @@ func (x *GroupChanges_GroupChangeState) String() string {
|
|||
func (*GroupChanges_GroupChangeState) ProtoMessage() {}
|
||||
|
||||
func (x *GroupChanges_GroupChangeState) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_Groups_proto_msgTypes[40]
|
||||
mi := &file_Groups_proto_msgTypes[42]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -2737,20 +2849,21 @@ const file_Groups_proto_rawDesc = "" +
|
|||
"\ttimestamp\x18\x04 \x01(\x04R\ttimestamp\"D\n" +
|
||||
"\fMemberBanned\x12\x16\n" +
|
||||
"\x06userId\x18\x01 \x01(\fR\x06userId\x12\x1c\n" +
|
||||
"\ttimestamp\x18\x02 \x01(\x04R\ttimestamp\"\xc3\x02\n" +
|
||||
"\ttimestamp\x18\x02 \x01(\x04R\ttimestamp\"\x8b\x03\n" +
|
||||
"\rAccessControl\x12D\n" +
|
||||
"\n" +
|
||||
"attributes\x18\x01 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\n" +
|
||||
"attributes\x12>\n" +
|
||||
"\amembers\x18\x02 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\amembers\x12R\n" +
|
||||
"\x11addFromInviteLink\x18\x03 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\x11addFromInviteLink\"X\n" +
|
||||
"\x11addFromInviteLink\x18\x03 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\x11addFromInviteLink\x12F\n" +
|
||||
"\vmemberLabel\x18\x04 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\vmemberLabel\"X\n" +
|
||||
"\x0eAccessRequired\x12\v\n" +
|
||||
"\aUNKNOWN\x10\x00\x12\a\n" +
|
||||
"\x03ANY\x10\x01\x12\n" +
|
||||
"\n" +
|
||||
"\x06MEMBER\x10\x02\x12\x11\n" +
|
||||
"\rADMINISTRATOR\x10\x03\x12\x11\n" +
|
||||
"\rUNSATISFIABLE\x10\x04\"\x99\x05\n" +
|
||||
"\rUNSATISFIABLE\x10\x04\"\xb9\x05\n" +
|
||||
"\x05Group\x12\x1c\n" +
|
||||
"\tpublicKey\x18\x01 \x01(\fR\tpublicKey\x12\x14\n" +
|
||||
"\x05title\x18\x02 \x01(\fR\x05title\x12 \n" +
|
||||
|
|
@ -2765,7 +2878,10 @@ const file_Groups_proto_rawDesc = "" +
|
|||
"\x12inviteLinkPassword\x18\n" +
|
||||
" \x01(\fR\x12inviteLinkPassword\x12-\n" +
|
||||
"\x12announcements_only\x18\f \x01(\bR\x11announcementsOnly\x12;\n" +
|
||||
"\x0emembers_banned\x18\r \x03(\v2\x14.signal.MemberBannedR\rmembersBanned\"\xc3\x01\n" +
|
||||
"\x0emembers_banned\x18\r \x03(\v2\x14.signal.MemberBannedR\rmembersBanned\x12\x1e\n" +
|
||||
"\n" +
|
||||
"terminated\x18\x0e \x01(\bR\n" +
|
||||
"terminated\"\xc3\x01\n" +
|
||||
"\x12GroupAttributeBlob\x12\x16\n" +
|
||||
"\x05title\x18\x01 \x01(\tH\x00R\x05title\x12\x18\n" +
|
||||
"\x06avatar\x18\x02 \x01(\fH\x00R\x06avatar\x12D\n" +
|
||||
|
|
@ -2789,11 +2905,11 @@ const file_Groups_proto_rawDesc = "" +
|
|||
"\vmemberCount\x18\x04 \x01(\rR\vmemberCount\x12R\n" +
|
||||
"\x11addFromInviteLink\x18\x05 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\x11addFromInviteLink\x12\x18\n" +
|
||||
"\aversion\x18\x06 \x01(\rR\aversion\x122\n" +
|
||||
"\x14pendingAdminApproval\x18\a \x01(\bR\x14pendingAdminApproval\"\xbb'\n" +
|
||||
"\x14pendingAdminApproval\x18\a \x01(\bR\x14pendingAdminApproval\"\xa6*\n" +
|
||||
"\vGroupChange\x12\x18\n" +
|
||||
"\aactions\x18\x01 \x01(\fR\aactions\x12(\n" +
|
||||
"\x0fserverSignature\x18\x02 \x01(\fR\x0fserverSignature\x12 \n" +
|
||||
"\vchangeEpoch\x18\x03 \x01(\rR\vchangeEpoch\x1a\xc5&\n" +
|
||||
"\vchangeEpoch\x18\x03 \x01(\rR\vchangeEpoch\x1a\xb0)\n" +
|
||||
"\aActions\x12\"\n" +
|
||||
"\fsourceUserId\x18\x01 \x01(\fR\fsourceUserId\x12\x19\n" +
|
||||
"\bgroup_id\x18\x19 \x01(\fR\agroupId\x12\x18\n" +
|
||||
|
|
@ -2823,7 +2939,9 @@ const file_Groups_proto_rawDesc = "" +
|
|||
"\x12add_members_banned\x18\x16 \x03(\v21.signal.GroupChange.Actions.AddMemberBannedActionR\x10addMembersBanned\x12h\n" +
|
||||
"\x15delete_members_banned\x18\x17 \x03(\v24.signal.GroupChange.Actions.DeleteMemberBannedActionR\x13deleteMembersBanned\x12\xa2\x01\n" +
|
||||
"+promote_members_pending_pni_aci_profile_key\x18\x18 \x03(\v2F.signal.GroupChange.Actions.PromoteMemberPendingPniAciProfileKeyActionR%promoteMembersPendingPniAciProfileKey\x12c\n" +
|
||||
"\x12modifyMemberLabels\x18\x1a \x03(\v23.signal.GroupChange.Actions.ModifyMemberLabelActionR\x12modifyMemberLabels\x1ag\n" +
|
||||
"\x12modifyMemberLabels\x18\x1a \x03(\v23.signal.GroupChange.Actions.ModifyMemberLabelActionR\x12modifyMemberLabels\x12z\n" +
|
||||
"\x17modifyMemberLabelAccess\x18\x1b \x01(\v2@.signal.GroupChange.Actions.ModifyMemberLabelAccessControlActionR\x17modifyMemberLabelAccess\x12Y\n" +
|
||||
"\x0fterminate_group\x18\x1c \x01(\v20.signal.GroupChange.Actions.TerminateGroupActionR\x0eterminateGroup\x1ag\n" +
|
||||
"\x0fAddMemberAction\x12$\n" +
|
||||
"\x05added\x18\x01 \x01(\v2\x0e.signal.MemberR\x05added\x12.\n" +
|
||||
"\x12joinFromInviteLink\x18\x02 \x01(\bR\x12joinFromInviteLink\x1a:\n" +
|
||||
|
|
@ -2882,11 +3000,14 @@ const file_Groups_proto_rawDesc = "" +
|
|||
" ModifyMembersAccessControlAction\x12J\n" +
|
||||
"\rmembersAccess\x18\x01 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\rmembersAccess\x1a\x8c\x01\n" +
|
||||
"*ModifyAddFromInviteLinkAccessControlAction\x12^\n" +
|
||||
"\x17addFromInviteLinkAccess\x18\x01 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\x17addFromInviteLinkAccess\x1aP\n" +
|
||||
"\x17addFromInviteLinkAccess\x18\x01 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\x17addFromInviteLinkAccess\x1az\n" +
|
||||
"$ModifyMemberLabelAccessControlAction\x12R\n" +
|
||||
"\x11memberLabelAccess\x18\x01 \x01(\x0e2$.signal.AccessControl.AccessRequiredR\x11memberLabelAccess\x1aP\n" +
|
||||
"\x1eModifyInviteLinkPasswordAction\x12.\n" +
|
||||
"\x12inviteLinkPassword\x18\x01 \x01(\fR\x12inviteLinkPassword\x1aN\n" +
|
||||
"\x1dModifyAnnouncementsOnlyAction\x12-\n" +
|
||||
"\x12announcements_only\x18\x01 \x01(\bR\x11announcementsOnly\"/\n" +
|
||||
"\x12announcements_only\x18\x01 \x01(\bR\x11announcementsOnly\x1a\x16\n" +
|
||||
"\x14TerminateGroupAction\"/\n" +
|
||||
"\x17ExternalGroupCredential\x12\x14\n" +
|
||||
"\x05token\x18\x01 \x01(\tR\x05token\"}\n" +
|
||||
"\rGroupResponse\x12#\n" +
|
||||
|
|
@ -2918,7 +3039,7 @@ func file_Groups_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_Groups_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
|
||||
var file_Groups_proto_msgTypes = make([]protoimpl.MessageInfo, 41)
|
||||
var file_Groups_proto_msgTypes = make([]protoimpl.MessageInfo, 43)
|
||||
var file_Groups_proto_goTypes = []any{
|
||||
(Member_Role)(0), // 0: signal.Member.Role
|
||||
(AccessControl_AccessRequired)(0), // 1: signal.AccessControl.AccessRequired
|
||||
|
|
@ -2960,9 +3081,11 @@ var file_Groups_proto_goTypes = []any{
|
|||
(*GroupChange_Actions_ModifyAttributesAccessControlAction)(nil), // 37: signal.GroupChange.Actions.ModifyAttributesAccessControlAction
|
||||
(*GroupChange_Actions_ModifyMembersAccessControlAction)(nil), // 38: signal.GroupChange.Actions.ModifyMembersAccessControlAction
|
||||
(*GroupChange_Actions_ModifyAddFromInviteLinkAccessControlAction)(nil), // 39: signal.GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction
|
||||
(*GroupChange_Actions_ModifyInviteLinkPasswordAction)(nil), // 40: signal.GroupChange.Actions.ModifyInviteLinkPasswordAction
|
||||
(*GroupChange_Actions_ModifyAnnouncementsOnlyAction)(nil), // 41: signal.GroupChange.Actions.ModifyAnnouncementsOnlyAction
|
||||
(*GroupChanges_GroupChangeState)(nil), // 42: signal.GroupChanges.GroupChangeState
|
||||
(*GroupChange_Actions_ModifyMemberLabelAccessControlAction)(nil), // 40: signal.GroupChange.Actions.ModifyMemberLabelAccessControlAction
|
||||
(*GroupChange_Actions_ModifyInviteLinkPasswordAction)(nil), // 41: signal.GroupChange.Actions.ModifyInviteLinkPasswordAction
|
||||
(*GroupChange_Actions_ModifyAnnouncementsOnlyAction)(nil), // 42: signal.GroupChange.Actions.ModifyAnnouncementsOnlyAction
|
||||
(*GroupChange_Actions_TerminateGroupAction)(nil), // 43: signal.GroupChange.Actions.TerminateGroupAction
|
||||
(*GroupChanges_GroupChangeState)(nil), // 44: signal.GroupChanges.GroupChangeState
|
||||
}
|
||||
var file_Groups_proto_depIdxs = []int32{
|
||||
0, // 0: signal.Member.role:type_name -> signal.Member.Role
|
||||
|
|
@ -2970,55 +3093,59 @@ var file_Groups_proto_depIdxs = []int32{
|
|||
1, // 2: signal.AccessControl.attributes:type_name -> signal.AccessControl.AccessRequired
|
||||
1, // 3: signal.AccessControl.members:type_name -> signal.AccessControl.AccessRequired
|
||||
1, // 4: signal.AccessControl.addFromInviteLink:type_name -> signal.AccessControl.AccessRequired
|
||||
7, // 5: signal.Group.accessControl:type_name -> signal.AccessControl
|
||||
3, // 6: signal.Group.members:type_name -> signal.Member
|
||||
4, // 7: signal.Group.membersPendingProfileKey:type_name -> signal.MemberPendingProfileKey
|
||||
5, // 8: signal.Group.membersPendingAdminApproval:type_name -> signal.MemberPendingAdminApproval
|
||||
6, // 9: signal.Group.members_banned:type_name -> signal.MemberBanned
|
||||
17, // 10: signal.GroupInviteLink.contentsV1:type_name -> signal.GroupInviteLink.GroupInviteLinkContentsV1
|
||||
1, // 11: signal.GroupJoinInfo.addFromInviteLink:type_name -> signal.AccessControl.AccessRequired
|
||||
8, // 12: signal.GroupResponse.group:type_name -> signal.Group
|
||||
42, // 13: signal.GroupChanges.groupChanges:type_name -> signal.GroupChanges.GroupChangeState
|
||||
12, // 14: signal.GroupChangeResponse.group_change:type_name -> signal.GroupChange
|
||||
19, // 15: signal.GroupChange.Actions.addMembers:type_name -> signal.GroupChange.Actions.AddMemberAction
|
||||
20, // 16: signal.GroupChange.Actions.deleteMembers:type_name -> signal.GroupChange.Actions.DeleteMemberAction
|
||||
21, // 17: signal.GroupChange.Actions.modifyMemberRoles:type_name -> signal.GroupChange.Actions.ModifyMemberRoleAction
|
||||
23, // 18: signal.GroupChange.Actions.modifyMemberProfileKeys:type_name -> signal.GroupChange.Actions.ModifyMemberProfileKeyAction
|
||||
24, // 19: signal.GroupChange.Actions.addMembersPendingProfileKey:type_name -> signal.GroupChange.Actions.AddMemberPendingProfileKeyAction
|
||||
25, // 20: signal.GroupChange.Actions.deleteMembersPendingProfileKey:type_name -> signal.GroupChange.Actions.DeleteMemberPendingProfileKeyAction
|
||||
26, // 21: signal.GroupChange.Actions.promoteMembersPendingProfileKey:type_name -> signal.GroupChange.Actions.PromoteMemberPendingProfileKeyAction
|
||||
33, // 22: signal.GroupChange.Actions.modifyTitle:type_name -> signal.GroupChange.Actions.ModifyTitleAction
|
||||
35, // 23: signal.GroupChange.Actions.modifyAvatar:type_name -> signal.GroupChange.Actions.ModifyAvatarAction
|
||||
36, // 24: signal.GroupChange.Actions.modifyDisappearingMessageTimer:type_name -> signal.GroupChange.Actions.ModifyDisappearingMessageTimerAction
|
||||
37, // 25: signal.GroupChange.Actions.modifyAttributesAccess:type_name -> signal.GroupChange.Actions.ModifyAttributesAccessControlAction
|
||||
38, // 26: signal.GroupChange.Actions.modifyMemberAccess:type_name -> signal.GroupChange.Actions.ModifyMembersAccessControlAction
|
||||
39, // 27: signal.GroupChange.Actions.modifyAddFromInviteLinkAccess:type_name -> signal.GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction
|
||||
28, // 28: signal.GroupChange.Actions.addMembersPendingAdminApproval:type_name -> signal.GroupChange.Actions.AddMemberPendingAdminApprovalAction
|
||||
29, // 29: signal.GroupChange.Actions.deleteMembersPendingAdminApproval:type_name -> signal.GroupChange.Actions.DeleteMemberPendingAdminApprovalAction
|
||||
30, // 30: signal.GroupChange.Actions.promoteMembersPendingAdminApproval:type_name -> signal.GroupChange.Actions.PromoteMemberPendingAdminApprovalAction
|
||||
40, // 31: signal.GroupChange.Actions.modifyInviteLinkPassword:type_name -> signal.GroupChange.Actions.ModifyInviteLinkPasswordAction
|
||||
34, // 32: signal.GroupChange.Actions.modifyDescription:type_name -> signal.GroupChange.Actions.ModifyDescriptionAction
|
||||
41, // 33: signal.GroupChange.Actions.modify_announcements_only:type_name -> signal.GroupChange.Actions.ModifyAnnouncementsOnlyAction
|
||||
31, // 34: signal.GroupChange.Actions.add_members_banned:type_name -> signal.GroupChange.Actions.AddMemberBannedAction
|
||||
32, // 35: signal.GroupChange.Actions.delete_members_banned:type_name -> signal.GroupChange.Actions.DeleteMemberBannedAction
|
||||
27, // 36: signal.GroupChange.Actions.promote_members_pending_pni_aci_profile_key:type_name -> signal.GroupChange.Actions.PromoteMemberPendingPniAciProfileKeyAction
|
||||
22, // 37: signal.GroupChange.Actions.modifyMemberLabels:type_name -> signal.GroupChange.Actions.ModifyMemberLabelAction
|
||||
3, // 38: signal.GroupChange.Actions.AddMemberAction.added:type_name -> signal.Member
|
||||
0, // 39: signal.GroupChange.Actions.ModifyMemberRoleAction.role:type_name -> signal.Member.Role
|
||||
4, // 40: signal.GroupChange.Actions.AddMemberPendingProfileKeyAction.added:type_name -> signal.MemberPendingProfileKey
|
||||
5, // 41: signal.GroupChange.Actions.AddMemberPendingAdminApprovalAction.added:type_name -> signal.MemberPendingAdminApproval
|
||||
0, // 42: signal.GroupChange.Actions.PromoteMemberPendingAdminApprovalAction.role:type_name -> signal.Member.Role
|
||||
6, // 43: signal.GroupChange.Actions.AddMemberBannedAction.added:type_name -> signal.MemberBanned
|
||||
1, // 44: signal.GroupChange.Actions.ModifyAttributesAccessControlAction.attributesAccess:type_name -> signal.AccessControl.AccessRequired
|
||||
1, // 45: signal.GroupChange.Actions.ModifyMembersAccessControlAction.membersAccess:type_name -> signal.AccessControl.AccessRequired
|
||||
1, // 46: signal.GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction.addFromInviteLinkAccess:type_name -> signal.AccessControl.AccessRequired
|
||||
12, // 47: signal.GroupChanges.GroupChangeState.groupChange:type_name -> signal.GroupChange
|
||||
8, // 48: signal.GroupChanges.GroupChangeState.groupState:type_name -> signal.Group
|
||||
49, // [49:49] is the sub-list for method output_type
|
||||
49, // [49:49] is the sub-list for method input_type
|
||||
49, // [49:49] is the sub-list for extension type_name
|
||||
49, // [49:49] is the sub-list for extension extendee
|
||||
0, // [0:49] is the sub-list for field type_name
|
||||
1, // 5: signal.AccessControl.memberLabel:type_name -> signal.AccessControl.AccessRequired
|
||||
7, // 6: signal.Group.accessControl:type_name -> signal.AccessControl
|
||||
3, // 7: signal.Group.members:type_name -> signal.Member
|
||||
4, // 8: signal.Group.membersPendingProfileKey:type_name -> signal.MemberPendingProfileKey
|
||||
5, // 9: signal.Group.membersPendingAdminApproval:type_name -> signal.MemberPendingAdminApproval
|
||||
6, // 10: signal.Group.members_banned:type_name -> signal.MemberBanned
|
||||
17, // 11: signal.GroupInviteLink.contentsV1:type_name -> signal.GroupInviteLink.GroupInviteLinkContentsV1
|
||||
1, // 12: signal.GroupJoinInfo.addFromInviteLink:type_name -> signal.AccessControl.AccessRequired
|
||||
8, // 13: signal.GroupResponse.group:type_name -> signal.Group
|
||||
44, // 14: signal.GroupChanges.groupChanges:type_name -> signal.GroupChanges.GroupChangeState
|
||||
12, // 15: signal.GroupChangeResponse.group_change:type_name -> signal.GroupChange
|
||||
19, // 16: signal.GroupChange.Actions.addMembers:type_name -> signal.GroupChange.Actions.AddMemberAction
|
||||
20, // 17: signal.GroupChange.Actions.deleteMembers:type_name -> signal.GroupChange.Actions.DeleteMemberAction
|
||||
21, // 18: signal.GroupChange.Actions.modifyMemberRoles:type_name -> signal.GroupChange.Actions.ModifyMemberRoleAction
|
||||
23, // 19: signal.GroupChange.Actions.modifyMemberProfileKeys:type_name -> signal.GroupChange.Actions.ModifyMemberProfileKeyAction
|
||||
24, // 20: signal.GroupChange.Actions.addMembersPendingProfileKey:type_name -> signal.GroupChange.Actions.AddMemberPendingProfileKeyAction
|
||||
25, // 21: signal.GroupChange.Actions.deleteMembersPendingProfileKey:type_name -> signal.GroupChange.Actions.DeleteMemberPendingProfileKeyAction
|
||||
26, // 22: signal.GroupChange.Actions.promoteMembersPendingProfileKey:type_name -> signal.GroupChange.Actions.PromoteMemberPendingProfileKeyAction
|
||||
33, // 23: signal.GroupChange.Actions.modifyTitle:type_name -> signal.GroupChange.Actions.ModifyTitleAction
|
||||
35, // 24: signal.GroupChange.Actions.modifyAvatar:type_name -> signal.GroupChange.Actions.ModifyAvatarAction
|
||||
36, // 25: signal.GroupChange.Actions.modifyDisappearingMessageTimer:type_name -> signal.GroupChange.Actions.ModifyDisappearingMessageTimerAction
|
||||
37, // 26: signal.GroupChange.Actions.modifyAttributesAccess:type_name -> signal.GroupChange.Actions.ModifyAttributesAccessControlAction
|
||||
38, // 27: signal.GroupChange.Actions.modifyMemberAccess:type_name -> signal.GroupChange.Actions.ModifyMembersAccessControlAction
|
||||
39, // 28: signal.GroupChange.Actions.modifyAddFromInviteLinkAccess:type_name -> signal.GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction
|
||||
28, // 29: signal.GroupChange.Actions.addMembersPendingAdminApproval:type_name -> signal.GroupChange.Actions.AddMemberPendingAdminApprovalAction
|
||||
29, // 30: signal.GroupChange.Actions.deleteMembersPendingAdminApproval:type_name -> signal.GroupChange.Actions.DeleteMemberPendingAdminApprovalAction
|
||||
30, // 31: signal.GroupChange.Actions.promoteMembersPendingAdminApproval:type_name -> signal.GroupChange.Actions.PromoteMemberPendingAdminApprovalAction
|
||||
41, // 32: signal.GroupChange.Actions.modifyInviteLinkPassword:type_name -> signal.GroupChange.Actions.ModifyInviteLinkPasswordAction
|
||||
34, // 33: signal.GroupChange.Actions.modifyDescription:type_name -> signal.GroupChange.Actions.ModifyDescriptionAction
|
||||
42, // 34: signal.GroupChange.Actions.modify_announcements_only:type_name -> signal.GroupChange.Actions.ModifyAnnouncementsOnlyAction
|
||||
31, // 35: signal.GroupChange.Actions.add_members_banned:type_name -> signal.GroupChange.Actions.AddMemberBannedAction
|
||||
32, // 36: signal.GroupChange.Actions.delete_members_banned:type_name -> signal.GroupChange.Actions.DeleteMemberBannedAction
|
||||
27, // 37: signal.GroupChange.Actions.promote_members_pending_pni_aci_profile_key:type_name -> signal.GroupChange.Actions.PromoteMemberPendingPniAciProfileKeyAction
|
||||
22, // 38: signal.GroupChange.Actions.modifyMemberLabels:type_name -> signal.GroupChange.Actions.ModifyMemberLabelAction
|
||||
40, // 39: signal.GroupChange.Actions.modifyMemberLabelAccess:type_name -> signal.GroupChange.Actions.ModifyMemberLabelAccessControlAction
|
||||
43, // 40: signal.GroupChange.Actions.terminate_group:type_name -> signal.GroupChange.Actions.TerminateGroupAction
|
||||
3, // 41: signal.GroupChange.Actions.AddMemberAction.added:type_name -> signal.Member
|
||||
0, // 42: signal.GroupChange.Actions.ModifyMemberRoleAction.role:type_name -> signal.Member.Role
|
||||
4, // 43: signal.GroupChange.Actions.AddMemberPendingProfileKeyAction.added:type_name -> signal.MemberPendingProfileKey
|
||||
5, // 44: signal.GroupChange.Actions.AddMemberPendingAdminApprovalAction.added:type_name -> signal.MemberPendingAdminApproval
|
||||
0, // 45: signal.GroupChange.Actions.PromoteMemberPendingAdminApprovalAction.role:type_name -> signal.Member.Role
|
||||
6, // 46: signal.GroupChange.Actions.AddMemberBannedAction.added:type_name -> signal.MemberBanned
|
||||
1, // 47: signal.GroupChange.Actions.ModifyAttributesAccessControlAction.attributesAccess:type_name -> signal.AccessControl.AccessRequired
|
||||
1, // 48: signal.GroupChange.Actions.ModifyMembersAccessControlAction.membersAccess:type_name -> signal.AccessControl.AccessRequired
|
||||
1, // 49: signal.GroupChange.Actions.ModifyAddFromInviteLinkAccessControlAction.addFromInviteLinkAccess:type_name -> signal.AccessControl.AccessRequired
|
||||
1, // 50: signal.GroupChange.Actions.ModifyMemberLabelAccessControlAction.memberLabelAccess:type_name -> signal.AccessControl.AccessRequired
|
||||
12, // 51: signal.GroupChanges.GroupChangeState.groupChange:type_name -> signal.GroupChange
|
||||
8, // 52: signal.GroupChanges.GroupChangeState.groupState:type_name -> signal.Group
|
||||
53, // [53:53] is the sub-list for method output_type
|
||||
53, // [53:53] is the sub-list for method input_type
|
||||
53, // [53:53] is the sub-list for extension type_name
|
||||
53, // [53:53] is the sub-list for extension extendee
|
||||
0, // [0:53] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_Groups_proto_init() }
|
||||
|
|
@ -3041,7 +3168,7 @@ func file_Groups_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_Groups_proto_rawDesc), len(file_Groups_proto_rawDesc)),
|
||||
NumEnums: 2,
|
||||
NumMessages: 41,
|
||||
NumMessages: 43,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ message AccessControl {
|
|||
AccessRequired attributes = 1;
|
||||
AccessRequired members = 2;
|
||||
AccessRequired addFromInviteLink = 3;
|
||||
AccessRequired memberLabel = 4;
|
||||
}
|
||||
|
||||
message Group {
|
||||
|
|
@ -87,7 +88,8 @@ message Group {
|
|||
bytes inviteLinkPassword = 10;
|
||||
bool announcements_only = 12;
|
||||
repeated MemberBanned members_banned = 13;
|
||||
// next: 14
|
||||
bool terminated = 14;
|
||||
// next: 15
|
||||
}
|
||||
|
||||
message GroupAttributeBlob {
|
||||
|
|
@ -225,6 +227,10 @@ message GroupChange {
|
|||
AccessControl.AccessRequired addFromInviteLinkAccess = 1;
|
||||
}
|
||||
|
||||
message ModifyMemberLabelAccessControlAction {
|
||||
AccessControl.AccessRequired memberLabelAccess = 1;
|
||||
}
|
||||
|
||||
message ModifyInviteLinkPasswordAction {
|
||||
bytes inviteLinkPassword = 1;
|
||||
}
|
||||
|
|
@ -233,6 +239,8 @@ message GroupChange {
|
|||
bool announcements_only = 1;
|
||||
}
|
||||
|
||||
message TerminateGroupAction {}
|
||||
|
||||
bytes sourceUserId = 1;
|
||||
// clients should not provide this value; the server will provide it in the response buffer to ensure the signature is binding to a particular group
|
||||
// if clients set it during a request the server will respond with 400.
|
||||
|
|
@ -262,7 +270,9 @@ message GroupChange {
|
|||
repeated DeleteMemberBannedAction delete_members_banned = 23; // change epoch = 4
|
||||
repeated PromoteMemberPendingPniAciProfileKeyAction promote_members_pending_pni_aci_profile_key = 24; // change epoch = 5
|
||||
repeated ModifyMemberLabelAction modifyMemberLabels = 26; // change epoch = 6;
|
||||
// next: 27
|
||||
ModifyMemberLabelAccessControlAction modifyMemberLabelAccess = 27; // change epoch = 6
|
||||
TerminateGroupAction terminate_group = 28; // change epoch = 7
|
||||
// next: 29
|
||||
}
|
||||
|
||||
bytes actions = 1;
|
||||
|
|
|
|||
17
pkg/signalmeow/protobuf/Provisioning.pb.go
generated
17
pkg/signalmeow/protobuf/Provisioning.pb.go
generated
|
|
@ -5,7 +5,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// protoc v7.34.1
|
||||
// source: Provisioning.proto
|
||||
|
||||
package signalpb
|
||||
|
|
@ -199,7 +199,6 @@ type ProvisionMessage struct {
|
|||
ProfileKey []byte `protobuf:"bytes,6,opt,name=profileKey" json:"profileKey,omitempty"`
|
||||
ReadReceipts *bool `protobuf:"varint,7,opt,name=readReceipts" json:"readReceipts,omitempty"`
|
||||
ProvisioningVersion *uint32 `protobuf:"varint,9,opt,name=provisioningVersion" json:"provisioningVersion,omitempty"`
|
||||
MasterKey []byte `protobuf:"bytes,13,opt,name=masterKey" json:"masterKey,omitempty"` // Deprecated, but required by linked devices
|
||||
EphemeralBackupKey []byte `protobuf:"bytes,14,opt,name=ephemeralBackupKey" json:"ephemeralBackupKey,omitempty"` // 32 bytes
|
||||
AccountEntropyPool *string `protobuf:"bytes,15,opt,name=accountEntropyPool" json:"accountEntropyPool,omitempty"`
|
||||
MediaRootBackupKey []byte `protobuf:"bytes,16,opt,name=mediaRootBackupKey" json:"mediaRootBackupKey,omitempty"` // 32-bytes
|
||||
|
|
@ -323,13 +322,6 @@ func (x *ProvisionMessage) GetProvisioningVersion() uint32 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (x *ProvisionMessage) GetMasterKey() []byte {
|
||||
if x != nil {
|
||||
return x.MasterKey
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ProvisionMessage) GetEphemeralBackupKey() []byte {
|
||||
if x != nil {
|
||||
return x.EphemeralBackupKey
|
||||
|
|
@ -374,7 +366,7 @@ const file_Provisioning_proto_rawDesc = "" +
|
|||
"\aaddress\x18\x01 \x01(\tR\aaddress\"E\n" +
|
||||
"\x11ProvisionEnvelope\x12\x1c\n" +
|
||||
"\tpublicKey\x18\x01 \x01(\fR\tpublicKey\x12\x12\n" +
|
||||
"\x04body\x18\x02 \x01(\fR\x04body\"\xcc\x05\n" +
|
||||
"\x04body\x18\x02 \x01(\fR\x04body\"\xb4\x05\n" +
|
||||
"\x10ProvisionMessage\x122\n" +
|
||||
"\x14aciIdentityKeyPublic\x18\x01 \x01(\fR\x14aciIdentityKeyPublic\x124\n" +
|
||||
"\x15aciIdentityKeyPrivate\x18\x02 \x01(\fR\x15aciIdentityKeyPrivate\x122\n" +
|
||||
|
|
@ -390,13 +382,12 @@ const file_Provisioning_proto_rawDesc = "" +
|
|||
"profileKey\x18\x06 \x01(\fR\n" +
|
||||
"profileKey\x12\"\n" +
|
||||
"\freadReceipts\x18\a \x01(\bR\freadReceipts\x120\n" +
|
||||
"\x13provisioningVersion\x18\t \x01(\rR\x13provisioningVersion\x12\x1c\n" +
|
||||
"\tmasterKey\x18\r \x01(\fR\tmasterKey\x12.\n" +
|
||||
"\x13provisioningVersion\x18\t \x01(\rR\x13provisioningVersion\x12.\n" +
|
||||
"\x12ephemeralBackupKey\x18\x0e \x01(\fR\x12ephemeralBackupKey\x12.\n" +
|
||||
"\x12accountEntropyPool\x18\x0f \x01(\tR\x12accountEntropyPool\x12.\n" +
|
||||
"\x12mediaRootBackupKey\x18\x10 \x01(\fR\x12mediaRootBackupKey\x12\x1c\n" +
|
||||
"\taciBinary\x18\x11 \x01(\fR\taciBinary\x12\x1c\n" +
|
||||
"\tpniBinary\x18\x12 \x01(\fR\tpniBinary*G\n" +
|
||||
"\tpniBinary\x18\x12 \x01(\fR\tpniBinaryJ\x04\b\r\x10\x0e*G\n" +
|
||||
"\x13ProvisioningVersion\x12\v\n" +
|
||||
"\aINITIAL\x10\x00\x12\x12\n" +
|
||||
"\x0eTABLET_SUPPORT\x10\x01\x12\v\n" +
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ message ProvisionMessage {
|
|||
optional bytes profileKey = 6;
|
||||
optional bool readReceipts = 7;
|
||||
optional uint32 provisioningVersion = 9;
|
||||
optional bytes masterKey = 13; // Deprecated, but required by linked devices
|
||||
reserved /*masterKey*/ 13; // Deprecated in favor of accountEntropyPool
|
||||
optional bytes ephemeralBackupKey = 14; // 32 bytes
|
||||
optional string accountEntropyPool = 15;
|
||||
optional bytes mediaRootBackupKey = 16; // 32-bytes
|
||||
|
|
|
|||
1479
pkg/signalmeow/protobuf/SignalService.pb.go
generated
1479
pkg/signalmeow/protobuf/SignalService.pb.go
generated
File diff suppressed because it is too large
Load diff
|
|
@ -13,23 +13,79 @@ option java_outer_classname = "SignalServiceProtos";
|
|||
message Envelope {
|
||||
enum Type {
|
||||
UNKNOWN = 0;
|
||||
CIPHERTEXT = 1; // content => (version byte | SignalMessage{Content})
|
||||
|
||||
/**
|
||||
* A double-ratchet message represents a "normal," "unsealed-sender" message
|
||||
* encrypted using the Double Ratchet within an established Signal session.
|
||||
* Double-ratchet messages include sender information in the plaintext
|
||||
* portion of the `Envelope`.
|
||||
*/
|
||||
DOUBLE_RATCHET = 1; // content => (version byte | SignalMessage{Content})
|
||||
|
||||
reserved 2;
|
||||
reserved "KEY_EXCHANGE";
|
||||
PREKEY_BUNDLE = 3; // content => (version byte | PreKeySignalMessage{Content})
|
||||
SERVER_DELIVERY_RECEIPT = 5; // legacyMessage => [] AND content => []
|
||||
UNIDENTIFIED_SENDER = 6; // legacyMessage => [] AND content => ((version byte | UnidentifiedSenderMessage) OR (version byte | Multi-Recipient Sealed Sender Format))
|
||||
SENDERKEY_MESSAGE = 7; // legacyMessage => [] AND content => (version byte | SenderKeyMessage)
|
||||
PLAINTEXT_CONTENT = 8; // legacyMessage => [] AND content => (marker byte | Content)
|
||||
|
||||
/**
|
||||
* A prekey message begins a new Signal session. The `content` of a prekey
|
||||
* message is a superset of a double-ratchet message's `content` and
|
||||
* contains the sender's identity public key and information identifying the
|
||||
* pre-keys used in the message's ciphertext. Like double-ratchet messages,
|
||||
* prekey messages contain sender information in the plaintext portion of
|
||||
* the `Envelope`.
|
||||
*/
|
||||
PREKEY_MESSAGE = 3; // content => (version byte | PreKeySignalMessage{Content})
|
||||
|
||||
/**
|
||||
* Server delivery receipts are generated by the server when
|
||||
* "unsealed-sender" messages are delivered to and acknowledged by the
|
||||
* destination device. Server delivery receipts identify the sender in the
|
||||
* plaintext portion of the `Envelope` and have no `content`. Note that
|
||||
* receipts for sealed-sender messages are generated by clients as
|
||||
* `UNIDENTIFIED_SENDER` messages.
|
||||
*
|
||||
* Note that, with server delivery receipts, the "client timestamp" on
|
||||
* the envelope refers to the timestamp of the original message (i.e. the
|
||||
* message the server just delivered) and not to the time of delivery. The
|
||||
* "server timestamp" refers to the time of delivery.
|
||||
*/
|
||||
SERVER_DELIVERY_RECEIPT = 5; // content => []
|
||||
|
||||
/**
|
||||
* An unidentified sender message represents a message with no sender
|
||||
* information in the plaintext portion of the `Envelope`. Unidentified
|
||||
* sender messages always contain an additional `subtype` in their
|
||||
* `content`. They may or may not be part of an existing Signal session
|
||||
* (i.e. an unidentified sender message may have a "prekey message"
|
||||
* subtype or may indicate an encryption error).
|
||||
*/
|
||||
UNIDENTIFIED_SENDER = 6; // content => ((version byte | UnidentifiedSenderMessage) OR (version byte | Multi-Recipient Sealed Sender Format))
|
||||
|
||||
reserved 7;
|
||||
reserved "SENDERKEY_MESSAGE";
|
||||
|
||||
/**
|
||||
* A plaintext message is used solely to convey encryption error receipts
|
||||
* and never contains encrypted message content. Encryption error receipts
|
||||
* must be delivered in plaintext because, encryption/decryption of a prior
|
||||
* message failed and there is no reason to believe that
|
||||
* encryption/decryption of subsequent messages with the same key material
|
||||
* would succeed.
|
||||
*
|
||||
* Critically, plaintext messages never have "real" message content
|
||||
* generated by users. Plaintext messages include sender information.
|
||||
*/
|
||||
PLAINTEXT_CONTENT = 8; // content => (marker byte | Content)
|
||||
|
||||
// next: 9
|
||||
}
|
||||
|
||||
optional Type type = 1;
|
||||
reserved 2; // formerly optional string sourceE164 = 2;
|
||||
optional string sourceServiceId = 11;
|
||||
optional uint32 sourceDevice = 7;
|
||||
optional uint32 sourceDeviceId = 7;
|
||||
optional string destinationServiceId = 13;
|
||||
reserved 3; // formerly optional string relay = 3;
|
||||
optional uint64 timestamp = 5;
|
||||
optional uint64 clientTimestamp = 5;
|
||||
reserved 6; // formerly optional bytes legacyMessage = 6; // Contains an encrypted DataMessage; this field could have been set historically for type 1 or 3 messages; no longer in use
|
||||
optional bytes content = 8; // Contains an encrypted Content
|
||||
optional string serverGuid = 9;
|
||||
|
|
@ -48,17 +104,20 @@ message Envelope {
|
|||
}
|
||||
|
||||
message Content {
|
||||
optional DataMessage dataMessage = 1;
|
||||
optional SyncMessage syncMessage = 2;
|
||||
optional CallMessage callMessage = 3;
|
||||
optional NullMessage nullMessage = 4;
|
||||
optional ReceiptMessage receiptMessage = 5;
|
||||
optional TypingMessage typingMessage = 6;
|
||||
oneof content {
|
||||
DataMessage dataMessage = 1;
|
||||
SyncMessage syncMessage = 2;
|
||||
CallMessage callMessage = 3;
|
||||
NullMessage nullMessage = 4;
|
||||
ReceiptMessage receiptMessage = 5;
|
||||
TypingMessage typingMessage = 6;
|
||||
bytes /* DecryptionErrorMessage */ decryptionErrorMessage = 8;
|
||||
StoryMessage storyMessage = 9;
|
||||
EditMessage editMessage = 11;
|
||||
}
|
||||
|
||||
optional bytes /* SenderKeyDistributionMessage */ senderKeyDistributionMessage = 7;
|
||||
optional bytes /* DecryptionErrorMessage */ decryptionErrorMessage = 8;
|
||||
optional StoryMessage storyMessage = 9;
|
||||
optional PniSignatureMessage pniSignatureMessage = 10;
|
||||
optional EditMessage editMessage = 11;
|
||||
}
|
||||
|
||||
message CallMessage {
|
||||
|
|
@ -128,7 +187,7 @@ message CallMessage {
|
|||
|
||||
message DataMessage {
|
||||
enum Flags {
|
||||
END_SESSION = 1;
|
||||
reserved /*END_SESSION*/ 1;
|
||||
EXPIRATION_TIMER_UPDATE = 2;
|
||||
PROFILE_KEY_UPDATE = 4;
|
||||
FORWARD = 8;
|
||||
|
|
@ -331,8 +390,8 @@ message DataMessage {
|
|||
message PollVote {
|
||||
optional bytes targetAuthorAciBinary = 1;
|
||||
optional uint64 targetSentTimestamp = 2;
|
||||
repeated uint32 optionIndexes = 3; // must be in the range [0, options.length) from the PollCreate
|
||||
optional uint32 voteCount = 4; // increment this by 1 each time you vote on a given poll
|
||||
repeated uint32 optionIndexes = 3;
|
||||
optional uint32 voteCount = 4;
|
||||
}
|
||||
|
||||
message PinMessage {
|
||||
|
|
@ -349,6 +408,11 @@ message DataMessage {
|
|||
optional uint64 targetSentTimestamp = 2;
|
||||
}
|
||||
|
||||
message AdminDelete {
|
||||
optional bytes targetAuthorAciBinary = 1; // 16-byte UUID
|
||||
optional uint64 targetSentTimestamp = 2;
|
||||
}
|
||||
|
||||
optional string body = 1;
|
||||
repeated AttachmentPointer attachments = 2;
|
||||
reserved /*groupV1*/ 3;
|
||||
|
|
@ -376,7 +440,8 @@ message DataMessage {
|
|||
optional PollVote pollVote = 26;
|
||||
optional PinMessage pinMessage = 27;
|
||||
optional UnpinMessage unpinMessage = 28;
|
||||
// NEXT ID: 29
|
||||
optional AdminDelete adminDelete = 29;
|
||||
// NEXT ID: 30
|
||||
}
|
||||
|
||||
message NullMessage {
|
||||
|
|
@ -435,6 +500,12 @@ message TextAttachment {
|
|||
}
|
||||
|
||||
message Gradient {
|
||||
// Color ordering:
|
||||
// 0 degrees: bottom-to-top
|
||||
// 90 degrees: left-to-right
|
||||
// 180 degrees: top-to-bottom
|
||||
// 270 degrees: right-to-left
|
||||
|
||||
optional uint32 startColor = 1; // deprecated: this field will be removed in a future release.
|
||||
optional uint32 endColor = 2; // deprecated: this field will be removed in a future release.
|
||||
optional uint32 angle = 3; // degrees
|
||||
|
|
@ -547,7 +618,7 @@ message SyncMessage {
|
|||
optional bool unidentifiedDeliveryIndicators = 2;
|
||||
optional bool typingIndicators = 3;
|
||||
reserved /* linkPreviews */ 4;
|
||||
optional uint32 provisioningVersion = 5;
|
||||
reserved /* provisioningVersion */ 5;
|
||||
optional bool linkPreviews = 6;
|
||||
}
|
||||
|
||||
|
|
@ -582,7 +653,7 @@ message SyncMessage {
|
|||
|
||||
message Keys {
|
||||
reserved /* storageService */ 1;
|
||||
optional bytes master = 2; // deprecated: this field will be removed in a future release.
|
||||
reserved /* master */ 2;
|
||||
optional string accountEntropyPool = 3;
|
||||
optional bytes mediaRootBackupKey = 4;
|
||||
}
|
||||
|
|
@ -682,7 +753,7 @@ message SyncMessage {
|
|||
optional bytes rootKey = 1;
|
||||
optional bytes adminPasskey = 2;
|
||||
optional Type type = 3; // defaults to UPDATE
|
||||
optional bytes epoch = 4;
|
||||
reserved /*epoch*/ 4;
|
||||
}
|
||||
|
||||
message CallLogEvent {
|
||||
|
|
@ -779,31 +850,43 @@ message SyncMessage {
|
|||
}
|
||||
}
|
||||
|
||||
optional Sent sent = 1;
|
||||
optional Contacts contacts = 2;
|
||||
message UsernameChange {}
|
||||
|
||||
oneof content {
|
||||
Sent sent = 1;
|
||||
Contacts contacts = 2;
|
||||
Request request = 4;
|
||||
Blocked blocked = 6;
|
||||
Verified verified = 7;
|
||||
Configuration configuration = 9;
|
||||
ViewOnceOpen viewOnceOpen = 11;
|
||||
FetchLatest fetchLatest = 12;
|
||||
Keys keys = 13;
|
||||
MessageRequestResponse messageRequestResponse = 14;
|
||||
OutgoingPayment outgoingPayment = 15;
|
||||
PniChangeNumber pniChangeNumber = 18;
|
||||
CallEvent callEvent = 19;
|
||||
CallLinkUpdate callLinkUpdate = 20;
|
||||
CallLogEvent callLogEvent = 21;
|
||||
DeleteForMe deleteForMe = 22;
|
||||
DeviceNameChange deviceNameChange = 23;
|
||||
AttachmentBackfillRequest attachmentBackfillRequest = 24;
|
||||
AttachmentBackfillResponse attachmentBackfillResponse = 25;
|
||||
UsernameChange usernameChange = 26;
|
||||
}
|
||||
|
||||
reserved /*groups*/ 3;
|
||||
optional Request request = 4;
|
||||
|
||||
// Protobufs don't allow `repeated` fields to be inside of `oneof` so while
|
||||
// the fields below are mutually exclusive with the rest of the values above
|
||||
// we have to place them outside of `oneof`.
|
||||
repeated Read read = 5;
|
||||
optional Blocked blocked = 6;
|
||||
optional Verified verified = 7;
|
||||
optional Configuration configuration = 9;
|
||||
optional bytes padding = 8;
|
||||
repeated StickerPackOperation stickerPackOperation = 10;
|
||||
optional ViewOnceOpen viewOnceOpen = 11;
|
||||
optional FetchLatest fetchLatest = 12;
|
||||
optional Keys keys = 13;
|
||||
optional MessageRequestResponse messageRequestResponse = 14;
|
||||
optional OutgoingPayment outgoingPayment = 15;
|
||||
repeated Viewed viewed = 16;
|
||||
|
||||
reserved /*pniIdentity*/ 17;
|
||||
optional PniChangeNumber pniChangeNumber = 18;
|
||||
optional CallEvent callEvent = 19;
|
||||
optional CallLinkUpdate callLinkUpdate = 20;
|
||||
optional CallLogEvent callLogEvent = 21;
|
||||
optional DeleteForMe deleteForMe = 22;
|
||||
optional DeviceNameChange deviceNameChange = 23;
|
||||
optional AttachmentBackfillRequest attachmentBackfillRequest = 24;
|
||||
optional AttachmentBackfillResponse attachmentBackfillResponse = 25;
|
||||
|
||||
optional bytes padding = 8;
|
||||
}
|
||||
|
||||
message AttachmentPointer {
|
||||
|
|
|
|||
2
pkg/signalmeow/protobuf/StickerResources.pb.go
generated
2
pkg/signalmeow/protobuf/StickerResources.pb.go
generated
|
|
@ -6,7 +6,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// protoc v7.34.1
|
||||
// source: StickerResources.proto
|
||||
|
||||
package signalpb
|
||||
|
|
|
|||
282
pkg/signalmeow/protobuf/StorageService.pb.go
generated
282
pkg/signalmeow/protobuf/StorageService.pb.go
generated
|
|
@ -6,7 +6,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// protoc v7.34.1
|
||||
// source: StorageService.proto
|
||||
|
||||
package signalpb
|
||||
|
|
@ -1401,6 +1401,7 @@ type GroupV2Record struct {
|
|||
HideStory bool `protobuf:"varint,8,opt,name=hideStory,proto3" json:"hideStory,omitempty"`
|
||||
StorySendMode GroupV2Record_StorySendMode `protobuf:"varint,10,opt,name=storySendMode,proto3,enum=signalservice.GroupV2Record_StorySendMode" json:"storySendMode,omitempty"`
|
||||
AvatarColor *AvatarColor `protobuf:"varint,11,opt,name=avatarColor,proto3,enum=signalservice.AvatarColor,oneof" json:"avatarColor,omitempty"`
|
||||
VerifiedNameHash []byte `protobuf:"bytes,12,opt,name=verifiedNameHash,proto3" json:"verifiedNameHash,omitempty"` // SHA-256 of UTF-8 encoded decrypted group title that was last verified
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -1505,6 +1506,13 @@ func (x *GroupV2Record) GetAvatarColor() AvatarColor {
|
|||
return AvatarColor_A100
|
||||
}
|
||||
|
||||
func (x *GroupV2Record) GetVerifiedNameHash() []byte {
|
||||
if x != nil {
|
||||
return x.VerifiedNameHash
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Payments struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
|
||||
|
|
@ -1558,48 +1566,52 @@ func (x *Payments) GetEntropy() []byte {
|
|||
}
|
||||
|
||||
type AccountRecord struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ProfileKey []byte `protobuf:"bytes,1,opt,name=profileKey,proto3" json:"profileKey,omitempty"`
|
||||
GivenName string `protobuf:"bytes,2,opt,name=givenName,proto3" json:"givenName,omitempty"`
|
||||
FamilyName string `protobuf:"bytes,3,opt,name=familyName,proto3" json:"familyName,omitempty"`
|
||||
AvatarUrlPath string `protobuf:"bytes,4,opt,name=avatarUrlPath,proto3" json:"avatarUrlPath,omitempty"`
|
||||
NoteToSelfArchived bool `protobuf:"varint,5,opt,name=noteToSelfArchived,proto3" json:"noteToSelfArchived,omitempty"`
|
||||
ReadReceipts bool `protobuf:"varint,6,opt,name=readReceipts,proto3" json:"readReceipts,omitempty"`
|
||||
SealedSenderIndicators bool `protobuf:"varint,7,opt,name=sealedSenderIndicators,proto3" json:"sealedSenderIndicators,omitempty"`
|
||||
TypingIndicators bool `protobuf:"varint,8,opt,name=typingIndicators,proto3" json:"typingIndicators,omitempty"`
|
||||
NoteToSelfMarkedUnread bool `protobuf:"varint,10,opt,name=noteToSelfMarkedUnread,proto3" json:"noteToSelfMarkedUnread,omitempty"`
|
||||
LinkPreviews bool `protobuf:"varint,11,opt,name=linkPreviews,proto3" json:"linkPreviews,omitempty"`
|
||||
PhoneNumberSharingMode AccountRecord_PhoneNumberSharingMode `protobuf:"varint,12,opt,name=phoneNumberSharingMode,proto3,enum=signalservice.AccountRecord_PhoneNumberSharingMode" json:"phoneNumberSharingMode,omitempty"`
|
||||
UnlistedPhoneNumber bool `protobuf:"varint,13,opt,name=unlistedPhoneNumber,proto3" json:"unlistedPhoneNumber,omitempty"`
|
||||
PinnedConversations []*AccountRecord_PinnedConversation `protobuf:"bytes,14,rep,name=pinnedConversations,proto3" json:"pinnedConversations,omitempty"`
|
||||
PreferContactAvatars bool `protobuf:"varint,15,opt,name=preferContactAvatars,proto3" json:"preferContactAvatars,omitempty"`
|
||||
Payments *Payments `protobuf:"bytes,16,opt,name=payments,proto3" json:"payments,omitempty"`
|
||||
UniversalExpireTimer uint32 `protobuf:"varint,17,opt,name=universalExpireTimer,proto3" json:"universalExpireTimer,omitempty"`
|
||||
PrimarySendsSms bool `protobuf:"varint,18,opt,name=primarySendsSms,proto3" json:"primarySendsSms,omitempty"`
|
||||
PreferredReactionEmoji []string `protobuf:"bytes,20,rep,name=preferredReactionEmoji,proto3" json:"preferredReactionEmoji,omitempty"`
|
||||
SubscriberId []byte `protobuf:"bytes,21,opt,name=subscriberId,proto3" json:"subscriberId,omitempty"`
|
||||
SubscriberCurrencyCode string `protobuf:"bytes,22,opt,name=subscriberCurrencyCode,proto3" json:"subscriberCurrencyCode,omitempty"`
|
||||
DisplayBadgesOnProfile bool `protobuf:"varint,23,opt,name=displayBadgesOnProfile,proto3" json:"displayBadgesOnProfile,omitempty"`
|
||||
SubscriptionManuallyCancelled bool `protobuf:"varint,24,opt,name=subscriptionManuallyCancelled,proto3" json:"subscriptionManuallyCancelled,omitempty"`
|
||||
KeepMutedChatsArchived bool `protobuf:"varint,25,opt,name=keepMutedChatsArchived,proto3" json:"keepMutedChatsArchived,omitempty"`
|
||||
HasSetMyStoriesPrivacy bool `protobuf:"varint,26,opt,name=hasSetMyStoriesPrivacy,proto3" json:"hasSetMyStoriesPrivacy,omitempty"`
|
||||
HasViewedOnboardingStory bool `protobuf:"varint,27,opt,name=hasViewedOnboardingStory,proto3" json:"hasViewedOnboardingStory,omitempty"`
|
||||
StoriesDisabled bool `protobuf:"varint,29,opt,name=storiesDisabled,proto3" json:"storiesDisabled,omitempty"`
|
||||
StoryViewReceiptsEnabled OptionalBool `protobuf:"varint,30,opt,name=storyViewReceiptsEnabled,proto3,enum=signalservice.OptionalBool" json:"storyViewReceiptsEnabled,omitempty"`
|
||||
HasSeenGroupStoryEducationSheet bool `protobuf:"varint,32,opt,name=hasSeenGroupStoryEducationSheet,proto3" json:"hasSeenGroupStoryEducationSheet,omitempty"`
|
||||
Username string `protobuf:"bytes,33,opt,name=username,proto3" json:"username,omitempty"`
|
||||
HasCompletedUsernameOnboarding bool `protobuf:"varint,34,opt,name=hasCompletedUsernameOnboarding,proto3" json:"hasCompletedUsernameOnboarding,omitempty"`
|
||||
UsernameLink *AccountRecord_UsernameLink `protobuf:"bytes,35,opt,name=usernameLink,proto3" json:"usernameLink,omitempty"`
|
||||
HasBackup *bool `protobuf:"varint,39,opt,name=hasBackup,proto3,oneof" json:"hasBackup,omitempty"` // Set to true after backups are enabled and one is uploaded.
|
||||
BackupTier *uint64 `protobuf:"varint,40,opt,name=backupTier,proto3,oneof" json:"backupTier,omitempty"` // See zkgroup for integer particular values. Unset if backups are not enabled.
|
||||
BackupSubscriberData *AccountRecord_IAPSubscriberData `protobuf:"bytes,41,opt,name=backupSubscriberData,proto3" json:"backupSubscriberData,omitempty"`
|
||||
AvatarColor *AvatarColor `protobuf:"varint,42,opt,name=avatarColor,proto3,enum=signalservice.AvatarColor,oneof" json:"avatarColor,omitempty"`
|
||||
BackupTierHistory *AccountRecord_BackupTierHistory `protobuf:"bytes,43,opt,name=backupTierHistory,proto3" json:"backupTierHistory,omitempty"`
|
||||
NotificationProfileManualOverride *AccountRecord_NotificationProfileManualOverride `protobuf:"bytes,44,opt,name=notificationProfileManualOverride,proto3" json:"notificationProfileManualOverride,omitempty"`
|
||||
NotificationProfileSyncDisabled bool `protobuf:"varint,45,opt,name=notificationProfileSyncDisabled,proto3" json:"notificationProfileSyncDisabled,omitempty"`
|
||||
AutomaticKeyVerificationDisabled bool `protobuf:"varint,46,opt,name=automaticKeyVerificationDisabled,proto3" json:"automaticKeyVerificationDisabled,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
ProfileKey []byte `protobuf:"bytes,1,opt,name=profileKey,proto3" json:"profileKey,omitempty"`
|
||||
GivenName string `protobuf:"bytes,2,opt,name=givenName,proto3" json:"givenName,omitempty"`
|
||||
FamilyName string `protobuf:"bytes,3,opt,name=familyName,proto3" json:"familyName,omitempty"`
|
||||
AvatarUrlPath string `protobuf:"bytes,4,opt,name=avatarUrlPath,proto3" json:"avatarUrlPath,omitempty"`
|
||||
NoteToSelfArchived bool `protobuf:"varint,5,opt,name=noteToSelfArchived,proto3" json:"noteToSelfArchived,omitempty"`
|
||||
ReadReceipts bool `protobuf:"varint,6,opt,name=readReceipts,proto3" json:"readReceipts,omitempty"`
|
||||
SealedSenderIndicators bool `protobuf:"varint,7,opt,name=sealedSenderIndicators,proto3" json:"sealedSenderIndicators,omitempty"`
|
||||
TypingIndicators bool `protobuf:"varint,8,opt,name=typingIndicators,proto3" json:"typingIndicators,omitempty"`
|
||||
NoteToSelfMarkedUnread bool `protobuf:"varint,10,opt,name=noteToSelfMarkedUnread,proto3" json:"noteToSelfMarkedUnread,omitempty"`
|
||||
LinkPreviews bool `protobuf:"varint,11,opt,name=linkPreviews,proto3" json:"linkPreviews,omitempty"`
|
||||
PhoneNumberSharingMode AccountRecord_PhoneNumberSharingMode `protobuf:"varint,12,opt,name=phoneNumberSharingMode,proto3,enum=signalservice.AccountRecord_PhoneNumberSharingMode" json:"phoneNumberSharingMode,omitempty"`
|
||||
UnlistedPhoneNumber bool `protobuf:"varint,13,opt,name=unlistedPhoneNumber,proto3" json:"unlistedPhoneNumber,omitempty"`
|
||||
PinnedConversations []*AccountRecord_PinnedConversation `protobuf:"bytes,14,rep,name=pinnedConversations,proto3" json:"pinnedConversations,omitempty"`
|
||||
PreferContactAvatars bool `protobuf:"varint,15,opt,name=preferContactAvatars,proto3" json:"preferContactAvatars,omitempty"`
|
||||
Payments *Payments `protobuf:"bytes,16,opt,name=payments,proto3" json:"payments,omitempty"`
|
||||
UniversalExpireTimer uint32 `protobuf:"varint,17,opt,name=universalExpireTimer,proto3" json:"universalExpireTimer,omitempty"`
|
||||
PrimarySendsSms bool `protobuf:"varint,18,opt,name=primarySendsSms,proto3" json:"primarySendsSms,omitempty"`
|
||||
PreferredReactionEmoji []string `protobuf:"bytes,20,rep,name=preferredReactionEmoji,proto3" json:"preferredReactionEmoji,omitempty"`
|
||||
SubscriberId []byte `protobuf:"bytes,21,opt,name=subscriberId,proto3" json:"subscriberId,omitempty"`
|
||||
SubscriberCurrencyCode string `protobuf:"bytes,22,opt,name=subscriberCurrencyCode,proto3" json:"subscriberCurrencyCode,omitempty"`
|
||||
DisplayBadgesOnProfile bool `protobuf:"varint,23,opt,name=displayBadgesOnProfile,proto3" json:"displayBadgesOnProfile,omitempty"`
|
||||
SubscriptionManuallyCancelled bool `protobuf:"varint,24,opt,name=subscriptionManuallyCancelled,proto3" json:"subscriptionManuallyCancelled,omitempty"`
|
||||
KeepMutedChatsArchived bool `protobuf:"varint,25,opt,name=keepMutedChatsArchived,proto3" json:"keepMutedChatsArchived,omitempty"`
|
||||
HasSetMyStoriesPrivacy bool `protobuf:"varint,26,opt,name=hasSetMyStoriesPrivacy,proto3" json:"hasSetMyStoriesPrivacy,omitempty"`
|
||||
HasViewedOnboardingStory bool `protobuf:"varint,27,opt,name=hasViewedOnboardingStory,proto3" json:"hasViewedOnboardingStory,omitempty"`
|
||||
StoriesDisabled bool `protobuf:"varint,29,opt,name=storiesDisabled,proto3" json:"storiesDisabled,omitempty"`
|
||||
StoryViewReceiptsEnabled OptionalBool `protobuf:"varint,30,opt,name=storyViewReceiptsEnabled,proto3,enum=signalservice.OptionalBool" json:"storyViewReceiptsEnabled,omitempty"`
|
||||
HasSeenGroupStoryEducationSheet bool `protobuf:"varint,32,opt,name=hasSeenGroupStoryEducationSheet,proto3" json:"hasSeenGroupStoryEducationSheet,omitempty"`
|
||||
Username string `protobuf:"bytes,33,opt,name=username,proto3" json:"username,omitempty"`
|
||||
HasCompletedUsernameOnboarding bool `protobuf:"varint,34,opt,name=hasCompletedUsernameOnboarding,proto3" json:"hasCompletedUsernameOnboarding,omitempty"`
|
||||
UsernameLink *AccountRecord_UsernameLink `protobuf:"bytes,35,opt,name=usernameLink,proto3" json:"usernameLink,omitempty"`
|
||||
BackupTier *uint64 `protobuf:"varint,40,opt,name=backupTier,proto3,oneof" json:"backupTier,omitempty"` // See zkgroup for integer particular values. Unset if backups are not enabled.
|
||||
BackupSubscriberData *AccountRecord_IAPSubscriberData `protobuf:"bytes,41,opt,name=backupSubscriberData,proto3" json:"backupSubscriberData,omitempty"`
|
||||
AvatarColor *AvatarColor `protobuf:"varint,42,opt,name=avatarColor,proto3,enum=signalservice.AvatarColor,oneof" json:"avatarColor,omitempty"`
|
||||
BackupTierHistory *AccountRecord_BackupTierHistory `protobuf:"bytes,43,opt,name=backupTierHistory,proto3" json:"backupTierHistory,omitempty"`
|
||||
NotificationProfileManualOverride *AccountRecord_NotificationProfileManualOverride `protobuf:"bytes,44,opt,name=notificationProfileManualOverride,proto3" json:"notificationProfileManualOverride,omitempty"`
|
||||
NotificationProfileSyncDisabled bool `protobuf:"varint,45,opt,name=notificationProfileSyncDisabled,proto3" json:"notificationProfileSyncDisabled,omitempty"`
|
||||
AutomaticKeyVerificationDisabled bool `protobuf:"varint,46,opt,name=automaticKeyVerificationDisabled,proto3" json:"automaticKeyVerificationDisabled,omitempty"`
|
||||
HasSeenAdminDeleteEducationDialog bool `protobuf:"varint,47,opt,name=hasSeenAdminDeleteEducationDialog,proto3" json:"hasSeenAdminDeleteEducationDialog,omitempty"`
|
||||
ReleaseNotesChatArchived *bool `protobuf:"varint,48,opt,name=releaseNotesChatArchived,proto3,oneof" json:"releaseNotesChatArchived,omitempty"`
|
||||
ReleaseNotesChatMutedUntilTimestamp *uint64 `protobuf:"varint,49,opt,name=releaseNotesChatMutedUntilTimestamp,proto3,oneof" json:"releaseNotesChatMutedUntilTimestamp,omitempty"`
|
||||
ReleaseNotesChatBlocked *bool `protobuf:"varint,50,opt,name=releaseNotesChatBlocked,proto3,oneof" json:"releaseNotesChatBlocked,omitempty"`
|
||||
ReleaseNotesChatMarkedUnread *bool `protobuf:"varint,51,opt,name=releaseNotesChatMarkedUnread,proto3,oneof" json:"releaseNotesChatMarkedUnread,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AccountRecord) Reset() {
|
||||
|
|
@ -1849,13 +1861,6 @@ func (x *AccountRecord) GetUsernameLink() *AccountRecord_UsernameLink {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *AccountRecord) GetHasBackup() bool {
|
||||
if x != nil && x.HasBackup != nil {
|
||||
return *x.HasBackup
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AccountRecord) GetBackupTier() uint64 {
|
||||
if x != nil && x.BackupTier != nil {
|
||||
return *x.BackupTier
|
||||
|
|
@ -1905,6 +1910,41 @@ func (x *AccountRecord) GetAutomaticKeyVerificationDisabled() bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (x *AccountRecord) GetHasSeenAdminDeleteEducationDialog() bool {
|
||||
if x != nil {
|
||||
return x.HasSeenAdminDeleteEducationDialog
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AccountRecord) GetReleaseNotesChatArchived() bool {
|
||||
if x != nil && x.ReleaseNotesChatArchived != nil {
|
||||
return *x.ReleaseNotesChatArchived
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AccountRecord) GetReleaseNotesChatMutedUntilTimestamp() uint64 {
|
||||
if x != nil && x.ReleaseNotesChatMutedUntilTimestamp != nil {
|
||||
return *x.ReleaseNotesChatMutedUntilTimestamp
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AccountRecord) GetReleaseNotesChatBlocked() bool {
|
||||
if x != nil && x.ReleaseNotesChatBlocked != nil {
|
||||
return *x.ReleaseNotesChatBlocked
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *AccountRecord) GetReleaseNotesChatMarkedUnread() bool {
|
||||
if x != nil && x.ReleaseNotesChatMarkedUnread != nil {
|
||||
return *x.ReleaseNotesChatMarkedUnread
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type StoryDistributionListRecord struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Identifier []byte `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"`
|
||||
|
|
@ -2002,7 +2042,6 @@ type CallLinkRecord struct {
|
|||
RootKey []byte `protobuf:"bytes,1,opt,name=rootKey,proto3" json:"rootKey,omitempty"`
|
||||
AdminPasskey []byte `protobuf:"bytes,2,opt,name=adminPasskey,proto3" json:"adminPasskey,omitempty"`
|
||||
DeletedAtTimestampMs uint64 `protobuf:"varint,3,opt,name=deletedAtTimestampMs,proto3" json:"deletedAtTimestampMs,omitempty"`
|
||||
Epoch []byte `protobuf:"bytes,4,opt,name=epoch,proto3,oneof" json:"epoch,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
|
@ -2058,13 +2097,6 @@ func (x *CallLinkRecord) GetDeletedAtTimestampMs() uint64 {
|
|||
return 0
|
||||
}
|
||||
|
||||
func (x *CallLinkRecord) GetEpoch() []byte {
|
||||
if x != nil {
|
||||
return x.Epoch
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type Recipient struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Types that are valid to be assigned to Identifier:
|
||||
|
|
@ -2538,6 +2570,7 @@ type AccountRecord_PinnedConversation struct {
|
|||
// *AccountRecord_PinnedConversation_Contact_
|
||||
// *AccountRecord_PinnedConversation_LegacyGroupId
|
||||
// *AccountRecord_PinnedConversation_GroupMasterKey
|
||||
// *AccountRecord_PinnedConversation_ReleaseNotes_
|
||||
Identifier isAccountRecord_PinnedConversation_Identifier `protobuf_oneof:"identifier"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
|
@ -2607,6 +2640,15 @@ func (x *AccountRecord_PinnedConversation) GetGroupMasterKey() []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *AccountRecord_PinnedConversation) GetReleaseNotes() *AccountRecord_PinnedConversation_ReleaseNotes {
|
||||
if x != nil {
|
||||
if x, ok := x.Identifier.(*AccountRecord_PinnedConversation_ReleaseNotes_); ok {
|
||||
return x.ReleaseNotes
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type isAccountRecord_PinnedConversation_Identifier interface {
|
||||
isAccountRecord_PinnedConversation_Identifier()
|
||||
}
|
||||
|
|
@ -2623,6 +2665,10 @@ type AccountRecord_PinnedConversation_GroupMasterKey struct {
|
|||
GroupMasterKey []byte `protobuf:"bytes,4,opt,name=groupMasterKey,proto3,oneof"`
|
||||
}
|
||||
|
||||
type AccountRecord_PinnedConversation_ReleaseNotes_ struct {
|
||||
ReleaseNotes *AccountRecord_PinnedConversation_ReleaseNotes `protobuf:"bytes,5,opt,name=releaseNotes,proto3,oneof"`
|
||||
}
|
||||
|
||||
func (*AccountRecord_PinnedConversation_Contact_) isAccountRecord_PinnedConversation_Identifier() {}
|
||||
|
||||
func (*AccountRecord_PinnedConversation_LegacyGroupId) isAccountRecord_PinnedConversation_Identifier() {
|
||||
|
|
@ -2631,6 +2677,9 @@ func (*AccountRecord_PinnedConversation_LegacyGroupId) isAccountRecord_PinnedCon
|
|||
func (*AccountRecord_PinnedConversation_GroupMasterKey) isAccountRecord_PinnedConversation_Identifier() {
|
||||
}
|
||||
|
||||
func (*AccountRecord_PinnedConversation_ReleaseNotes_) isAccountRecord_PinnedConversation_Identifier() {
|
||||
}
|
||||
|
||||
type AccountRecord_UsernameLink struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Entropy []byte `protobuf:"bytes,1,opt,name=entropy,proto3" json:"entropy,omitempty"` // 32 bytes of entropy used for encryption
|
||||
|
|
@ -2982,6 +3031,42 @@ func (x *AccountRecord_PinnedConversation_Contact) GetServiceIdBinary() []byte {
|
|||
return nil
|
||||
}
|
||||
|
||||
type AccountRecord_PinnedConversation_ReleaseNotes struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AccountRecord_PinnedConversation_ReleaseNotes) Reset() {
|
||||
*x = AccountRecord_PinnedConversation_ReleaseNotes{}
|
||||
mi := &file_StorageService_proto_msgTypes[25]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AccountRecord_PinnedConversation_ReleaseNotes) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AccountRecord_PinnedConversation_ReleaseNotes) ProtoMessage() {}
|
||||
|
||||
func (x *AccountRecord_PinnedConversation_ReleaseNotes) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_StorageService_proto_msgTypes[25]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AccountRecord_PinnedConversation_ReleaseNotes.ProtoReflect.Descriptor instead.
|
||||
func (*AccountRecord_PinnedConversation_ReleaseNotes) Descriptor() ([]byte, []int) {
|
||||
return file_StorageService_proto_rawDescGZIP(), []int{11, 0, 1}
|
||||
}
|
||||
|
||||
type AccountRecord_NotificationProfileManualOverride_ManuallyEnabled struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
|
|
@ -2993,7 +3078,7 @@ type AccountRecord_NotificationProfileManualOverride_ManuallyEnabled struct {
|
|||
|
||||
func (x *AccountRecord_NotificationProfileManualOverride_ManuallyEnabled) Reset() {
|
||||
*x = AccountRecord_NotificationProfileManualOverride_ManuallyEnabled{}
|
||||
mi := &file_StorageService_proto_msgTypes[25]
|
||||
mi := &file_StorageService_proto_msgTypes[26]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -3005,7 +3090,7 @@ func (x *AccountRecord_NotificationProfileManualOverride_ManuallyEnabled) String
|
|||
func (*AccountRecord_NotificationProfileManualOverride_ManuallyEnabled) ProtoMessage() {}
|
||||
|
||||
func (x *AccountRecord_NotificationProfileManualOverride_ManuallyEnabled) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_StorageService_proto_msgTypes[25]
|
||||
mi := &file_StorageService_proto_msgTypes[26]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -3046,7 +3131,7 @@ type Recipient_Contact struct {
|
|||
|
||||
func (x *Recipient_Contact) Reset() {
|
||||
*x = Recipient_Contact{}
|
||||
mi := &file_StorageService_proto_msgTypes[26]
|
||||
mi := &file_StorageService_proto_msgTypes[27]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -3058,7 +3143,7 @@ func (x *Recipient_Contact) String() string {
|
|||
func (*Recipient_Contact) ProtoMessage() {}
|
||||
|
||||
func (x *Recipient_Contact) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_StorageService_proto_msgTypes[26]
|
||||
mi := &file_StorageService_proto_msgTypes[27]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -3195,7 +3280,7 @@ const file_StorageService_proto_rawDesc = "" +
|
|||
"\vwhitelisted\x18\x03 \x01(\bR\vwhitelisted\x12\x1a\n" +
|
||||
"\barchived\x18\x04 \x01(\bR\barchived\x12\"\n" +
|
||||
"\fmarkedUnread\x18\x05 \x01(\bR\fmarkedUnread\x120\n" +
|
||||
"\x13mutedUntilTimestamp\x18\x06 \x01(\x04R\x13mutedUntilTimestamp\"\xa1\x04\n" +
|
||||
"\x13mutedUntilTimestamp\x18\x06 \x01(\x04R\x13mutedUntilTimestamp\"\xcd\x04\n" +
|
||||
"\rGroupV2Record\x12\x1c\n" +
|
||||
"\tmasterKey\x18\x01 \x01(\fR\tmasterKey\x12\x18\n" +
|
||||
"\ablocked\x18\x02 \x01(\bR\ablocked\x12 \n" +
|
||||
|
|
@ -3207,7 +3292,8 @@ const file_StorageService_proto_rawDesc = "" +
|
|||
"\thideStory\x18\b \x01(\bR\thideStory\x12P\n" +
|
||||
"\rstorySendMode\x18\n" +
|
||||
" \x01(\x0e2*.signalservice.GroupV2Record.StorySendModeR\rstorySendMode\x12A\n" +
|
||||
"\vavatarColor\x18\v \x01(\x0e2\x1a.signalservice.AvatarColorH\x00R\vavatarColor\x88\x01\x01\"7\n" +
|
||||
"\vavatarColor\x18\v \x01(\x0e2\x1a.signalservice.AvatarColorH\x00R\vavatarColor\x88\x01\x01\x12*\n" +
|
||||
"\x10verifiedNameHash\x18\f \x01(\fR\x10verifiedNameHash\"7\n" +
|
||||
"\rStorySendMode\x12\v\n" +
|
||||
"\aDEFAULT\x10\x00\x12\f\n" +
|
||||
"\bDISABLED\x10\x01\x12\v\n" +
|
||||
|
|
@ -3216,7 +3302,7 @@ const file_StorageService_proto_rawDesc = "" +
|
|||
"\">\n" +
|
||||
"\bPayments\x12\x18\n" +
|
||||
"\aenabled\x18\x01 \x01(\bR\aenabled\x12\x18\n" +
|
||||
"\aentropy\x18\x02 \x01(\fR\aentropy\"\xcb\x1c\n" +
|
||||
"\aentropy\x18\x02 \x01(\fR\aentropy\"\x84!\n" +
|
||||
"\rAccountRecord\x12\x1e\n" +
|
||||
"\n" +
|
||||
"profileKey\x18\x01 \x01(\fR\n" +
|
||||
|
|
@ -3253,25 +3339,31 @@ const file_StorageService_proto_rawDesc = "" +
|
|||
"\x1fhasSeenGroupStoryEducationSheet\x18 \x01(\bR\x1fhasSeenGroupStoryEducationSheet\x12\x1a\n" +
|
||||
"\busername\x18! \x01(\tR\busername\x12F\n" +
|
||||
"\x1ehasCompletedUsernameOnboarding\x18\" \x01(\bR\x1ehasCompletedUsernameOnboarding\x12M\n" +
|
||||
"\fusernameLink\x18# \x01(\v2).signalservice.AccountRecord.UsernameLinkR\fusernameLink\x12!\n" +
|
||||
"\thasBackup\x18' \x01(\bH\x00R\thasBackup\x88\x01\x01\x12#\n" +
|
||||
"\fusernameLink\x18# \x01(\v2).signalservice.AccountRecord.UsernameLinkR\fusernameLink\x12#\n" +
|
||||
"\n" +
|
||||
"backupTier\x18( \x01(\x04H\x01R\n" +
|
||||
"backupTier\x18( \x01(\x04H\x00R\n" +
|
||||
"backupTier\x88\x01\x01\x12b\n" +
|
||||
"\x14backupSubscriberData\x18) \x01(\v2..signalservice.AccountRecord.IAPSubscriberDataR\x14backupSubscriberData\x12A\n" +
|
||||
"\vavatarColor\x18* \x01(\x0e2\x1a.signalservice.AvatarColorH\x02R\vavatarColor\x88\x01\x01\x12\\\n" +
|
||||
"\vavatarColor\x18* \x01(\x0e2\x1a.signalservice.AvatarColorH\x01R\vavatarColor\x88\x01\x01\x12\\\n" +
|
||||
"\x11backupTierHistory\x18+ \x01(\v2..signalservice.AccountRecord.BackupTierHistoryR\x11backupTierHistory\x12\x8c\x01\n" +
|
||||
"!notificationProfileManualOverride\x18, \x01(\v2>.signalservice.AccountRecord.NotificationProfileManualOverrideR!notificationProfileManualOverride\x12H\n" +
|
||||
"\x1fnotificationProfileSyncDisabled\x18- \x01(\bR\x1fnotificationProfileSyncDisabled\x12J\n" +
|
||||
" automaticKeyVerificationDisabled\x18. \x01(\bR automaticKeyVerificationDisabled\x1a\xb0\x02\n" +
|
||||
" automaticKeyVerificationDisabled\x18. \x01(\bR automaticKeyVerificationDisabled\x12L\n" +
|
||||
"!hasSeenAdminDeleteEducationDialog\x18/ \x01(\bR!hasSeenAdminDeleteEducationDialog\x12?\n" +
|
||||
"\x18releaseNotesChatArchived\x180 \x01(\bH\x02R\x18releaseNotesChatArchived\x88\x01\x01\x12U\n" +
|
||||
"#releaseNotesChatMutedUntilTimestamp\x181 \x01(\x04H\x03R#releaseNotesChatMutedUntilTimestamp\x88\x01\x01\x12=\n" +
|
||||
"\x17releaseNotesChatBlocked\x182 \x01(\bH\x04R\x17releaseNotesChatBlocked\x88\x01\x01\x12G\n" +
|
||||
"\x1creleaseNotesChatMarkedUnread\x183 \x01(\bH\x05R\x1creleaseNotesChatMarkedUnread\x88\x01\x01\x1a\xa4\x03\n" +
|
||||
"\x12PinnedConversation\x12S\n" +
|
||||
"\acontact\x18\x01 \x01(\v27.signalservice.AccountRecord.PinnedConversation.ContactH\x00R\acontact\x12&\n" +
|
||||
"\rlegacyGroupId\x18\x03 \x01(\fH\x00R\rlegacyGroupId\x12(\n" +
|
||||
"\x0egroupMasterKey\x18\x04 \x01(\fH\x00R\x0egroupMasterKey\x1ae\n" +
|
||||
"\x0egroupMasterKey\x18\x04 \x01(\fH\x00R\x0egroupMasterKey\x12b\n" +
|
||||
"\freleaseNotes\x18\x05 \x01(\v2<.signalservice.AccountRecord.PinnedConversation.ReleaseNotesH\x00R\freleaseNotes\x1ae\n" +
|
||||
"\aContact\x12\x1c\n" +
|
||||
"\tserviceId\x18\x01 \x01(\tR\tserviceId\x12\x12\n" +
|
||||
"\x04e164\x18\x02 \x01(\tR\x04e164\x12(\n" +
|
||||
"\x0fserviceIdBinary\x18\x03 \x01(\fR\x0fserviceIdBinaryB\f\n" +
|
||||
"\x0fserviceIdBinary\x18\x03 \x01(\fR\x0fserviceIdBinary\x1a\x0e\n" +
|
||||
"\fReleaseNotesB\f\n" +
|
||||
"\n" +
|
||||
"identifier\x1a\xf8\x01\n" +
|
||||
"\fUsernameLink\x12\x18\n" +
|
||||
|
|
@ -3314,12 +3406,14 @@ const file_StorageService_proto_rawDesc = "" +
|
|||
"\aUNKNOWN\x10\x00\x12\r\n" +
|
||||
"\tEVERYBODY\x10\x01\x12\n" +
|
||||
"\n" +
|
||||
"\x06NOBODY\x10\x02B\f\n" +
|
||||
"\n" +
|
||||
"_hasBackupB\r\n" +
|
||||
"\x06NOBODY\x10\x02B\r\n" +
|
||||
"\v_backupTierB\x0e\n" +
|
||||
"\f_avatarColorJ\x04\b\t\x10\n" +
|
||||
"J\x04\b\x13\x10\x14J\x04\b\x1c\x10\x1dJ\x04\b\x1f\x10 J\x04\b$\x10%J\x04\b%\x10&J\x04\b&\x10'\"\xb9\x02\n" +
|
||||
"\f_avatarColorB\x1b\n" +
|
||||
"\x19_releaseNotesChatArchivedB&\n" +
|
||||
"$_releaseNotesChatMutedUntilTimestampB\x1a\n" +
|
||||
"\x18_releaseNotesChatBlockedB\x1f\n" +
|
||||
"\x1d_releaseNotesChatMarkedUnreadJ\x04\b\t\x10\n" +
|
||||
"J\x04\b\x13\x10\x14J\x04\b\x1c\x10\x1dJ\x04\b\x1f\x10 J\x04\b$\x10%J\x04\b%\x10&J\x04\b&\x10'J\x04\b'\x10(\"\xb9\x02\n" +
|
||||
"\x1bStoryDistributionListRecord\x12\x1e\n" +
|
||||
"\n" +
|
||||
"identifier\x18\x01 \x01(\fR\n" +
|
||||
|
|
@ -3329,13 +3423,11 @@ const file_StorageService_proto_rawDesc = "" +
|
|||
"\x12deletedAtTimestamp\x18\x04 \x01(\x04R\x12deletedAtTimestamp\x12$\n" +
|
||||
"\rallowsReplies\x18\x05 \x01(\bR\rallowsReplies\x12 \n" +
|
||||
"\visBlockList\x18\x06 \x01(\bR\visBlockList\x12<\n" +
|
||||
"\x19recipientServiceIdsBinary\x18\a \x03(\fR\x19recipientServiceIdsBinary\"\xa7\x01\n" +
|
||||
"\x19recipientServiceIdsBinary\x18\a \x03(\fR\x19recipientServiceIdsBinary\"\x88\x01\n" +
|
||||
"\x0eCallLinkRecord\x12\x18\n" +
|
||||
"\arootKey\x18\x01 \x01(\fR\arootKey\x12\"\n" +
|
||||
"\fadminPasskey\x18\x02 \x01(\fR\fadminPasskey\x122\n" +
|
||||
"\x14deletedAtTimestampMs\x18\x03 \x01(\x04R\x14deletedAtTimestampMs\x12\x19\n" +
|
||||
"\x05epoch\x18\x04 \x01(\fH\x00R\x05epoch\x88\x01\x01B\b\n" +
|
||||
"\x06_epoch\"\x90\x02\n" +
|
||||
"\x14deletedAtTimestampMs\x18\x03 \x01(\x04R\x14deletedAtTimestampMsJ\x04\b\x04\x10\x05\"\x90\x02\n" +
|
||||
"\tRecipient\x12<\n" +
|
||||
"\acontact\x18\x01 \x01(\v2 .signalservice.Recipient.ContactH\x00R\acontact\x12&\n" +
|
||||
"\rlegacyGroupId\x18\x02 \x01(\fH\x00R\rlegacyGroupId\x12(\n" +
|
||||
|
|
@ -3430,7 +3522,7 @@ func file_StorageService_proto_rawDescGZIP() []byte {
|
|||
}
|
||||
|
||||
var file_StorageService_proto_enumTypes = make([]protoimpl.EnumInfo, 9)
|
||||
var file_StorageService_proto_msgTypes = make([]protoimpl.MessageInfo, 27)
|
||||
var file_StorageService_proto_msgTypes = make([]protoimpl.MessageInfo, 28)
|
||||
var file_StorageService_proto_goTypes = []any{
|
||||
(OptionalBool)(0), // 0: signalservice.OptionalBool
|
||||
(AvatarColor)(0), // 1: signalservice.AvatarColor
|
||||
|
|
@ -3466,8 +3558,9 @@ var file_StorageService_proto_goTypes = []any{
|
|||
(*AccountRecord_BackupTierHistory)(nil), // 31: signalservice.AccountRecord.BackupTierHistory
|
||||
(*AccountRecord_NotificationProfileManualOverride)(nil), // 32: signalservice.AccountRecord.NotificationProfileManualOverride
|
||||
(*AccountRecord_PinnedConversation_Contact)(nil), // 33: signalservice.AccountRecord.PinnedConversation.Contact
|
||||
(*AccountRecord_NotificationProfileManualOverride_ManuallyEnabled)(nil), // 34: signalservice.AccountRecord.NotificationProfileManualOverride.ManuallyEnabled
|
||||
(*Recipient_Contact)(nil), // 35: signalservice.Recipient.Contact
|
||||
(*AccountRecord_PinnedConversation_ReleaseNotes)(nil), // 34: signalservice.AccountRecord.PinnedConversation.ReleaseNotes
|
||||
(*AccountRecord_NotificationProfileManualOverride_ManuallyEnabled)(nil), // 35: signalservice.AccountRecord.NotificationProfileManualOverride.ManuallyEnabled
|
||||
(*Recipient_Contact)(nil), // 36: signalservice.Recipient.Contact
|
||||
}
|
||||
var file_StorageService_proto_depIdxs = []int32{
|
||||
10, // 0: signalservice.StorageItems.items:type_name -> signalservice.StorageItem
|
||||
|
|
@ -3496,7 +3589,7 @@ var file_StorageService_proto_depIdxs = []int32{
|
|||
1, // 23: signalservice.AccountRecord.avatarColor:type_name -> signalservice.AvatarColor
|
||||
31, // 24: signalservice.AccountRecord.backupTierHistory:type_name -> signalservice.AccountRecord.BackupTierHistory
|
||||
32, // 25: signalservice.AccountRecord.notificationProfileManualOverride:type_name -> signalservice.AccountRecord.NotificationProfileManualOverride
|
||||
35, // 26: signalservice.Recipient.contact:type_name -> signalservice.Recipient.Contact
|
||||
36, // 26: signalservice.Recipient.contact:type_name -> signalservice.Recipient.Contact
|
||||
7, // 27: signalservice.ChatFolderRecord.folderType:type_name -> signalservice.ChatFolderRecord.FolderType
|
||||
23, // 28: signalservice.ChatFolderRecord.includedRecipients:type_name -> signalservice.Recipient
|
||||
23, // 29: signalservice.ChatFolderRecord.excludedRecipients:type_name -> signalservice.Recipient
|
||||
|
|
@ -3504,13 +3597,14 @@ var file_StorageService_proto_depIdxs = []int32{
|
|||
8, // 31: signalservice.NotificationProfile.scheduleDaysEnabled:type_name -> signalservice.NotificationProfile.DayOfWeek
|
||||
2, // 32: signalservice.ManifestRecord.Identifier.type:type_name -> signalservice.ManifestRecord.Identifier.Type
|
||||
33, // 33: signalservice.AccountRecord.PinnedConversation.contact:type_name -> signalservice.AccountRecord.PinnedConversation.Contact
|
||||
6, // 34: signalservice.AccountRecord.UsernameLink.color:type_name -> signalservice.AccountRecord.UsernameLink.Color
|
||||
34, // 35: signalservice.AccountRecord.NotificationProfileManualOverride.enabled:type_name -> signalservice.AccountRecord.NotificationProfileManualOverride.ManuallyEnabled
|
||||
36, // [36:36] is the sub-list for method output_type
|
||||
36, // [36:36] is the sub-list for method input_type
|
||||
36, // [36:36] is the sub-list for extension type_name
|
||||
36, // [36:36] is the sub-list for extension extendee
|
||||
0, // [0:36] is the sub-list for field type_name
|
||||
34, // 34: signalservice.AccountRecord.PinnedConversation.releaseNotes:type_name -> signalservice.AccountRecord.PinnedConversation.ReleaseNotes
|
||||
6, // 35: signalservice.AccountRecord.UsernameLink.color:type_name -> signalservice.AccountRecord.UsernameLink.Color
|
||||
35, // 36: signalservice.AccountRecord.NotificationProfileManualOverride.enabled:type_name -> signalservice.AccountRecord.NotificationProfileManualOverride.ManuallyEnabled
|
||||
37, // [37:37] is the sub-list for method output_type
|
||||
37, // [37:37] is the sub-list for method input_type
|
||||
37, // [37:37] is the sub-list for extension type_name
|
||||
37, // [37:37] is the sub-list for extension extendee
|
||||
0, // [0:37] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_StorageService_proto_init() }
|
||||
|
|
@ -3531,7 +3625,6 @@ func file_StorageService_proto_init() {
|
|||
file_StorageService_proto_msgTypes[7].OneofWrappers = []any{}
|
||||
file_StorageService_proto_msgTypes[9].OneofWrappers = []any{}
|
||||
file_StorageService_proto_msgTypes[11].OneofWrappers = []any{}
|
||||
file_StorageService_proto_msgTypes[13].OneofWrappers = []any{}
|
||||
file_StorageService_proto_msgTypes[14].OneofWrappers = []any{
|
||||
(*Recipient_Contact_)(nil),
|
||||
(*Recipient_LegacyGroupId)(nil),
|
||||
|
|
@ -3542,6 +3635,7 @@ func file_StorageService_proto_init() {
|
|||
(*AccountRecord_PinnedConversation_Contact_)(nil),
|
||||
(*AccountRecord_PinnedConversation_LegacyGroupId)(nil),
|
||||
(*AccountRecord_PinnedConversation_GroupMasterKey)(nil),
|
||||
(*AccountRecord_PinnedConversation_ReleaseNotes_)(nil),
|
||||
}
|
||||
file_StorageService_proto_msgTypes[21].OneofWrappers = []any{
|
||||
(*AccountRecord_IAPSubscriberData_PurchaseToken)(nil),
|
||||
|
|
@ -3558,7 +3652,7 @@ func file_StorageService_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_StorageService_proto_rawDesc), len(file_StorageService_proto_rawDesc)),
|
||||
NumEnums: 9,
|
||||
NumMessages: 27,
|
||||
NumMessages: 28,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -172,6 +172,7 @@ message GroupV2Record {
|
|||
reserved /* storySendEnabled */ 9;
|
||||
StorySendMode storySendMode = 10;
|
||||
optional AvatarColor avatarColor = 11;
|
||||
bytes verifiedNameHash = 12; // SHA-256 of UTF-8 encoded decrypted group title that was last verified
|
||||
}
|
||||
|
||||
message Payments {
|
||||
|
|
@ -194,10 +195,13 @@ message AccountRecord {
|
|||
bytes serviceIdBinary = 3; // service ID binary (i.e. 16 byte UUID for ACI, 1 byte prefix + 16 byte UUID for PNI)
|
||||
}
|
||||
|
||||
message ReleaseNotes {}
|
||||
|
||||
oneof identifier {
|
||||
Contact contact = 1;
|
||||
bytes legacyGroupId = 3;
|
||||
bytes groupMasterKey = 4;
|
||||
Contact contact = 1;
|
||||
bytes legacyGroupId = 3;
|
||||
bytes groupMasterKey = 4;
|
||||
ReleaseNotes releaseNotes = 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -288,7 +292,7 @@ message AccountRecord {
|
|||
reserved /* backupsSubscriberId */ 36;
|
||||
reserved /* backupsSubscriberCurrencyCode */ 37;
|
||||
reserved /* backupsSubscriptionManuallyCancelled */ 38;
|
||||
optional bool hasBackup = 39; // Set to true after backups are enabled and one is uploaded.
|
||||
reserved /* hasBackup */ 39;
|
||||
optional uint64 backupTier = 40; // See zkgroup for integer particular values. Unset if backups are not enabled.
|
||||
IAPSubscriberData backupSubscriberData = 41;
|
||||
optional AvatarColor avatarColor = 42;
|
||||
|
|
@ -296,6 +300,11 @@ message AccountRecord {
|
|||
NotificationProfileManualOverride notificationProfileManualOverride = 44;
|
||||
bool notificationProfileSyncDisabled = 45;
|
||||
bool automaticKeyVerificationDisabled = 46;
|
||||
bool hasSeenAdminDeleteEducationDialog = 47;
|
||||
optional bool releaseNotesChatArchived = 48;
|
||||
optional uint64 releaseNotesChatMutedUntilTimestamp = 49;
|
||||
optional bool releaseNotesChatBlocked = 50;
|
||||
optional bool releaseNotesChatMarkedUnread = 51;
|
||||
}
|
||||
|
||||
message StoryDistributionListRecord {
|
||||
|
|
@ -312,7 +321,7 @@ message CallLinkRecord {
|
|||
bytes rootKey = 1;
|
||||
bytes adminPasskey = 2;
|
||||
uint64 deletedAtTimestampMs = 3;
|
||||
optional bytes epoch = 4;
|
||||
reserved 4; // was epoch field, never used
|
||||
}
|
||||
|
||||
message Recipient {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// protoc v7.34.1
|
||||
// source: UnidentifiedDelivery.proto
|
||||
|
||||
// Copyright 2018 Signal Messenger, LLC
|
||||
|
|
|
|||
6
pkg/signalmeow/protobuf/WebSocketResources.pb.go
generated
6
pkg/signalmeow/protobuf/WebSocketResources.pb.go
generated
|
|
@ -6,7 +6,7 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v6.33.5
|
||||
// protoc v7.34.1
|
||||
// source: WebSocketResources.proto
|
||||
|
||||
package signalpb
|
||||
|
|
@ -321,8 +321,8 @@ const file_WebSocketResources_proto_rawDesc = "" +
|
|||
"\x04Type\x12\v\n" +
|
||||
"\aUNKNOWN\x10\x00\x12\v\n" +
|
||||
"\aREQUEST\x10\x01\x12\f\n" +
|
||||
"\bRESPONSE\x10\x02BF\n" +
|
||||
"3org.whispersystems.signalservice.internal.websocketB\x0fWebSocketProtos"
|
||||
"\bRESPONSE\x10\x02B/\n" +
|
||||
"\x1corg.signal.network.websocketB\x0fWebSocketProtos"
|
||||
|
||||
var (
|
||||
file_WebSocketResources_proto_rawDescOnce sync.Once
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ syntax = "proto2";
|
|||
|
||||
package signalservice;
|
||||
|
||||
option java_package = "org.whispersystems.signalservice.internal.websocket";
|
||||
option java_package = "org.signal.network.websocket";
|
||||
option java_outer_classname = "WebSocketProtos";
|
||||
|
||||
message WebSocketRequestMessage {
|
||||
|
|
|
|||
1434
pkg/signalmeow/protobuf/backuppb/Backup.pb.go
generated
1434
pkg/signalmeow/protobuf/backuppb/Backup.pb.go
generated
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@ syntax = "proto3";
|
|||
|
||||
package signal.backup;
|
||||
|
||||
option java_package = "org.thoughtcrime.securesms.backup.v2.proto";
|
||||
option java_package = "org.signal.archive.proto";
|
||||
option swift_prefix = "BackupProto_";
|
||||
|
||||
message BackupInfo {
|
||||
|
|
@ -135,6 +135,7 @@ message AccountData {
|
|||
CallsUseLessDataSetting callsUseLessDataSetting = 29; // If unset, treat the same as "Unknown" case
|
||||
bool allowSealedSenderFromAnyone = 30;
|
||||
bool allowAutomaticKeyVerification = 31;
|
||||
bool hasSeenAdminDeleteEducationDialog = 32;
|
||||
}
|
||||
|
||||
message SubscriberData {
|
||||
|
|
@ -181,7 +182,7 @@ message AccountData {
|
|||
AndroidSpecificSettings androidSpecificSettings = 12;
|
||||
string bioText = 13;
|
||||
string bioEmoji = 14;
|
||||
optional bytes keyTransparencyData = 15;
|
||||
reserved /*keyTransparencyData*/ 15; // No longer want to persist self-KT data
|
||||
}
|
||||
|
||||
message Recipient {
|
||||
|
|
@ -307,6 +308,7 @@ message Group {
|
|||
bytes inviteLinkPassword = 10;
|
||||
bool announcements_only = 12;
|
||||
repeated MemberBanned members_banned = 13;
|
||||
bool terminated = 14;
|
||||
}
|
||||
|
||||
message GroupAttributeBlob {
|
||||
|
|
@ -331,6 +333,8 @@ message Group {
|
|||
reserved /*profileKey*/ 3; // This field is ignored in Backups, in favor of Contact frames for members
|
||||
reserved /*presentation*/ 4; // This field is deprecated in the context of static group state
|
||||
uint32 joinedAtVersion = 5;
|
||||
string labelEmoji = 6;
|
||||
string labelString = 7;
|
||||
}
|
||||
|
||||
message MemberPendingProfileKey {
|
||||
|
|
@ -363,6 +367,7 @@ message Group {
|
|||
AccessRequired attributes = 1;
|
||||
AccessRequired members = 2;
|
||||
AccessRequired addFromInviteLink = 3;
|
||||
AccessRequired memberLabel = 4;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -405,7 +410,7 @@ message CallLink {
|
|||
string name = 3;
|
||||
Restrictions restrictions = 4;
|
||||
uint64 expirationMs = 5;
|
||||
optional bytes epoch = 6; // May be absent/empty for older links
|
||||
reserved /*epoch*/ 6;
|
||||
}
|
||||
|
||||
message AdHocCall {
|
||||
|
|
@ -498,6 +503,7 @@ message ChatItem {
|
|||
ViewOnceMessage viewOnceMessage = 18;
|
||||
DirectStoryReplyMessage directStoryReplyMessage = 19; // group story reply messages are not backed up
|
||||
Poll poll = 20;
|
||||
AdminDeletedMessage adminDeletedMessage = 22;
|
||||
}
|
||||
|
||||
PinDetails pinDetails = 21; // only set if message is pinned
|
||||
|
|
@ -898,6 +904,10 @@ message Poll {
|
|||
repeated Reaction reactions = 5;
|
||||
}
|
||||
|
||||
message AdminDeletedMessage {
|
||||
uint64 adminId = 1; // id of the admin that deleted the message
|
||||
}
|
||||
|
||||
message ChatUpdateMessage {
|
||||
// If unset, importers should ignore the update message without throwing an error.
|
||||
oneof update {
|
||||
|
|
@ -1068,6 +1078,8 @@ message GroupChangeChatUpdate {
|
|||
GroupV2MigrationDroppedMembersUpdate groupV2MigrationDroppedMembersUpdate = 32;
|
||||
GroupSequenceOfRequestsAndCancelsUpdate groupSequenceOfRequestsAndCancelsUpdate = 33;
|
||||
GroupExpirationTimerUpdate groupExpirationTimerUpdate = 34;
|
||||
GroupMemberLabelAccessLevelChangeUpdate groupMemberLabelAccessLevelChangeUpdate = 35;
|
||||
GroupTerminateChangeUpdate groupTerminateChangeUpdate = 36;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1119,6 +1131,15 @@ message GroupAttributesAccessLevelChangeUpdate {
|
|||
GroupV2AccessLevel accessLevel = 2;
|
||||
}
|
||||
|
||||
message GroupMemberLabelAccessLevelChangeUpdate {
|
||||
optional bytes updaterAci = 1;
|
||||
GroupV2AccessLevel accessLevel = 2;
|
||||
}
|
||||
|
||||
message GroupTerminateChangeUpdate {
|
||||
optional bytes updaterAci = 1;
|
||||
}
|
||||
|
||||
message GroupAnnouncementOnlyChangeUpdate {
|
||||
optional bytes updaterAci = 1;
|
||||
bool isAnnouncementOnly = 2;
|
||||
|
|
|
|||
|
|
@ -12,4 +12,8 @@ protoc --go_out=. \
|
|||
--go_opt=Mbackuppb/Backup.proto=$PKG_IMPORT_PATH/backuppb \
|
||||
--go_opt=paths=source_relative \
|
||||
backuppb/Backup.proto
|
||||
protoc --go_out=. \
|
||||
--go_opt=Mcds2pb/cds2.proto=$PKG_IMPORT_PATH/cds2pb \
|
||||
--go_opt=paths=source_relative \
|
||||
cds2pb/cds2.proto
|
||||
pre-commit run -a
|
||||
|
|
|
|||
259
pkg/signalmeow/protobuf/cds2pb/cds2.pb.go
generated
Normal file
259
pkg/signalmeow/protobuf/cds2pb/cds2.pb.go
generated
Normal file
|
|
@ -0,0 +1,259 @@
|
|||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v7.34.1
|
||||
// source: cds2pb/cds2.proto
|
||||
|
||||
package cds2pb
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
type ClientRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Each ACI/UAK pair is a 32-byte buffer, containing the 16-byte ACI followed
|
||||
// by its 16-byte UAK.
|
||||
AciUakPairs []byte `protobuf:"bytes,1,opt,name=aci_uak_pairs,json=aciUakPairs,proto3" json:"aci_uak_pairs,omitempty"`
|
||||
// Each E164 is an 8-byte big-endian number, as 8 bytes.
|
||||
PrevE164S []byte `protobuf:"bytes,2,opt,name=prev_e164s,json=prevE164s,proto3" json:"prev_e164s,omitempty"`
|
||||
NewE164S []byte `protobuf:"bytes,3,opt,name=new_e164s,json=newE164s,proto3" json:"new_e164s,omitempty"`
|
||||
DiscardE164S []byte `protobuf:"bytes,4,opt,name=discard_e164s,json=discardE164s,proto3" json:"discard_e164s,omitempty"`
|
||||
// If set, a token which allows rate limiting to discount the e164s in
|
||||
// the request's prev_e164s, only counting new_e164s. If not set, then
|
||||
// rate limiting considers both prev_e164s' and new_e164s' size.
|
||||
Token []byte `protobuf:"bytes,6,opt,name=token,proto3" json:"token,omitempty"`
|
||||
// After receiving a new token from the server, send back a message just
|
||||
// containing a token_ack.
|
||||
TokenAck bool `protobuf:"varint,7,opt,name=token_ack,json=tokenAck,proto3" json:"token_ack,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ClientRequest) Reset() {
|
||||
*x = ClientRequest{}
|
||||
mi := &file_cds2pb_cds2_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ClientRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ClientRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ClientRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cds2pb_cds2_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ClientRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ClientRequest) Descriptor() ([]byte, []int) {
|
||||
return file_cds2pb_cds2_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *ClientRequest) GetAciUakPairs() []byte {
|
||||
if x != nil {
|
||||
return x.AciUakPairs
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ClientRequest) GetPrevE164S() []byte {
|
||||
if x != nil {
|
||||
return x.PrevE164S
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ClientRequest) GetNewE164S() []byte {
|
||||
if x != nil {
|
||||
return x.NewE164S
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ClientRequest) GetDiscardE164S() []byte {
|
||||
if x != nil {
|
||||
return x.DiscardE164S
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ClientRequest) GetToken() []byte {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ClientRequest) GetTokenAck() bool {
|
||||
if x != nil {
|
||||
return x.TokenAck
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ClientResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
// Each triple is an 8-byte e164, a 16-byte PNI, and a 16-byte ACI.
|
||||
// If the e164 was not found, PNI and ACI are all zeros. If the PNI
|
||||
// was found but the ACI was not, the PNI will be non-zero and the ACI
|
||||
// will be all zeros. ACI will be returned if one of the returned
|
||||
// PNIs has an ACI/UAK pair that matches.
|
||||
//
|
||||
// Should the request be successful (IE: a successful status returned),
|
||||
// |e164_pni_aci_triple| will always equal |e164| of the request,
|
||||
// so the entire marshalled size of the response will be (2+32)*|e164|,
|
||||
// where the additional 2 bytes are the id/type/length additions of the
|
||||
// protobuf marshaling added to each byte array. This avoids any data
|
||||
// leakage based on the size of the encrypted output.
|
||||
E164PniAciTriples []byte `protobuf:"bytes,1,opt,name=e164_pni_aci_triples,json=e164PniAciTriples,proto3" json:"e164_pni_aci_triples,omitempty"`
|
||||
// A token which allows subsequent calls' rate limiting to discount the
|
||||
// e164s sent up in this request, only counting those in the next
|
||||
// request's new_e164s.
|
||||
Token []byte `protobuf:"bytes,3,opt,name=token,proto3" json:"token,omitempty"`
|
||||
// On a successful response to a token_ack request, the number of permits
|
||||
// that were deducted from the user's rate-limit in order to process the
|
||||
// request
|
||||
DebugPermitsUsed int32 `protobuf:"varint,4,opt,name=debug_permits_used,json=debugPermitsUsed,proto3" json:"debug_permits_used,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ClientResponse) Reset() {
|
||||
*x = ClientResponse{}
|
||||
mi := &file_cds2pb_cds2_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ClientResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ClientResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ClientResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_cds2pb_cds2_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ClientResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ClientResponse) Descriptor() ([]byte, []int) {
|
||||
return file_cds2pb_cds2_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *ClientResponse) GetE164PniAciTriples() []byte {
|
||||
if x != nil {
|
||||
return x.E164PniAciTriples
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ClientResponse) GetToken() []byte {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ClientResponse) GetDebugPermitsUsed() int32 {
|
||||
if x != nil {
|
||||
return x.DebugPermitsUsed
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
var File_cds2pb_cds2_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_cds2pb_cds2_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
"\x11cds2pb/cds2.proto\x12\x0forg.signal.cdsi\"\xd3\x01\n" +
|
||||
"\rClientRequest\x12\"\n" +
|
||||
"\raci_uak_pairs\x18\x01 \x01(\fR\vaciUakPairs\x12\x1d\n" +
|
||||
"\n" +
|
||||
"prev_e164s\x18\x02 \x01(\fR\tprevE164s\x12\x1b\n" +
|
||||
"\tnew_e164s\x18\x03 \x01(\fR\bnewE164s\x12#\n" +
|
||||
"\rdiscard_e164s\x18\x04 \x01(\fR\fdiscardE164s\x12\x14\n" +
|
||||
"\x05token\x18\x06 \x01(\fR\x05token\x12\x1b\n" +
|
||||
"\ttoken_ack\x18\a \x01(\bR\btokenAckJ\x04\b\x05\x10\x06J\x04\b\b\x10\t\"\x8b\x01\n" +
|
||||
"\x0eClientResponse\x12/\n" +
|
||||
"\x14e164_pni_aci_triples\x18\x01 \x01(\fR\x11e164PniAciTriples\x12\x14\n" +
|
||||
"\x05token\x18\x03 \x01(\fR\x05token\x12,\n" +
|
||||
"\x12debug_permits_used\x18\x04 \x01(\x05R\x10debugPermitsUsedJ\x04\b\x02\x10\x03b\x06proto3"
|
||||
|
||||
var (
|
||||
file_cds2pb_cds2_proto_rawDescOnce sync.Once
|
||||
file_cds2pb_cds2_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_cds2pb_cds2_proto_rawDescGZIP() []byte {
|
||||
file_cds2pb_cds2_proto_rawDescOnce.Do(func() {
|
||||
file_cds2pb_cds2_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_cds2pb_cds2_proto_rawDesc), len(file_cds2pb_cds2_proto_rawDesc)))
|
||||
})
|
||||
return file_cds2pb_cds2_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_cds2pb_cds2_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
|
||||
var file_cds2pb_cds2_proto_goTypes = []any{
|
||||
(*ClientRequest)(nil), // 0: org.signal.cdsi.ClientRequest
|
||||
(*ClientResponse)(nil), // 1: org.signal.cdsi.ClientResponse
|
||||
}
|
||||
var file_cds2pb_cds2_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
0, // [0:0] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_cds2pb_cds2_proto_init() }
|
||||
func file_cds2pb_cds2_proto_init() {
|
||||
if File_cds2pb_cds2_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_cds2pb_cds2_proto_rawDesc), len(file_cds2pb_cds2_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 2,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
GoTypes: file_cds2pb_cds2_proto_goTypes,
|
||||
DependencyIndexes: file_cds2pb_cds2_proto_depIdxs,
|
||||
MessageInfos: file_cds2pb_cds2_proto_msgTypes,
|
||||
}.Build()
|
||||
File_cds2pb_cds2_proto = out.File
|
||||
file_cds2pb_cds2_proto_goTypes = nil
|
||||
file_cds2pb_cds2_proto_depIdxs = nil
|
||||
}
|
||||
|
|
@ -1,37 +1,36 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
syntax = "proto3";
|
||||
|
||||
package signalservice;
|
||||
package org.signal.cdsi;
|
||||
|
||||
message CDSClientRequest {
|
||||
message ClientRequest {
|
||||
// Each ACI/UAK pair is a 32-byte buffer, containing the 16-byte ACI followed
|
||||
// by its 16-byte UAK.
|
||||
optional bytes aci_uak_pairs = 1;
|
||||
bytes aci_uak_pairs = 1;
|
||||
|
||||
// Each E164 is an 8-byte big-endian number, as 8 bytes.
|
||||
optional bytes prev_e164s = 2;
|
||||
optional bytes new_e164s = 3;
|
||||
optional bytes discard_e164s = 4;
|
||||
bytes prev_e164s = 2;
|
||||
bytes new_e164s = 3;
|
||||
bytes discard_e164s = 4;
|
||||
|
||||
// If true, the client has more pairs or e164s to send. If false or unset,
|
||||
// this is the client's last request, and processing should commence.
|
||||
optional bool has_more = 5;
|
||||
// bool has_more = 5;
|
||||
reserved 5;
|
||||
|
||||
// If set, a token which allows rate limiting to discount the e164s in
|
||||
// the request's prev_e164s, only counting new_e164s. If not set, then
|
||||
// rate limiting considers both prev_e164s' and new_e164s' size.
|
||||
optional bytes token = 6;
|
||||
bytes token = 6;
|
||||
|
||||
// After receiving a new token from the server, send back a message just
|
||||
// containing a token_ack.
|
||||
optional bool token_ack = 7;
|
||||
bool token_ack = 7;
|
||||
|
||||
// Request that, if the server allows, both ACI and PNI be returned even
|
||||
// if the aci_uak_pairs don't match.
|
||||
optional bool return_acis_without_uaks = 8;
|
||||
// [deprecated] bool return_acis_without_uaks = 8
|
||||
reserved 8;
|
||||
}
|
||||
|
||||
message CDSClientResponse {
|
||||
message ClientResponse {
|
||||
// Each triple is an 8-byte e164, a 16-byte PNI, and a 16-byte ACI.
|
||||
// If the e164 was not found, PNI and ACI are all zeros. If the PNI
|
||||
// was found but the ACI was not, the PNI will be non-zero and the ACI
|
||||
|
|
@ -44,10 +43,18 @@ message CDSClientResponse {
|
|||
// where the additional 2 bytes are the id/type/length additions of the
|
||||
// protobuf marshaling added to each byte array. This avoids any data
|
||||
// leakage based on the size of the encrypted output.
|
||||
optional bytes e164_pni_aci_triples = 1;
|
||||
bytes e164_pni_aci_triples = 1;
|
||||
|
||||
// int32 retry_after_secs = 2 [deprecated]
|
||||
reserved 2;
|
||||
|
||||
// A token which allows subsequent calls' rate limiting to discount the
|
||||
// e164s sent up in this request, only counting those in the next
|
||||
// request's new_e164s.
|
||||
optional bytes token = 3;
|
||||
bytes token = 3;
|
||||
|
||||
// On a successful response to a token_ack request, the number of permits
|
||||
// that were deducted from the user's rate-limit in order to process the
|
||||
// request
|
||||
int32 debug_permits_used = 4;
|
||||
}
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
ANDROID_GIT_REVISION=${1:-bc6114f6e0d3a4b1dcdc472331505f2644185264}
|
||||
DESKTOP_GIT_REVISION=${1:-a9063ec0c3c1079072c1e30e0749c1ae8be5500a}
|
||||
ANDROID_GIT_REVISION=${1:-aa9591211ba0c77376318bdd5f014e064b8e8de4}
|
||||
DESKTOP_GIT_REVISION=${2:-a0af83d7488930c213a7b6dd554490ebe9e65628}
|
||||
LIBSIGNAL_GIT_REVISION=${3:-46d867c986f66201e34e7ae20ce423eec742bf3f}
|
||||
|
||||
update_proto() {
|
||||
case "$1" in
|
||||
|
|
@ -11,9 +12,14 @@ update_proto() {
|
|||
prefix="lib/libsignal-service/src/main/protowire/"
|
||||
GIT_REVISION=$ANDROID_GIT_REVISION
|
||||
;;
|
||||
Signal-Android-App)
|
||||
Signal-Android-Archive)
|
||||
REPO="Signal-Android"
|
||||
prefix="app/src/main/protowire/"
|
||||
prefix="lib/archive/src/main/protowire/"
|
||||
GIT_REVISION=$ANDROID_GIT_REVISION
|
||||
;;
|
||||
Signal-Android-Network)
|
||||
REPO="Signal-Android"
|
||||
prefix="core/network/src/main/protowire/"
|
||||
GIT_REVISION=$ANDROID_GIT_REVISION
|
||||
;;
|
||||
Signal-Desktop)
|
||||
|
|
@ -21,6 +27,11 @@ update_proto() {
|
|||
prefix="protos/"
|
||||
GIT_REVISION=$DESKTOP_GIT_REVISION
|
||||
;;
|
||||
libsignal)
|
||||
REPO="libsignal"
|
||||
prefix="rust/net/src/proto/"
|
||||
GIT_REVISION=$LIBSIGNAL_GIT_REVISION
|
||||
;;
|
||||
esac
|
||||
echo https://raw.githubusercontent.com/signalapp/${REPO}/${GIT_REVISION}/${prefix}${2}
|
||||
curl -LOf https://raw.githubusercontent.com/signalapp/${REPO}/${GIT_REVISION}/${prefix}${2}
|
||||
|
|
@ -31,14 +42,14 @@ update_proto Signal-Android Groups.proto
|
|||
update_proto Signal-Android Provisioning.proto
|
||||
update_proto Signal-Android SignalService.proto
|
||||
update_proto Signal-Android StickerResources.proto
|
||||
update_proto Signal-Android WebSocketResources.proto
|
||||
update_proto Signal-Android-Network WebSocketResources.proto
|
||||
update_proto Signal-Android StorageService.proto
|
||||
|
||||
update_proto Signal-Android-App Backup.proto
|
||||
update_proto Signal-Android-Archive Backup.proto
|
||||
mv Backup.proto backuppb/Backup.proto
|
||||
|
||||
update_proto Signal-Desktop DeviceName.proto
|
||||
# TODO this was moved to libsignal only
|
||||
update_proto libsignal cds2.proto
|
||||
mv cds2.proto cds2pb/cds2.proto
|
||||
# TODO these were moved to libsignal only
|
||||
#update_proto Signal-Desktop UnidentifiedDelivery.proto
|
||||
# Android has CDSI.proto too, but the types have more generic names (since android uses a different package name)
|
||||
update_proto Signal-Desktop ContactDiscovery.proto
|
||||
|
|
|
|||
|
|
@ -18,7 +18,6 @@ package signalmeow
|
|||
|
||||
import (
|
||||
"context"
|
||||
"crypto/hmac"
|
||||
"encoding/base64"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
|
|
@ -166,24 +165,19 @@ func PerformProvisioning(ctx context.Context, deviceStore store.DeviceStore, dev
|
|||
DeviceID: deviceId,
|
||||
Number: *provisioningMessage.Number,
|
||||
Password: password,
|
||||
MasterKey: provisioningMessage.GetMasterKey(),
|
||||
AccountEntropyPool: libsignalgo.AccountEntropyPool(provisioningMessage.GetAccountEntropyPool()),
|
||||
EphemeralBackupKey: libsignalgo.BytesToBackupKey(provisioningMessage.GetEphemeralBackupKey()),
|
||||
MediaRootBackupKey: libsignalgo.BytesToBackupKey(provisioningMessage.GetMediaRootBackupKey()),
|
||||
}
|
||||
if provisioningMessage.GetAccountEntropyPool() != "" {
|
||||
var masterKey []byte
|
||||
masterKey, err = libsignalgo.AccountEntropyPool(provisioningMessage.GetAccountEntropyPool()).DeriveSVRKey()
|
||||
data.MasterKey, err = libsignalgo.AccountEntropyPool(provisioningMessage.GetAccountEntropyPool()).DeriveSVRKey()
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to derive master key from account entropy pool")
|
||||
} else {
|
||||
log.Debug().Msg("Derived master key from account entropy pool")
|
||||
}
|
||||
if data.MasterKey == nil {
|
||||
data.MasterKey = masterKey
|
||||
} else if !hmac.Equal(data.MasterKey, masterKey) {
|
||||
log.Warn().Msg("Master key mismatch")
|
||||
}
|
||||
} else {
|
||||
log.Warn().Msg("No account entropy pool in provisioning message")
|
||||
}
|
||||
|
||||
// Store the provisioning data
|
||||
|
|
@ -274,7 +268,7 @@ func startProvisioning(ctx context.Context, ws *websocket.Conn, provisioningCiph
|
|||
return "", fmt.Errorf("failed to unmarshal provisioning UUID: %w", err)
|
||||
}
|
||||
|
||||
linkCapabilities := []string{"backup4,backup5"}
|
||||
linkCapabilities := []string{"backup5"}
|
||||
if !allowBackup {
|
||||
linkCapabilities = []string{}
|
||||
}
|
||||
|
|
@ -334,8 +328,9 @@ func continueProvisioning(ctx context.Context, ws *websocket.Conn, provisioningC
|
|||
}
|
||||
|
||||
var signalCapabilities = map[string]any{
|
||||
"attachmentBackfill": true,
|
||||
"spqr": true,
|
||||
"attachmentBackfill": true,
|
||||
"spqr": true,
|
||||
"usernameChangeSyncMessage": true,
|
||||
}
|
||||
|
||||
var signalCapabilitiesBody = exerrors.Must(json.Marshal(signalCapabilities))
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ func (cli *Client) incomingAPIMessageHandler(ctx context.Context, req *signalpb.
|
|||
return nil, err
|
||||
}
|
||||
log = log.With().
|
||||
Uint64("envelope_timestamp", envelope.GetTimestamp()).
|
||||
Uint64("envelope_timestamp", envelope.GetClientTimestamp()).
|
||||
Uint64("server_timestamp", envelope.GetServerTimestamp()).
|
||||
Logger()
|
||||
ctx = log.WithContext(ctx)
|
||||
|
|
@ -368,7 +368,7 @@ func (cli *Client) incomingAPIMessageHandler(ctx context.Context, req *signalpb.
|
|||
Str("source_service_id", envelope.GetSourceServiceId()).
|
||||
Hex("destination_service_id_bytes", envelope.GetDestinationServiceIdBinary()).
|
||||
Hex("source_service_id_bytes", envelope.GetSourceServiceIdBinary()).
|
||||
Uint32("source_device_id", envelope.GetSourceDevice()).
|
||||
Uint32("source_device_id", envelope.GetSourceDeviceId()).
|
||||
Object("parsed_destination_service_id", destinationServiceID).
|
||||
Object("parsed_source_service_id", sourceServiceID).
|
||||
Int32("envelope_type_id", int32(envelope.GetType())).
|
||||
|
|
@ -414,8 +414,12 @@ func (cli *Client) handleDecryptedResult(
|
|||
return ctx.Err()
|
||||
}
|
||||
log := zerolog.Ctx(ctx)
|
||||
if result.CiphertextHash != nil {
|
||||
defer func() {
|
||||
handlerSuccess := true
|
||||
defer func() {
|
||||
if retErr == nil && !handlerSuccess {
|
||||
retErr = ErrHandlerFailed
|
||||
}
|
||||
if result.CiphertextHash != nil && handlerSuccess {
|
||||
err := cli.Store.EventBuffer.ClearBufferedEventPlaintext(ctx, *result.CiphertextHash)
|
||||
if err != nil {
|
||||
log.Err(err).
|
||||
|
|
@ -426,8 +430,10 @@ func (cli *Client) handleDecryptedResult(
|
|||
Hex("ciphertext_hash", result.CiphertextHash[:]).
|
||||
Msg("Deleted event plaintext from buffer")
|
||||
}
|
||||
}()
|
||||
}
|
||||
} else if result.CiphertextHash != nil {
|
||||
log.Warn().Msg("Not clearing buffered event plaintext due to handler failure")
|
||||
}
|
||||
}()
|
||||
|
||||
var theirServiceID libsignalgo.ServiceID
|
||||
var err error
|
||||
|
|
@ -436,31 +442,25 @@ func (cli *Client) handleDecryptedResult(
|
|||
Bool("urgent", envelope.GetUrgent()).
|
||||
Stringer("content_hint", result.ContentHint).
|
||||
Uint64("server_ts", envelope.GetServerTimestamp()).
|
||||
Uint64("client_ts", envelope.GetTimestamp()).
|
||||
Uint64("client_ts", envelope.GetClientTimestamp()).
|
||||
Msg("No sender address received")
|
||||
return nil
|
||||
} else if theirServiceID, err = result.SenderAddress.NameServiceID(); err != nil {
|
||||
log.Warn().
|
||||
Uint64("server_ts", envelope.GetServerTimestamp()).
|
||||
Uint64("client_ts", envelope.GetTimestamp()).
|
||||
Uint64("client_ts", envelope.GetClientTimestamp()).
|
||||
Msg("Failed to get sender name as service ID")
|
||||
return fmt.Errorf("failed to get sender name as service ID: %w", err)
|
||||
} else if theirServiceID.Type != libsignalgo.ServiceIDTypeACI {
|
||||
log.Warn().
|
||||
Any("their_service_id", theirServiceID).
|
||||
Uint64("server_ts", envelope.GetServerTimestamp()).
|
||||
Uint64("client_ts", envelope.GetTimestamp()).
|
||||
Uint64("client_ts", envelope.GetClientTimestamp()).
|
||||
Msg("Dropping message from non-ACI sender")
|
||||
return nil
|
||||
}
|
||||
cli.Store.RecipientStore.MarkUnregistered(ctx, theirServiceID, false)
|
||||
|
||||
handlerSuccess := true
|
||||
defer func() {
|
||||
if retErr == nil && !handlerSuccess {
|
||||
retErr = ErrHandlerFailed
|
||||
}
|
||||
}()
|
||||
// result.Err is set if there was an error during decryption and we
|
||||
// should notifiy the user that the message could not be decrypted
|
||||
if result.Err != nil {
|
||||
|
|
@ -469,7 +469,7 @@ func (cli *Client) handleDecryptedResult(
|
|||
Bool("urgent", envelope.GetUrgent()).
|
||||
Stringer("content_hint", result.ContentHint).
|
||||
Uint64("server_ts", envelope.GetServerTimestamp()).
|
||||
Uint64("client_ts", envelope.GetTimestamp()).
|
||||
Uint64("client_ts", envelope.GetClientTimestamp()).
|
||||
Stringer("sender", theirServiceID).
|
||||
Msg("Ignoring already processed event")
|
||||
return nil
|
||||
|
|
@ -478,7 +478,7 @@ func (cli *Client) handleDecryptedResult(
|
|||
Bool("urgent", envelope.GetUrgent()).
|
||||
Stringer("content_hint", result.ContentHint).
|
||||
Uint64("server_ts", envelope.GetServerTimestamp()).
|
||||
Uint64("client_ts", envelope.GetTimestamp()).
|
||||
Uint64("client_ts", envelope.GetClientTimestamp()).
|
||||
Stringer("sender", theirServiceID).
|
||||
Msg("Decryption error with known sender")
|
||||
// Only send decryption error event if the message was urgent,
|
||||
|
|
@ -489,12 +489,12 @@ func (cli *Client) handleDecryptedResult(
|
|||
handlerSuccess = cli.handleEvent(&events.DecryptionError{
|
||||
Sender: theirServiceID.UUID,
|
||||
Err: result.Err,
|
||||
Timestamp: envelope.GetTimestamp(),
|
||||
Timestamp: envelope.GetClientTimestamp(),
|
||||
})
|
||||
}
|
||||
if result.Retriable {
|
||||
go func() {
|
||||
err := cli.sendRetryRequest(ctx, result, envelope.GetTimestamp())
|
||||
err := cli.sendRetryRequest(ctx, result, envelope.GetClientTimestamp())
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to send retry request in background")
|
||||
}
|
||||
|
|
@ -506,15 +506,15 @@ func (cli *Client) handleDecryptedResult(
|
|||
return nil
|
||||
}
|
||||
|
||||
content := result.Content
|
||||
if content == nil {
|
||||
rawContent := result.Content
|
||||
if rawContent == nil {
|
||||
log.Warn().Msg("Decrypted content is nil")
|
||||
return nil
|
||||
}
|
||||
|
||||
deviceID, _ := result.SenderAddress.DeviceID()
|
||||
log.Trace().
|
||||
Any("raw_data", content).
|
||||
Any("raw_data", rawContent).
|
||||
Stringer("sender", theirServiceID).
|
||||
Uint("sender_device", deviceID).
|
||||
Msg("Raw event data")
|
||||
|
|
@ -531,9 +531,10 @@ func (cli *Client) handleDecryptedResult(
|
|||
}
|
||||
logEvt.Bool("unencrypted", result.Unencrypted).Msg("Decrypted message")
|
||||
|
||||
if content.DecryptionErrorMessage != nil {
|
||||
// Handle unencrypted types early and refuse any other unencrypted message
|
||||
if rawContent.GetDecryptionErrorMessage() != nil {
|
||||
handlerSuccess = true
|
||||
dem, err := libsignalgo.DeserializeDecryptionErrorMessage(content.DecryptionErrorMessage)
|
||||
dem, err := libsignalgo.DeserializeDecryptionErrorMessage(rawContent.GetDecryptionErrorMessage())
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to unmarshal decryption error message")
|
||||
} else {
|
||||
|
|
@ -551,9 +552,9 @@ func (cli *Client) handleDecryptedResult(
|
|||
}
|
||||
|
||||
// If there's a sender key distribution message, process it
|
||||
if content.GetSenderKeyDistributionMessage() != nil {
|
||||
if rawContent.SenderKeyDistributionMessage != nil {
|
||||
log.Debug().Msg("content includes sender key distribution message")
|
||||
skdm, err := libsignalgo.DeserializeSenderKeyDistributionMessage(content.GetSenderKeyDistributionMessage())
|
||||
skdm, err := libsignalgo.DeserializeSenderKeyDistributionMessage(rawContent.SenderKeyDistributionMessage)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("DeserializeSenderKeyDistributionMessage error")
|
||||
return err
|
||||
|
|
@ -570,6 +571,7 @@ func (cli *Client) handleDecryptedResult(
|
|||
}
|
||||
}
|
||||
|
||||
// If we're getting a message to our PNI, mark it as needing a PNI signature message on the next send
|
||||
if destinationServiceID == cli.Store.PNIServiceID() {
|
||||
_, err = cli.Store.RecipientStore.LoadAndUpdateRecipient(ctx, theirServiceID.UUID, uuid.Nil, func(recipient *types.Recipient) (changed bool, err error) {
|
||||
if recipient.Whitelisted == nil {
|
||||
|
|
@ -589,86 +591,100 @@ func (cli *Client) handleDecryptedResult(
|
|||
}
|
||||
}
|
||||
|
||||
if content.PniSignatureMessage != nil {
|
||||
// If we receive a PNI signature message (because we sent to a PNI earlier), process it
|
||||
if rawContent.PniSignatureMessage != nil {
|
||||
log.Debug().Msg("Content includes PNI signature message")
|
||||
err = cli.handlePNISignatureMessage(ctx, theirServiceID, content.PniSignatureMessage)
|
||||
err = cli.handlePNISignatureMessage(ctx, theirServiceID, rawContent.PniSignatureMessage)
|
||||
if err != nil {
|
||||
log.Err(err).
|
||||
Hex("pni_raw", content.PniSignatureMessage.GetPni()).
|
||||
Hex("pni_raw", rawContent.PniSignatureMessage.GetPni()).
|
||||
Stringer("aci", theirServiceID.UUID).
|
||||
Msg("Failed to verify ACI-PNI mapping")
|
||||
}
|
||||
}
|
||||
|
||||
if content.SyncMessage != nil && theirServiceID == cli.Store.ACIServiceID() {
|
||||
handlerSuccess = cli.handleSyncMessage(ctx, content.SyncMessage, envelope)
|
||||
return nil
|
||||
}
|
||||
|
||||
isBlocked, err := cli.Store.RecipientStore.IsBlocked(ctx, theirServiceID.UUID)
|
||||
if err != nil {
|
||||
log.Err(err).Stringer("sender", theirServiceID).Msg("Failed to check if sender is blocked")
|
||||
}
|
||||
|
||||
var sendDeliveryReceipt bool
|
||||
if content.DataMessage != nil {
|
||||
var deliveryReceiptTS uint64
|
||||
switch content := rawContent.Content.(type) {
|
||||
case *signalpb.Content_SyncMessage:
|
||||
if theirServiceID == cli.Store.ACIServiceID() {
|
||||
handlerSuccess = cli.handleSyncMessage(ctx, content.SyncMessage, envelope)
|
||||
}
|
||||
return nil
|
||||
case *signalpb.Content_DataMessage:
|
||||
handlerSuccess, sendDeliveryReceipt = cli.incomingDataMessage(
|
||||
ctx, content.DataMessage, theirServiceID.UUID, theirServiceID, envelope.GetServerTimestamp(), isBlocked,
|
||||
)
|
||||
} else if content.EditMessage != nil {
|
||||
deliveryReceiptTS = content.DataMessage.GetTimestamp()
|
||||
case *signalpb.Content_EditMessage:
|
||||
handlerSuccess, sendDeliveryReceipt = cli.incomingEditMessage(
|
||||
ctx, content.EditMessage, theirServiceID.UUID, theirServiceID, envelope.GetServerTimestamp(), isBlocked,
|
||||
)
|
||||
}
|
||||
if sendDeliveryReceipt && handlerSuccess {
|
||||
err = cli.sendDeliveryReceipts(ctx, []uint64{content.DataMessage.GetTimestamp()}, theirServiceID.UUID)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("sendDeliveryReceipts error")
|
||||
}
|
||||
}
|
||||
|
||||
if content.TypingMessage != nil && (!isBlocked || content.TypingMessage.GetGroupId() != nil) {
|
||||
var groupID types.GroupIdentifier
|
||||
if content.TypingMessage.GetGroupId() != nil {
|
||||
gidBytes := content.TypingMessage.GetGroupId()
|
||||
groupID = types.GroupIdentifier(base64.StdEncoding.EncodeToString(gidBytes))
|
||||
}
|
||||
// No handler success check here, nobody cares if typing notifications are dropped
|
||||
cli.handleEvent(&events.ChatEvent{
|
||||
Info: events.MessageInfo{
|
||||
Sender: theirServiceID.UUID,
|
||||
ChatID: groupOrUserID(groupID, theirServiceID),
|
||||
ServerTimestamp: envelope.GetServerTimestamp(),
|
||||
},
|
||||
Event: content.TypingMessage,
|
||||
})
|
||||
}
|
||||
|
||||
// DM call message (group call is an opaque callMessage and a groupCallUpdate in a dataMessage)
|
||||
if content.CallMessage != nil && (content.CallMessage.Offer != nil || content.CallMessage.Hangup != nil) && !isBlocked {
|
||||
handlerSuccess = cli.handleEvent(&events.Call{
|
||||
Info: events.MessageInfo{
|
||||
Sender: theirServiceID.UUID,
|
||||
ChatID: theirServiceID.String(),
|
||||
ServerTimestamp: envelope.GetServerTimestamp(),
|
||||
},
|
||||
// CallMessage doesn't have its own timestamp, use one from the envelope
|
||||
Timestamp: envelope.GetTimestamp(),
|
||||
IsRinging: content.CallMessage.Offer != nil,
|
||||
}) && handlerSuccess
|
||||
}
|
||||
|
||||
// Read and delivery receipts
|
||||
if content.ReceiptMessage != nil {
|
||||
if content.GetReceiptMessage().GetType() == signalpb.ReceiptMessage_DELIVERY && theirServiceID == cli.Store.ACIServiceID() {
|
||||
deliveryReceiptTS = content.EditMessage.GetDataMessage().GetTimestamp()
|
||||
case *signalpb.Content_ReceiptMessage:
|
||||
if content.ReceiptMessage.GetType() == signalpb.ReceiptMessage_DELIVERY && theirServiceID == cli.Store.ACIServiceID() {
|
||||
// Ignore delivery receipts from other own devices
|
||||
return nil
|
||||
}
|
||||
handlerSuccess = cli.handleEvent(&events.Receipt{
|
||||
Sender: theirServiceID.UUID,
|
||||
Content: content.ReceiptMessage,
|
||||
}) && handlerSuccess
|
||||
})
|
||||
case *signalpb.Content_TypingMessage:
|
||||
var groupID types.GroupIdentifier
|
||||
if content.TypingMessage.GetGroupId() != nil {
|
||||
gidBytes := content.TypingMessage.GetGroupId()
|
||||
groupID = types.GroupIdentifier(base64.StdEncoding.EncodeToString(gidBytes))
|
||||
}
|
||||
if !isBlocked || groupID != "" {
|
||||
// No handler success check here, nobody cares if typing notifications are dropped
|
||||
cli.handleEvent(&events.ChatEvent{
|
||||
Info: events.MessageInfo{
|
||||
Sender: theirServiceID.UUID,
|
||||
ChatID: groupOrUserID(groupID, theirServiceID),
|
||||
ServerTimestamp: envelope.GetServerTimestamp(),
|
||||
},
|
||||
Event: content.TypingMessage,
|
||||
})
|
||||
}
|
||||
case *signalpb.Content_CallMessage:
|
||||
if !isBlocked && (content.CallMessage.Offer != nil || content.CallMessage.Hangup != nil) {
|
||||
handlerSuccess = cli.handleEvent(&events.Call{
|
||||
Info: events.MessageInfo{
|
||||
Sender: theirServiceID.UUID,
|
||||
ChatID: theirServiceID.String(),
|
||||
ServerTimestamp: envelope.GetServerTimestamp(),
|
||||
},
|
||||
// CallMessage doesn't have its own timestamp, use one from the envelope
|
||||
Timestamp: envelope.GetClientTimestamp(),
|
||||
IsRinging: content.CallMessage.Offer != nil,
|
||||
})
|
||||
}
|
||||
case *signalpb.Content_DecryptionErrorMessage:
|
||||
// These should've been handled earlier
|
||||
log.Warn().Msg("Unexpected decryption error message content in decrypted message")
|
||||
case *signalpb.Content_NullMessage:
|
||||
// This is intentionally ignored
|
||||
case *signalpb.Content_StoryMessage:
|
||||
// This is also ignored for now
|
||||
default:
|
||||
if rawContent.PniSignatureMessage == nil && rawContent.SenderKeyDistributionMessage == nil {
|
||||
log.Warn().Type("content_type", content).Msg("Unrecognized message content type")
|
||||
}
|
||||
}
|
||||
|
||||
if sendDeliveryReceipt && handlerSuccess {
|
||||
err = cli.sendDeliveryReceipts(ctx, []uint64{deliveryReceiptTS}, theirServiceID.UUID)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("sendDeliveryReceipts error")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
@ -683,9 +699,9 @@ func (cli *Client) handleSyncMessage(ctx context.Context, msg *signalpb.SyncMess
|
|||
// TODO: handle more sync messages
|
||||
handlerSuccess = true
|
||||
log := zerolog.Ctx(ctx)
|
||||
if msg.Keys != nil {
|
||||
aep := libsignalgo.AccountEntropyPool(msg.Keys.GetAccountEntropyPool())
|
||||
cli.Store.MasterKey = msg.Keys.GetMaster()
|
||||
switch content := msg.Content.(type) {
|
||||
case *signalpb.SyncMessage_Keys_:
|
||||
aep := libsignalgo.AccountEntropyPool(content.Keys.GetAccountEntropyPool())
|
||||
if aep != "" {
|
||||
aepMasterKey, err := aep.DeriveSVRKey()
|
||||
if err != nil {
|
||||
|
|
@ -708,59 +724,65 @@ func (cli *Client) handleSyncMessage(ctx context.Context, msg *signalpb.SyncMess
|
|||
log.Info().Msg("Received master key")
|
||||
go cli.SyncStorage(ctx)
|
||||
}
|
||||
} else if msg.GetFetchLatest().GetType() == signalpb.SyncMessage_FetchLatest_STORAGE_MANIFEST {
|
||||
log.Debug().Msg("Received storage manifest fetch latest notice")
|
||||
go cli.SyncStorage(ctx)
|
||||
}
|
||||
syncSent := msg.GetSent()
|
||||
if syncSent.GetMessage() != nil || syncSent.GetEditMessage() != nil {
|
||||
syncDestinationServiceID, err := ParseStringOrBinaryServiceID(syncSent.GetDestinationServiceId(), syncSent.GetDestinationServiceIdBinary())
|
||||
if err != nil && !errors.Is(err, ErrEmptyUUIDInput) {
|
||||
log.Err(err).Msg("Sync message destination parse error")
|
||||
case *signalpb.SyncMessage_FetchLatest_:
|
||||
switch content.FetchLatest.GetType() {
|
||||
case signalpb.SyncMessage_FetchLatest_STORAGE_MANIFEST:
|
||||
log.Debug().Msg("Received storage manifest fetch latest notice")
|
||||
go cli.SyncStorage(ctx)
|
||||
default:
|
||||
log.Debug().
|
||||
Stringer("fetch_latest_type", content.FetchLatest.GetType()).
|
||||
Msg("Received unknown fetch latest notice")
|
||||
}
|
||||
if syncSent.GetDestinationE164() != "" && !syncDestinationServiceID.IsEmpty() {
|
||||
aci, pni := syncDestinationServiceID.ToACIAndPNI()
|
||||
_, err = cli.Store.RecipientStore.UpdateRecipientE164(ctx, aci, pni, syncSent.GetDestinationE164())
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to update recipient E164 after receiving sync message")
|
||||
case *signalpb.SyncMessage_Sent_:
|
||||
syncSent := content.Sent
|
||||
if syncSent.GetMessage() != nil || syncSent.GetEditMessage() != nil {
|
||||
syncDestinationServiceID, err := ParseStringOrBinaryServiceID(syncSent.GetDestinationServiceId(), syncSent.GetDestinationServiceIdBinary())
|
||||
if err != nil && !errors.Is(err, ErrEmptyUUIDInput) {
|
||||
log.Err(err).Msg("Sync message destination parse error")
|
||||
}
|
||||
}
|
||||
for _, unident := range syncSent.GetUnidentifiedStatus() {
|
||||
serviceID, err := ParseStringOrBinaryServiceID(unident.GetDestinationServiceId(), unident.GetDestinationServiceIdBinary())
|
||||
if err != nil {
|
||||
log.Err(err).
|
||||
Str("destination_service_id", unident.GetDestinationServiceId()).
|
||||
Hex("destination_service_id_bytes", unident.GetDestinationServiceIdBinary()).
|
||||
Msg("Failed to parse destination service ID of unidentified send")
|
||||
continue
|
||||
if syncSent.GetDestinationE164() != "" && !syncDestinationServiceID.IsEmpty() {
|
||||
aci, pni := syncDestinationServiceID.ToACIAndPNI()
|
||||
_, err = cli.Store.RecipientStore.UpdateRecipientE164(ctx, aci, pni, syncSent.GetDestinationE164())
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to update recipient E164 after receiving sync message")
|
||||
}
|
||||
}
|
||||
changed, err := cli.saveSyncPNIIdentityKey(ctx, serviceID, unident.GetDestinationPniIdentityKey())
|
||||
if err != nil {
|
||||
log.Err(err).
|
||||
Stringer("destination_service_id", serviceID).
|
||||
Msg("Failed to save PNI identity key from sync message")
|
||||
} else if changed {
|
||||
log.Debug().
|
||||
Stringer("destination_service_id", serviceID).
|
||||
Msg("Saved new PNI identity key from sync message")
|
||||
for _, unident := range syncSent.GetUnidentifiedStatus() {
|
||||
serviceID, err := ParseStringOrBinaryServiceID(unident.GetDestinationServiceId(), unident.GetDestinationServiceIdBinary())
|
||||
if err != nil {
|
||||
log.Err(err).
|
||||
Str("destination_service_id", unident.GetDestinationServiceId()).
|
||||
Hex("destination_service_id_bytes", unident.GetDestinationServiceIdBinary()).
|
||||
Msg("Failed to parse destination service ID of unidentified send")
|
||||
continue
|
||||
}
|
||||
changed, err := cli.saveSyncPNIIdentityKey(ctx, serviceID, unident.GetDestinationPniIdentityKey())
|
||||
if err != nil {
|
||||
log.Err(err).
|
||||
Stringer("destination_service_id", serviceID).
|
||||
Msg("Failed to save PNI identity key from sync message")
|
||||
} else if changed {
|
||||
log.Debug().
|
||||
Stringer("destination_service_id", serviceID).
|
||||
Msg("Saved new PNI identity key from sync message")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if syncDestinationServiceID.IsEmpty() && syncSent.GetMessage().GetGroupV2() == nil && syncSent.GetEditMessage().GetDataMessage().GetGroupV2() == nil {
|
||||
log.Warn().Msg("sync message sent destination is nil")
|
||||
} else if msg.Sent.Message != nil {
|
||||
// TODO handle expiration start ts, and maybe the sync message ts?
|
||||
cli.incomingDataMessage(ctx, msg.Sent.Message, cli.Store.ACI, syncDestinationServiceID, envelope.GetServerTimestamp(), false)
|
||||
} else if msg.Sent.EditMessage != nil {
|
||||
cli.incomingEditMessage(ctx, msg.Sent.EditMessage, cli.Store.ACI, syncDestinationServiceID, envelope.GetServerTimestamp(), false)
|
||||
if syncDestinationServiceID.IsEmpty() && syncSent.GetMessage().GetGroupV2() == nil && syncSent.GetEditMessage().GetDataMessage().GetGroupV2() == nil {
|
||||
log.Warn().Msg("sync message sent destination is nil")
|
||||
} else if syncSent.Message != nil {
|
||||
// TODO handle expiration start ts, and maybe the sync message ts?
|
||||
cli.incomingDataMessage(ctx, syncSent.Message, cli.Store.ACI, syncDestinationServiceID, envelope.GetServerTimestamp(), false)
|
||||
} else if syncSent.EditMessage != nil {
|
||||
cli.incomingEditMessage(ctx, syncSent.EditMessage, cli.Store.ACI, syncDestinationServiceID, envelope.GetServerTimestamp(), false)
|
||||
}
|
||||
}
|
||||
}
|
||||
if msg.Contacts != nil {
|
||||
case *signalpb.SyncMessage_Contacts_:
|
||||
log.Debug().Msg("Recieved sync message contacts")
|
||||
blob := msg.Contacts.Blob
|
||||
if blob != nil {
|
||||
if content.Contacts.Blob != nil {
|
||||
// TODO roundtrip via disk to save memory
|
||||
contactsBytes, err := DownloadAttachmentWithPointer(ctx, blob, nil, nil)
|
||||
contactsBytes, err := DownloadAttachmentWithPointer(ctx, content.Contacts.Blob, nil, nil)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Contacts Sync DownloadAttachment error")
|
||||
}
|
||||
|
|
@ -773,7 +795,7 @@ func (cli *Client) handleSyncMessage(ctx context.Context, msg *signalpb.SyncMess
|
|||
convertedContacts := make([]*types.Recipient, 0, len(contacts))
|
||||
err = cli.Store.DoContactTxn(ctx, func(ctx context.Context) error {
|
||||
for i, signalContact := range contacts {
|
||||
if signalContact.Aci == nil || *signalContact.Aci == "" {
|
||||
if (signalContact.Aci == nil || *signalContact.Aci == "") && len(signalContact.AciBinary) != 16 {
|
||||
// TODO lookup PNI via CDSI and store that when ACI is missing?
|
||||
log.Info().
|
||||
Any("contact", signalContact).
|
||||
|
|
@ -796,22 +818,14 @@ func (cli *Client) handleSyncMessage(ctx context.Context, msg *signalpb.SyncMess
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
if msg.Read != nil {
|
||||
handlerSuccess = cli.handleEvent(&events.ReadSelf{
|
||||
Timestamp: envelope.GetTimestamp(),
|
||||
Messages: msg.GetRead(),
|
||||
})
|
||||
}
|
||||
if msg.DeleteForMe != nil {
|
||||
case *signalpb.SyncMessage_DeleteForMe_:
|
||||
handlerSuccess = cli.handleEvent(&events.DeleteForMe{
|
||||
Timestamp: envelope.GetTimestamp(),
|
||||
SyncMessage_DeleteForMe: msg.DeleteForMe,
|
||||
Timestamp: envelope.GetClientTimestamp(),
|
||||
SyncMessage_DeleteForMe: content.DeleteForMe,
|
||||
})
|
||||
}
|
||||
if msg.MessageRequestResponse != nil {
|
||||
aciUUID, _ := ParseStringOrBinaryUUID(msg.MessageRequestResponse.GetThreadAci(), msg.MessageRequestResponse.GetThreadAciBinary())
|
||||
if aciUUID != uuid.Nil && msg.MessageRequestResponse.GetType() == signalpb.SyncMessage_MessageRequestResponse_ACCEPT {
|
||||
case *signalpb.SyncMessage_MessageRequestResponse_:
|
||||
aciUUID, _ := ParseStringOrBinaryUUID(content.MessageRequestResponse.GetThreadAci(), content.MessageRequestResponse.GetThreadAciBinary())
|
||||
if aciUUID != uuid.Nil && content.MessageRequestResponse.GetType() == signalpb.SyncMessage_MessageRequestResponse_ACCEPT {
|
||||
_, err := cli.Store.RecipientStore.LoadAndUpdateRecipient(ctx, aciUUID, uuid.Nil, func(recipient *types.Recipient) (changed bool, err error) {
|
||||
changed = !ptr.Val(recipient.Whitelisted) || recipient.NeedsPNISignature
|
||||
recipient.Whitelisted = ptr.Ptr(true)
|
||||
|
|
@ -823,16 +837,23 @@ func (cli *Client) handleSyncMessage(ctx context.Context, msg *signalpb.SyncMess
|
|||
}
|
||||
}
|
||||
var groupID *libsignalgo.GroupIdentifier
|
||||
if len(msg.MessageRequestResponse.GroupId) == libsignalgo.GroupIdentifierLength {
|
||||
groupID = (*libsignalgo.GroupIdentifier)(msg.MessageRequestResponse.GroupId)
|
||||
if len(content.MessageRequestResponse.GroupId) == libsignalgo.GroupIdentifierLength {
|
||||
groupID = (*libsignalgo.GroupIdentifier)(content.MessageRequestResponse.GroupId)
|
||||
}
|
||||
handlerSuccess = cli.handleEvent(&events.MessageRequestResponse{
|
||||
Timestamp: envelope.GetTimestamp(),
|
||||
Timestamp: envelope.GetClientTimestamp(),
|
||||
ThreadACI: aciUUID,
|
||||
GroupID: groupID,
|
||||
Type: msg.MessageRequestResponse.GetType(),
|
||||
Raw: msg.MessageRequestResponse,
|
||||
Type: content.MessageRequestResponse.GetType(),
|
||||
Raw: content.MessageRequestResponse,
|
||||
})
|
||||
default:
|
||||
if msg.Read != nil {
|
||||
handlerSuccess = cli.handleEvent(&events.ReadSelf{
|
||||
Timestamp: envelope.GetClientTimestamp(),
|
||||
Messages: msg.Read,
|
||||
})
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,14 +64,14 @@ func (cli *Client) decryptEnvelope(
|
|||
}
|
||||
return result
|
||||
|
||||
case signalpb.Envelope_PREKEY_BUNDLE, signalpb.Envelope_CIPHERTEXT:
|
||||
sender, err := sourceServiceID.Address(uint(envelope.GetSourceDevice()))
|
||||
case signalpb.Envelope_PREKEY_MESSAGE, signalpb.Envelope_DOUBLE_RATCHET:
|
||||
sender, err := sourceServiceID.Address(uint(envelope.GetSourceDeviceId()))
|
||||
if err != nil {
|
||||
return DecryptionResult{Err: fmt.Errorf("failed to wrap address: %v", err)}
|
||||
}
|
||||
var result *DecryptionResult
|
||||
var bundleType string
|
||||
if *envelope.Type == signalpb.Envelope_PREKEY_BUNDLE {
|
||||
if *envelope.Type == signalpb.Envelope_PREKEY_MESSAGE {
|
||||
result, err = cli.prekeyDecrypt(ctx, destinationServiceID, sender, envelope.Content, envelope.GetServerTimestamp())
|
||||
bundleType = "prekey bundle"
|
||||
} else {
|
||||
|
|
@ -90,7 +90,7 @@ func (cli *Client) decryptEnvelope(
|
|||
return *result
|
||||
|
||||
case signalpb.Envelope_PLAINTEXT_CONTENT:
|
||||
addr, err := sourceServiceID.Address(uint(envelope.GetSourceDevice()))
|
||||
addr, err := sourceServiceID.Address(uint(envelope.GetSourceDeviceId()))
|
||||
if err != nil {
|
||||
return DecryptionResult{Err: fmt.Errorf("failed to wrap address: %v", err)}
|
||||
}
|
||||
|
|
@ -100,16 +100,13 @@ func (cli *Client) decryptEnvelope(
|
|||
}
|
||||
return DecryptionResult{
|
||||
SenderAddress: addr,
|
||||
Content: &signalpb.Content{DecryptionErrorMessage: content},
|
||||
Content: &signalpb.Content{Content: &signalpb.Content_DecryptionErrorMessage{DecryptionErrorMessage: content}},
|
||||
Unencrypted: true,
|
||||
}
|
||||
|
||||
case signalpb.Envelope_SERVER_DELIVERY_RECEIPT:
|
||||
return DecryptionResult{Err: fmt.Errorf("server delivery receipt envelopes are not yet supported")}
|
||||
|
||||
case signalpb.Envelope_SENDERKEY_MESSAGE:
|
||||
return DecryptionResult{Err: fmt.Errorf("senderkey message envelopes are not yet supported")}
|
||||
|
||||
case signalpb.Envelope_UNKNOWN:
|
||||
return DecryptionResult{Err: fmt.Errorf("unknown envelope type")}
|
||||
|
||||
|
|
@ -188,12 +185,17 @@ func (cli *Client) prekeyDecrypt(
|
|||
if is == nil {
|
||||
return nil, fmt.Errorf("no identity store found for %s", destination)
|
||||
}
|
||||
destinationAddress, err := destination.Address(uint(cli.Store.DeviceID))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get own/destination address: %w", err)
|
||||
}
|
||||
|
||||
plaintext, ciphertextHash, err := cli.bufferedDecryptTxn(ctx, encryptedContent, serverTimestamp, func(ctx context.Context) ([]byte, error) {
|
||||
return libsignalgo.DecryptPreKey(
|
||||
ctx,
|
||||
preKeyMessage,
|
||||
sender,
|
||||
destinationAddress,
|
||||
ss,
|
||||
is,
|
||||
pks,
|
||||
|
|
@ -241,11 +243,16 @@ func (cli *Client) decryptCiphertextEnvelope(
|
|||
if identityStore == nil {
|
||||
return nil, fmt.Errorf("no identity store for destination service ID %s", destinationServiceID)
|
||||
}
|
||||
destinationAddress, err := destinationServiceID.Address(uint(cli.Store.DeviceID))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get own address: %w", err)
|
||||
}
|
||||
plaintext, ciphertextHash, err := cli.bufferedDecryptTxn(ctx, ciphertext, serverTimestamp, func(ctx context.Context) ([]byte, error) {
|
||||
return libsignalgo.Decrypt(
|
||||
ctx,
|
||||
message,
|
||||
senderAddress,
|
||||
destinationAddress,
|
||||
sessionStore,
|
||||
identityStore,
|
||||
)
|
||||
|
|
@ -394,7 +401,9 @@ func (cli *Client) decryptUnidentifiedSenderEnvelope(ctx context.Context, destin
|
|||
}
|
||||
result.Unencrypted = true
|
||||
result.Content = &signalpb.Content{
|
||||
DecryptionErrorMessage: usmcContents,
|
||||
Content: &signalpb.Content_DecryptionErrorMessage{
|
||||
DecryptionErrorMessage: usmcContents,
|
||||
},
|
||||
}
|
||||
return result, err
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -19,10 +19,12 @@ package signalmeow
|
|||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math/rand/v2"
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
"go.mau.fi/util/random"
|
||||
|
||||
"go.mau.fi/mautrix-signal/pkg/libsignalgo"
|
||||
signalpb "go.mau.fi/mautrix-signal/pkg/signalmeow/protobuf"
|
||||
|
|
@ -63,7 +65,9 @@ func (cli *Client) sendRetryRequest(ctx context.Context, result DecryptionResult
|
|||
return fmt.Errorf("failed to create ciphertext message from plaintext content: %w", err)
|
||||
}
|
||||
_, err = cli.sendContent(ctx, serviceID, uint64(time.Now().UnixMilli()), &signalpb.Content{
|
||||
DecryptionErrorMessage: demBytes,
|
||||
Content: &signalpb.Content_DecryptionErrorMessage{
|
||||
DecryptionErrorMessage: demBytes,
|
||||
},
|
||||
}, 0, true, result.GroupID, ctm)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to send decryption error message: %w", err)
|
||||
|
|
@ -182,7 +186,11 @@ func (cli *Client) handleRetryRequest(
|
|||
Msg("Not responding to decryption error message")
|
||||
return nil
|
||||
}
|
||||
retryContent.NullMessage = &signalpb.NullMessage{}
|
||||
retryContent.Content = &signalpb.Content_NullMessage{
|
||||
NullMessage: &signalpb.NullMessage{
|
||||
Padding: random.Bytes(rand.IntN(511) + 1),
|
||||
},
|
||||
}
|
||||
}
|
||||
responseTimestamp := uint64(time.Now().UnixMilli())
|
||||
if cacheHit {
|
||||
|
|
|
|||
|
|
@ -180,6 +180,13 @@ func (cli *Client) sendToGroupWithSenderKey(
|
|||
}
|
||||
ssCiphertext, err := cli.encryptWithSenderKey(ctx, groupID, ski.DistributionID, myAddress, senderKeyRecipients, content)
|
||||
if err != nil {
|
||||
if errors.Is(err, libsignalgo.ErrorCodeSessionNotFound) {
|
||||
log.Warn().Err(err).Msg("Got session not found error for group send from libsignal, resetting session and retrying")
|
||||
if err = cli.Store.SenderKeyStore.DeleteSenderKeyInfo(ctx, groupIDStr); err != nil {
|
||||
return nil, fmt.Errorf("failed to delete sender key info: %w", err)
|
||||
}
|
||||
return cli.sendToGroupWithSenderKey(ctx, groupID, allRecipients, sec, content, messageTimestamp, retries+1)
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
for recipientID := range ski.SharedWith {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math/rand/v2"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
|
@ -31,6 +32,7 @@ import (
|
|||
"github.com/rs/zerolog"
|
||||
"go.mau.fi/util/exfmt"
|
||||
"go.mau.fi/util/ptr"
|
||||
"go.mau.fi/util/random"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"go.mau.fi/mautrix-signal/pkg/libsignalgo"
|
||||
|
|
@ -171,6 +173,10 @@ func (cli *Client) buildMessagesToSend(
|
|||
} else if len(sessions) == 0 {
|
||||
return nil, fmt.Errorf("no sessions found for recipient %s", recipient.String())
|
||||
}
|
||||
localAddress, err := cli.Store.ACIServiceID().Address(uint(cli.Store.DeviceID))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get own address: %w", err)
|
||||
}
|
||||
|
||||
messages := make([]MyMessage, 0, len(sessions))
|
||||
for _, tuple := range sessions {
|
||||
|
|
@ -193,7 +199,7 @@ func (cli *Client) buildMessagesToSend(
|
|||
|
||||
includeE164 := groupID == nil && cli.Store.AccountRecord.GetPhoneNumberSharingMode() == signalpb.AccountRecord_EVERYBODY
|
||||
envelopeType, encryptedPayload, err := cli.buildMessageToSend(
|
||||
ctx, tuple.Address, paddedMessage, getContentHint(content), ctmOverride, groupID, includeE164, unauthenticated,
|
||||
ctx, tuple.Address, localAddress, paddedMessage, getContentHint(content), ctmOverride, groupID, includeE164, unauthenticated,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
@ -218,11 +224,9 @@ func (cli *Client) buildMessagesToSend(
|
|||
func ctmTypeToEnvelopeType(ctmType libsignalgo.CiphertextMessageType) signalpb.Envelope_Type {
|
||||
switch ctmType {
|
||||
case libsignalgo.CiphertextMessageTypeWhisper:
|
||||
return signalpb.Envelope_CIPHERTEXT // 2 -> 1
|
||||
return signalpb.Envelope_DOUBLE_RATCHET // 2 -> 1
|
||||
case libsignalgo.CiphertextMessageTypePreKey:
|
||||
return signalpb.Envelope_PREKEY_BUNDLE // 3 -> 3
|
||||
case libsignalgo.CiphertextMessageTypeSenderKey:
|
||||
return signalpb.Envelope_SENDERKEY_MESSAGE // 7 -> 7
|
||||
return signalpb.Envelope_PREKEY_MESSAGE // 3 -> 3
|
||||
case libsignalgo.CiphertextMessageTypePlaintext:
|
||||
return signalpb.Envelope_PLAINTEXT_CONTENT // 8 -> 8
|
||||
default:
|
||||
|
|
@ -232,7 +236,7 @@ func ctmTypeToEnvelopeType(ctmType libsignalgo.CiphertextMessageType) signalpb.E
|
|||
|
||||
func (cli *Client) buildMessageToSend(
|
||||
ctx context.Context,
|
||||
recipientAddress *libsignalgo.Address,
|
||||
recipientAddress, localAddress *libsignalgo.Address,
|
||||
paddedMessage []byte,
|
||||
contentHint libsignalgo.UnidentifiedSenderMessageContentHint,
|
||||
ciphertextMessage *libsignalgo.CiphertextMessage,
|
||||
|
|
@ -244,6 +248,7 @@ func (cli *Client) buildMessageToSend(
|
|||
ctx,
|
||||
paddedMessage,
|
||||
recipientAddress,
|
||||
localAddress,
|
||||
cli.Store.ACISessionStore,
|
||||
cli.Store.ACIIdentityStore,
|
||||
)
|
||||
|
|
@ -297,11 +302,21 @@ type SendResult interface {
|
|||
func (gmsr *GroupMessageSendResult) isSendResult() {}
|
||||
func (smsr *SendMessageResult) isSendResult() {}
|
||||
|
||||
func contentFromDataMessage(dataMessage *signalpb.DataMessage) *signalpb.Content {
|
||||
func WrapSyncMessage(content *signalpb.SyncMessage) *signalpb.Content {
|
||||
content.Padding = random.Bytes(rand.IntN(511) + 1)
|
||||
return &signalpb.Content{
|
||||
DataMessage: dataMessage,
|
||||
Content: &signalpb.Content_SyncMessage{SyncMessage: content},
|
||||
}
|
||||
}
|
||||
|
||||
func syncSentMessage(sent *signalpb.SyncMessage_Sent) *signalpb.Content {
|
||||
return WrapSyncMessage(&signalpb.SyncMessage{
|
||||
Content: &signalpb.SyncMessage_Sent_{
|
||||
Sent: sent,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func syncMessageFromGroupDataMessage(dataMessage *signalpb.DataMessage, results []SuccessfulSendResult) *signalpb.Content {
|
||||
unidentifiedStatuses := []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{}
|
||||
for _, result := range results {
|
||||
|
|
@ -310,17 +325,14 @@ func syncMessageFromGroupDataMessage(dataMessage *signalpb.DataMessage, results
|
|||
Unidentified: &result.Unidentified,
|
||||
})
|
||||
}
|
||||
return &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
Sent: &signalpb.SyncMessage_Sent{
|
||||
Message: dataMessage,
|
||||
Timestamp: dataMessage.Timestamp,
|
||||
UnidentifiedStatus: unidentifiedStatuses,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
},
|
||||
},
|
||||
}
|
||||
return syncSentMessage(&signalpb.SyncMessage_Sent{
|
||||
Message: dataMessage,
|
||||
Timestamp: dataMessage.Timestamp,
|
||||
UnidentifiedStatus: unidentifiedStatuses,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
})
|
||||
}
|
||||
|
||||
func syncMessageFromGroupEditMessage(editMessage *signalpb.EditMessage, results []SuccessfulSendResult) *signalpb.Content {
|
||||
unidentifiedStatuses := []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{}
|
||||
for _, result := range results {
|
||||
|
|
@ -329,70 +341,50 @@ func syncMessageFromGroupEditMessage(editMessage *signalpb.EditMessage, results
|
|||
Unidentified: &result.Unidentified,
|
||||
})
|
||||
}
|
||||
return &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
Sent: &signalpb.SyncMessage_Sent{
|
||||
EditMessage: editMessage,
|
||||
Timestamp: editMessage.GetDataMessage().Timestamp,
|
||||
UnidentifiedStatus: unidentifiedStatuses,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
},
|
||||
},
|
||||
}
|
||||
return syncSentMessage(&signalpb.SyncMessage_Sent{
|
||||
EditMessage: editMessage,
|
||||
Timestamp: editMessage.GetDataMessage().Timestamp,
|
||||
UnidentifiedStatus: unidentifiedStatuses,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
})
|
||||
}
|
||||
|
||||
func syncMessageFromSoloDataMessage(dataMessage *signalpb.DataMessage, result SuccessfulSendResult) *signalpb.Content {
|
||||
return &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
Sent: &signalpb.SyncMessage_Sent{
|
||||
Message: dataMessage,
|
||||
DestinationE164: result.RecipientE164,
|
||||
return syncSentMessage(&signalpb.SyncMessage_Sent{
|
||||
Message: dataMessage,
|
||||
DestinationE164: result.RecipientE164,
|
||||
DestinationServiceIdBinary: result.Recipient.Bytes(),
|
||||
Timestamp: dataMessage.Timestamp,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
UnidentifiedStatus: []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{
|
||||
{
|
||||
DestinationServiceIdBinary: result.Recipient.Bytes(),
|
||||
Timestamp: dataMessage.Timestamp,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
UnidentifiedStatus: []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{
|
||||
{
|
||||
DestinationServiceIdBinary: result.Recipient.Bytes(),
|
||||
Unidentified: &result.Unidentified,
|
||||
DestinationPniIdentityKey: result.DestinationPNIIdentityKey.TrySerialize(),
|
||||
},
|
||||
},
|
||||
Unidentified: &result.Unidentified,
|
||||
DestinationPniIdentityKey: result.DestinationPNIIdentityKey.TrySerialize(),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func syncMessageFromSoloEditMessage(editMessage *signalpb.EditMessage, result SuccessfulSendResult) *signalpb.Content {
|
||||
return &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
Sent: &signalpb.SyncMessage_Sent{
|
||||
EditMessage: editMessage,
|
||||
DestinationE164: result.RecipientE164,
|
||||
return syncSentMessage(&signalpb.SyncMessage_Sent{
|
||||
EditMessage: editMessage,
|
||||
DestinationE164: result.RecipientE164,
|
||||
DestinationServiceIdBinary: result.Recipient.Bytes(),
|
||||
Timestamp: editMessage.DataMessage.Timestamp,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
UnidentifiedStatus: []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{
|
||||
{
|
||||
DestinationServiceIdBinary: result.Recipient.Bytes(),
|
||||
Timestamp: editMessage.DataMessage.Timestamp,
|
||||
ExpirationStartTimestamp: ptr.Ptr(uint64(time.Now().UnixMilli())),
|
||||
UnidentifiedStatus: []*signalpb.SyncMessage_Sent_UnidentifiedDeliveryStatus{
|
||||
{
|
||||
DestinationServiceIdBinary: result.Recipient.Bytes(),
|
||||
Unidentified: &result.Unidentified,
|
||||
DestinationPniIdentityKey: result.DestinationPNIIdentityKey.TrySerialize(),
|
||||
},
|
||||
},
|
||||
Unidentified: &result.Unidentified,
|
||||
DestinationPniIdentityKey: result.DestinationPNIIdentityKey.TrySerialize(),
|
||||
},
|
||||
},
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func syncMessageFromReadReceiptMessage(ctx context.Context, receiptMessage *signalpb.ReceiptMessage, messageSender libsignalgo.ServiceID) *signalpb.Content {
|
||||
if *receiptMessage.Type != signalpb.ReceiptMessage_READ {
|
||||
zerolog.Ctx(ctx).Warn().
|
||||
Any("receipt_message_type", receiptMessage.Type).
|
||||
Msg("syncMessageFromReadReceiptMessage called with non-read receipt message")
|
||||
return nil
|
||||
} else if messageSender.Type != libsignalgo.ServiceIDTypeACI {
|
||||
zerolog.Ctx(ctx).Warn().
|
||||
Stringer("message_sender", messageSender).
|
||||
Msg("syncMessageFromReadReceiptMessage called with non-ACI message sender")
|
||||
if *receiptMessage.Type != signalpb.ReceiptMessage_READ || messageSender.Type != libsignalgo.ServiceIDTypeACI {
|
||||
return nil
|
||||
}
|
||||
read := []*signalpb.SyncMessage_Read{}
|
||||
|
|
@ -402,11 +394,9 @@ func syncMessageFromReadReceiptMessage(ctx context.Context, receiptMessage *sign
|
|||
SenderAci: proto.String(messageSender.UUID.String()),
|
||||
})
|
||||
}
|
||||
return &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
Read: read,
|
||||
},
|
||||
}
|
||||
return WrapSyncMessage(&signalpb.SyncMessage{
|
||||
Read: read,
|
||||
})
|
||||
}
|
||||
|
||||
func (cli *Client) SendContactSyncRequest(ctx context.Context) error {
|
||||
|
|
@ -422,13 +412,13 @@ func (cli *Client) SendContactSyncRequest(ctx context.Context) error {
|
|||
}
|
||||
|
||||
cli.LastContactRequestTime = time.Now()
|
||||
_, err := cli.sendContent(ctx, cli.Store.ACIServiceID(), uint64(time.Now().UnixMilli()), &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
_, err := cli.sendContent(ctx, cli.Store.ACIServiceID(), uint64(time.Now().UnixMilli()), WrapSyncMessage(&signalpb.SyncMessage{
|
||||
Content: &signalpb.SyncMessage_Request_{
|
||||
Request: &signalpb.SyncMessage_Request{
|
||||
Type: signalpb.SyncMessage_Request_CONTACTS.Enum(),
|
||||
},
|
||||
},
|
||||
}, 0, false, nil, nil)
|
||||
}), 0, false, nil, nil)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to send contact sync request message to myself")
|
||||
return err
|
||||
|
|
@ -442,13 +432,13 @@ func (cli *Client) SendStorageMasterKeyRequest(ctx context.Context) error {
|
|||
Logger()
|
||||
ctx = log.WithContext(ctx)
|
||||
|
||||
_, err := cli.sendContent(ctx, cli.Store.ACIServiceID(), uint64(time.Now().UnixMilli()), &signalpb.Content{
|
||||
SyncMessage: &signalpb.SyncMessage{
|
||||
_, err := cli.sendContent(ctx, cli.Store.ACIServiceID(), uint64(time.Now().UnixMilli()), WrapSyncMessage(&signalpb.SyncMessage{
|
||||
Content: &signalpb.SyncMessage_Request_{
|
||||
Request: &signalpb.SyncMessage_Request{
|
||||
Type: signalpb.SyncMessage_Request_KEYS.Enum(),
|
||||
},
|
||||
},
|
||||
}, 0, false, nil, nil)
|
||||
}), 0, false, nil, nil)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Failed to send key sync request message to myself")
|
||||
return err
|
||||
|
|
@ -468,38 +458,47 @@ func TypingMessage(isTyping bool) *signalpb.Content {
|
|||
} else {
|
||||
action = signalpb.TypingMessage_STOPPED
|
||||
}
|
||||
tm := &signalpb.TypingMessage{
|
||||
Timestamp: ×tamp,
|
||||
Action: &action,
|
||||
}
|
||||
return &signalpb.Content{
|
||||
TypingMessage: tm,
|
||||
Content: &signalpb.Content_TypingMessage{
|
||||
TypingMessage: &signalpb.TypingMessage{
|
||||
Timestamp: ×tamp,
|
||||
Action: &action,
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func DeliveredReceiptMessageForTimestamps(timestamps []uint64) *signalpb.Content {
|
||||
rm := &signalpb.ReceiptMessage{
|
||||
Timestamp: timestamps,
|
||||
Type: signalpb.ReceiptMessage_DELIVERY.Enum(),
|
||||
}
|
||||
return &signalpb.Content{
|
||||
ReceiptMessage: rm,
|
||||
Content: &signalpb.Content_ReceiptMessage{
|
||||
ReceiptMessage: &signalpb.ReceiptMessage{
|
||||
Timestamp: timestamps,
|
||||
Type: signalpb.ReceiptMessage_DELIVERY.Enum(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func ReadReceptMessageForTimestamps(timestamps []uint64) *signalpb.Content {
|
||||
rm := &signalpb.ReceiptMessage{
|
||||
Timestamp: timestamps,
|
||||
Type: signalpb.ReceiptMessage_READ.Enum(),
|
||||
}
|
||||
return &signalpb.Content{
|
||||
ReceiptMessage: rm,
|
||||
Content: &signalpb.Content_ReceiptMessage{
|
||||
ReceiptMessage: &signalpb.ReceiptMessage{
|
||||
Timestamp: timestamps,
|
||||
Type: signalpb.ReceiptMessage_READ.Enum(),
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func wrapDataMessageInContent(dm *signalpb.DataMessage) *signalpb.Content {
|
||||
func WrapDataMessage(dm *signalpb.DataMessage) *signalpb.Content {
|
||||
return &signalpb.Content{
|
||||
DataMessage: dm,
|
||||
Content: &signalpb.Content_DataMessage{DataMessage: dm},
|
||||
}
|
||||
}
|
||||
|
||||
func WrapEditMessage(dm *signalpb.EditMessage) *signalpb.Content {
|
||||
return &signalpb.Content{
|
||||
Content: &signalpb.Content_EditMessage{EditMessage: dm},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -526,7 +525,7 @@ func (cli *Client) SendGroupUpdate(ctx context.Context, group *Group, groupConte
|
|||
Timestamp: ×tamp,
|
||||
GroupV2: groupContext,
|
||||
}
|
||||
content := wrapDataMessageInContent(dm)
|
||||
content := WrapDataMessage(dm)
|
||||
var recipients []libsignalgo.ServiceID
|
||||
for _, member := range group.Members {
|
||||
serviceID := member.UserServiceID()
|
||||
|
|
@ -564,13 +563,14 @@ func (cli *Client) SendGroupMessage(ctx context.Context, gid types.GroupIdentifi
|
|||
return nil, err
|
||||
}
|
||||
var messageTimestamp uint64
|
||||
if content.GetDataMessage() != nil {
|
||||
switch content := content.Content.(type) {
|
||||
case *signalpb.Content_DataMessage:
|
||||
messageTimestamp = content.DataMessage.GetTimestamp()
|
||||
content.DataMessage.GroupV2 = groupMetadataForDataMessage(*group)
|
||||
} else if content.GetEditMessage().GetDataMessage() != nil {
|
||||
case *signalpb.Content_EditMessage:
|
||||
messageTimestamp = content.EditMessage.DataMessage.GetTimestamp()
|
||||
content.EditMessage.DataMessage.GroupV2 = groupMetadataForDataMessage(*group)
|
||||
} else if content.GetTypingMessage() != nil {
|
||||
case *signalpb.Content_TypingMessage:
|
||||
messageTimestamp = content.TypingMessage.GetTimestamp()
|
||||
groupIDBytes, err := group.GroupIdentifier.Bytes()
|
||||
if err != nil {
|
||||
|
|
@ -606,7 +606,7 @@ func (cli *Client) sendToGroup(
|
|||
FailedToSendTo: []FailedSendResult{},
|
||||
}
|
||||
}
|
||||
if content.TypingMessage != nil {
|
||||
if content.GetTypingMessage() != nil {
|
||||
// Never send typing messages via fallback path
|
||||
return result, nil
|
||||
}
|
||||
|
|
@ -648,15 +648,16 @@ func (cli *Client) sendToGroup(
|
|||
|
||||
func (cli *Client) sendGroupSyncCopy(
|
||||
ctx context.Context,
|
||||
content *signalpb.Content,
|
||||
rawContent *signalpb.Content,
|
||||
messageTimestamp uint64,
|
||||
result *GroupMessageSendResult,
|
||||
groupID *libsignalgo.GroupIdentifier,
|
||||
) {
|
||||
var syncContent *signalpb.Content
|
||||
if content.GetDataMessage() != nil {
|
||||
switch content := rawContent.Content.(type) {
|
||||
case *signalpb.Content_DataMessage:
|
||||
syncContent = syncMessageFromGroupDataMessage(content.DataMessage, result.SuccessfullySentTo)
|
||||
} else if content.GetEditMessage() != nil {
|
||||
case *signalpb.Content_EditMessage:
|
||||
syncContent = syncMessageFromGroupEditMessage(content.EditMessage, result.SuccessfullySentTo)
|
||||
}
|
||||
if syncContent != nil {
|
||||
|
|
@ -667,16 +668,17 @@ func (cli *Client) sendGroupSyncCopy(
|
|||
}
|
||||
}
|
||||
|
||||
func (cli *Client) sendSyncCopy(ctx context.Context, content *signalpb.Content, messageTS uint64, result *SuccessfulSendResult) bool {
|
||||
func (cli *Client) sendSyncCopy(ctx context.Context, rawContent *signalpb.Content, messageTS uint64, result *SuccessfulSendResult) bool {
|
||||
var syncContent *signalpb.Content
|
||||
if content.GetDataMessage() != nil {
|
||||
switch content := rawContent.Content.(type) {
|
||||
case *signalpb.Content_DataMessage:
|
||||
syncContent = syncMessageFromSoloDataMessage(content.DataMessage, *result)
|
||||
} else if content.GetEditMessage() != nil {
|
||||
case *signalpb.Content_EditMessage:
|
||||
syncContent = syncMessageFromSoloEditMessage(content.EditMessage, *result)
|
||||
} else if content.GetReceiptMessage().GetType() == signalpb.ReceiptMessage_READ {
|
||||
case *signalpb.Content_ReceiptMessage:
|
||||
syncContent = syncMessageFromReadReceiptMessage(ctx, content.ReceiptMessage, result.Recipient)
|
||||
} else if content.GetSyncMessage() != nil {
|
||||
syncContent = content
|
||||
case *signalpb.Content_SyncMessage:
|
||||
syncContent = rawContent
|
||||
}
|
||||
if syncContent != nil {
|
||||
_, selfSendErr := cli.sendContent(ctx, cli.Store.ACIServiceID(), messageTS, syncContent, 0, true, nil, nil)
|
||||
|
|
@ -692,22 +694,25 @@ func (cli *Client) sendSyncCopy(ctx context.Context, content *signalpb.Content,
|
|||
func (cli *Client) SendMessage(ctx context.Context, recipientID libsignalgo.ServiceID, content *signalpb.Content) SendMessageResult {
|
||||
// Assemble the content to send
|
||||
var messageTimestamp uint64
|
||||
switch {
|
||||
case content.DataMessage != nil:
|
||||
messageTimestamp = *content.DataMessage.Timestamp
|
||||
case content.EditMessage != nil:
|
||||
messageTimestamp = *content.EditMessage.DataMessage.Timestamp
|
||||
case content.TypingMessage != nil:
|
||||
messageTimestamp = *content.TypingMessage.Timestamp
|
||||
case content.SyncMessage != nil,
|
||||
content.NullMessage != nil,
|
||||
content.ReceiptMessage != nil,
|
||||
content.PniSignatureMessage != nil,
|
||||
content.SenderKeyDistributionMessage != nil,
|
||||
content.DecryptionErrorMessage != nil:
|
||||
switch realContent := content.Content.(type) {
|
||||
case *signalpb.Content_DataMessage:
|
||||
messageTimestamp = *realContent.DataMessage.Timestamp
|
||||
case *signalpb.Content_EditMessage:
|
||||
messageTimestamp = *realContent.EditMessage.DataMessage.Timestamp
|
||||
case *signalpb.Content_TypingMessage:
|
||||
messageTimestamp = *realContent.TypingMessage.Timestamp
|
||||
case *signalpb.Content_SyncMessage,
|
||||
*signalpb.Content_NullMessage,
|
||||
*signalpb.Content_ReceiptMessage,
|
||||
*signalpb.Content_DecryptionErrorMessage:
|
||||
messageTimestamp = currentMessageTimestamp()
|
||||
case *signalpb.Content_StoryMessage:
|
||||
// not yet supported
|
||||
default:
|
||||
panic(fmt.Errorf("unsupported payload in SendMessage"))
|
||||
if content.SenderKeyDistributionMessage == nil && content.PniSignatureMessage == nil {
|
||||
panic(fmt.Errorf("unsupported payload in SendMessage"))
|
||||
}
|
||||
messageTimestamp = currentMessageTimestamp()
|
||||
}
|
||||
var aci, pni uuid.UUID
|
||||
if recipientID.Type == libsignalgo.ServiceIDTypeACI {
|
||||
|
|
@ -715,7 +720,7 @@ func (cli *Client) SendMessage(ctx context.Context, recipientID libsignalgo.Serv
|
|||
} else if recipientID.Type == libsignalgo.ServiceIDTypePNI {
|
||||
pni = recipientID.UUID
|
||||
}
|
||||
isTypingOrReceipt := content.TypingMessage != nil || content.ReceiptMessage != nil
|
||||
isTypingOrReceipt := content.GetTypingMessage() != nil || content.GetReceiptMessage() != nil
|
||||
recipientData, err := cli.Store.RecipientStore.LoadAndUpdateRecipient(ctx, aci, pni, func(recipientData *types.Recipient) (changed bool, err error) {
|
||||
if content.GetDataMessage().GetFlags() == uint32(signalpb.DataMessage_PROFILE_KEY_UPDATE) {
|
||||
recipientData.Whitelisted = ptr.Ptr(true)
|
||||
|
|
@ -753,7 +758,7 @@ func (cli *Client) SendMessage(ctx context.Context, recipientID libsignalgo.Serv
|
|||
cli.sendSyncCopy(ctx, content, messageTimestamp, &res)
|
||||
}
|
||||
return SendMessageResult{WasSuccessful: true, SuccessfulSendResult: res}
|
||||
} else if content.TypingMessage != nil && cli.Store.DeviceData.AccountRecord != nil && !cli.Store.DeviceData.AccountRecord.GetTypingIndicators() {
|
||||
} else if content.GetTypingMessage() != nil && cli.Store.DeviceData.AccountRecord != nil && !cli.Store.DeviceData.AccountRecord.GetTypingIndicators() {
|
||||
zerolog.Ctx(ctx).Debug().Msg("Not sending typing message as typing indicators are disabled")
|
||||
res := SuccessfulSendResult{Recipient: recipientID}
|
||||
return SendMessageResult{WasSuccessful: true, SuccessfulSendResult: res}
|
||||
|
|
@ -765,7 +770,7 @@ func (cli *Client) SendMessage(ctx context.Context, recipientID libsignalgo.Serv
|
|||
return SendMessageResult{WasSuccessful: true, SuccessfulSendResult: res}
|
||||
}
|
||||
|
||||
isDeliveryReceipt := content.ReceiptMessage != nil && content.GetReceiptMessage().GetType() == signalpb.ReceiptMessage_DELIVERY
|
||||
isDeliveryReceipt := content.GetReceiptMessage() != nil && content.GetReceiptMessage().GetType() == signalpb.ReceiptMessage_DELIVERY
|
||||
if recipientID == cli.Store.ACIServiceID() && !isDeliveryReceipt {
|
||||
res := SuccessfulSendResult{
|
||||
Recipient: recipientID,
|
||||
|
|
@ -819,25 +824,38 @@ func currentMessageTimestamp() uint64 {
|
|||
}
|
||||
|
||||
func isSyncMessageUrgent(content *signalpb.SyncMessage) bool {
|
||||
return content.Sent != nil || content.Request != nil
|
||||
switch content.Content.(type) {
|
||||
case *signalpb.SyncMessage_Request_,
|
||||
*signalpb.SyncMessage_Sent_:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func isUrgent(content *signalpb.Content) bool {
|
||||
return content.DataMessage != nil ||
|
||||
content.CallMessage != nil ||
|
||||
content.StoryMessage != nil ||
|
||||
content.EditMessage != nil ||
|
||||
(content.SyncMessage != nil && isSyncMessageUrgent(content.SyncMessage))
|
||||
func isUrgent(rawContent *signalpb.Content) bool {
|
||||
switch content := rawContent.Content.(type) {
|
||||
case *signalpb.Content_SyncMessage:
|
||||
return isSyncMessageUrgent(content.SyncMessage)
|
||||
case *signalpb.Content_DataMessage,
|
||||
*signalpb.Content_EditMessage,
|
||||
*signalpb.Content_CallMessage,
|
||||
*signalpb.Content_StoryMessage:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func getContentHint(content *signalpb.Content) libsignalgo.UnidentifiedSenderMessageContentHint {
|
||||
if content.DataMessage != nil || content.EditMessage != nil {
|
||||
func getContentHint(rawContent *signalpb.Content) libsignalgo.UnidentifiedSenderMessageContentHint {
|
||||
switch rawContent.Content.(type) {
|
||||
case *signalpb.Content_DataMessage, *signalpb.Content_EditMessage:
|
||||
return libsignalgo.UnidentifiedSenderMessageContentHintResendable
|
||||
}
|
||||
if content.TypingMessage != nil || content.ReceiptMessage != nil {
|
||||
case *signalpb.Content_TypingMessage, *signalpb.Content_ReceiptMessage:
|
||||
return libsignalgo.UnidentifiedSenderMessageContentHintImplicit
|
||||
default:
|
||||
return libsignalgo.UnidentifiedSenderMessageContentHintDefault
|
||||
}
|
||||
return libsignalgo.UnidentifiedSenderMessageContentHintDefault
|
||||
}
|
||||
|
||||
func (cli *Client) sendContent(
|
||||
|
|
@ -858,12 +876,12 @@ func (cli *Client) sendContent(
|
|||
ctx = log.WithContext(ctx)
|
||||
|
||||
// If it's a data message, add our profile key
|
||||
if content.DataMessage != nil && content.DataMessage.ProfileKey == nil {
|
||||
if content.GetDataMessage() != nil && content.GetDataMessage().ProfileKey == nil {
|
||||
profileKey, err := cli.ProfileKeyForSignalID(ctx, cli.Store.ACI)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Error getting profile key, not adding to outgoing message")
|
||||
} else {
|
||||
content.DataMessage.ProfileKey = profileKey.Slice()
|
||||
content.GetDataMessage().ProfileKey = profileKey.Slice()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -942,7 +960,6 @@ func (cli *Client) sendContent(
|
|||
Uint64("response_id", *response.Id).
|
||||
Uint32("response_status", *response.Status).
|
||||
Logger()
|
||||
ctx = log.WithContext(ctx)
|
||||
if json.Valid(response.GetBody()) {
|
||||
log.Debug().RawJSON("response_body", response.GetBody()).Msg("DEBUG: message send response data")
|
||||
} else {
|
||||
|
|
|
|||
251
pkg/signalmeow/sticker.go
Normal file
251
pkg/signalmeow/sticker.go
Normal file
|
|
@ -0,0 +1,251 @@
|
|||
// mautrix-signal - A Matrix-signal puppeting bridge.
|
||||
// Copyright (C) 2026 Tulir Asokan
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
package signalmeow
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/hkdf"
|
||||
"crypto/sha256"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"net/http"
|
||||
"net/textproto"
|
||||
"sync"
|
||||
|
||||
"go.mau.fi/util/exerrors"
|
||||
"go.mau.fi/util/random"
|
||||
"golang.org/x/sync/semaphore"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
signalpb "go.mau.fi/mautrix-signal/pkg/signalmeow/protobuf"
|
||||
"go.mau.fi/mautrix-signal/pkg/signalmeow/web"
|
||||
)
|
||||
|
||||
func DownloadStickerPackManifest(ctx context.Context, packID, packKey []byte) (*signalpb.Pack, error) {
|
||||
if len(packID) != 16 {
|
||||
return nil, fmt.Errorf("invalid pack ID length: %d", len(packID))
|
||||
}
|
||||
resp, err := downloadStickerData(ctx, fmt.Sprintf("/stickers/%x/manifest.proto", packID), packKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var pack signalpb.Pack
|
||||
err = proto.Unmarshal(resp, &pack)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to unmarshal decrypted manifest: %w", err)
|
||||
}
|
||||
return &pack, nil
|
||||
}
|
||||
|
||||
func DownloadStickerPackItem(ctx context.Context, packID, packKey []byte, stickerID uint32) ([]byte, error) {
|
||||
if len(packID) != 16 {
|
||||
return nil, fmt.Errorf("invalid pack ID length: %d", len(packID))
|
||||
}
|
||||
return downloadStickerData(ctx, fmt.Sprintf("/stickers/%x/full/%d", packID, stickerID), packKey)
|
||||
}
|
||||
|
||||
func downloadStickerData(ctx context.Context, path string, packKey []byte) ([]byte, error) {
|
||||
if len(packKey) != 32 {
|
||||
return nil, fmt.Errorf("invalid pack key length: %d", len(packKey))
|
||||
}
|
||||
var body, decrypted []byte
|
||||
resp, err := web.SendHTTPRequest(ctx, web.CDN1Hostname, http.MethodGet, path, nil)
|
||||
defer web.CloseBody(resp)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to make request: %w", err)
|
||||
} else if resp.StatusCode != http.StatusOK {
|
||||
return nil, fmt.Errorf("unexpected status code %d", resp.StatusCode)
|
||||
} else if body, err = io.ReadAll(resp.Body); err != nil {
|
||||
return nil, fmt.Errorf("failed to read response: %w", err)
|
||||
} else if decrypted, err = decryptSticker(packKey, body); err != nil {
|
||||
return nil, fmt.Errorf("failed to decrypt response: %w", err)
|
||||
} else {
|
||||
return decrypted, nil
|
||||
}
|
||||
}
|
||||
|
||||
type stickerUploadAttributes struct {
|
||||
ACL string `json:"acl"`
|
||||
Algorithm string `json:"algorithm"`
|
||||
Credential string `json:"credential"`
|
||||
Date string `json:"date"`
|
||||
ID int `json:"id"`
|
||||
Key string `json:"key"`
|
||||
Policy string `json:"policy"`
|
||||
Signature string `json:"signature"`
|
||||
}
|
||||
|
||||
func (sua *stickerUploadAttributes) makeFormBody(encryptedData []byte) (*web.HTTPReqOpt, error) {
|
||||
var buf bytes.Buffer
|
||||
writer := multipart.NewWriter(&buf)
|
||||
var closed bool
|
||||
// This isn't necessary in practice, just do it to avoid linter warnings
|
||||
defer func() {
|
||||
if !closed {
|
||||
_ = writer.Close()
|
||||
}
|
||||
}()
|
||||
fields := map[string]string{
|
||||
"key": sua.Key,
|
||||
"acl": sua.ACL,
|
||||
"policy": sua.Policy,
|
||||
"x-amz-algorithm": sua.Algorithm,
|
||||
"x-amz-credential": sua.Credential,
|
||||
"x-amz-date": sua.Date,
|
||||
"Content-Type": "application/octet-stream",
|
||||
}
|
||||
for key, value := range fields {
|
||||
err := writer.WriteField(key, value)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to write multipart field %s: %w", key, err)
|
||||
}
|
||||
}
|
||||
filePart, err := writer.CreatePart(textproto.MIMEHeader{
|
||||
"Content-Type": []string{"application/octet-stream"},
|
||||
"Content-Disposition": []string{`form-data; name="file"`},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create multipart file part: %w", err)
|
||||
}
|
||||
_, err = filePart.Write(encryptedData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to write file data to multipart body: %w", err)
|
||||
}
|
||||
err = writer.Close()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to close multipart writer: %w", err)
|
||||
}
|
||||
closed = true
|
||||
return &web.HTTPReqOpt{
|
||||
Body: buf.Bytes(),
|
||||
ContentType: web.ContentType(writer.FormDataContentType()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (sua *stickerUploadAttributes) upload(ctx context.Context, packKey, fileData []byte) error {
|
||||
encryptedData, err := macAndAESEncrypt(fileData, deriveStickerPackKey(packKey))
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to encrypt sticker data: %w", err)
|
||||
}
|
||||
req, err := sua.makeFormBody(encryptedData)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to prepare request: %w", err)
|
||||
}
|
||||
resp, err := web.SendHTTPRequest(ctx, web.CDN1Hostname, http.MethodPost, "/", req)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = resp.Body.Close()
|
||||
if resp.StatusCode < 200 || resp.StatusCode >= 300 {
|
||||
return fmt.Errorf("unexpected status code %d", resp.StatusCode)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sua *stickerUploadAttributes) uploadAsync(
|
||||
ctx context.Context,
|
||||
packKey []byte,
|
||||
getFileData func(context.Context) ([]byte, error),
|
||||
sema *semaphore.Weighted,
|
||||
done func(),
|
||||
onError func(error),
|
||||
) {
|
||||
defer done()
|
||||
err := sema.Acquire(ctx, 1)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
defer sema.Release(1)
|
||||
fileData, err := getFileData(ctx)
|
||||
if err == nil {
|
||||
err = sua.upload(ctx, packKey, fileData)
|
||||
}
|
||||
if err != nil {
|
||||
onError(err)
|
||||
}
|
||||
}
|
||||
|
||||
type stickerPackUploadAttributes struct {
|
||||
PackID string `json:"packId"`
|
||||
Manifest *stickerUploadAttributes `json:"manifest"`
|
||||
Stickers []*stickerUploadAttributes `json:"stickers"`
|
||||
}
|
||||
|
||||
var StickerUploadParallelism = 4
|
||||
|
||||
func (cli *Client) UploadStickerPack(ctx context.Context, pack *signalpb.Pack, stickerData []func(context.Context) ([]byte, error)) (packID, packKey []byte, err error) {
|
||||
for i, sticker := range pack.Stickers {
|
||||
if sticker.GetId() >= uint32(len(stickerData)) {
|
||||
return nil, nil, fmt.Errorf("sticker ID %d at index %d is out of bounds, only %d sticker blobs provided", sticker.GetId(), i, len(stickerData))
|
||||
}
|
||||
}
|
||||
marshaledPack, err := proto.Marshal(pack)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to marshal pack: %w", err)
|
||||
}
|
||||
packKey = random.Bytes(32)
|
||||
resp, err := cli.AuthedWS.SendRequest(ctx, http.MethodGet, fmt.Sprintf("/v1/sticker/pack/form/%d", len(stickerData)), nil, nil)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to get upload form: %w", err)
|
||||
}
|
||||
var packAttributes stickerPackUploadAttributes
|
||||
err = web.DecodeWSResponseBody(ctx, &packAttributes, resp)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to decode pack attributes: %w", err)
|
||||
}
|
||||
if len(packAttributes.Stickers) != len(stickerData) {
|
||||
return nil, nil, fmt.Errorf("expected %d sticker upload attribute sets, got %d", len(stickerData), len(packAttributes.Stickers))
|
||||
}
|
||||
packID, err = hex.DecodeString(packAttributes.PackID)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("invalid pack ID in response: %w", err)
|
||||
}
|
||||
err = packAttributes.Manifest.upload(ctx, packKey, marshaledPack)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to upload manifest: %w", err)
|
||||
}
|
||||
var wg sync.WaitGroup
|
||||
wg.Add(len(packAttributes.Stickers))
|
||||
sema := semaphore.NewWeighted(int64(StickerUploadParallelism))
|
||||
var errorList []error
|
||||
var errorLock sync.Mutex
|
||||
for i, attrs := range packAttributes.Stickers {
|
||||
go attrs.uploadAsync(ctx, packKey, stickerData[i], sema, wg.Done, func(err error) {
|
||||
errorLock.Lock()
|
||||
errorList = append(errorList, fmt.Errorf("failed to upload sticker #%d: %w", i+1, err))
|
||||
errorLock.Unlock()
|
||||
})
|
||||
}
|
||||
wg.Wait()
|
||||
err = ctx.Err()
|
||||
if err == nil {
|
||||
err = errors.Join(errorList...)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func decryptSticker(packKey, ciphertext []byte) ([]byte, error) {
|
||||
return macAndAESDecrypt(ciphertext, deriveStickerPackKey(packKey))
|
||||
}
|
||||
|
||||
func deriveStickerPackKey(key []byte) []byte {
|
||||
return exerrors.Must(hkdf.Key(sha256.New, key, make([]byte, 32), "Sticker Pack", 2*32))
|
||||
}
|
||||
|
|
@ -66,12 +66,14 @@ func (cli *Client) processStorageInTxn(ctx context.Context, update *StorageUpdat
|
|||
switch data := record.StorageRecord.GetRecord().(type) {
|
||||
case *signalpb.StorageRecord_Contact:
|
||||
log.Trace().Any("contact_record", data.Contact).Msg("Handling contact record")
|
||||
aci, _ := uuid.Parse(data.Contact.Aci)
|
||||
pni, _ := uuid.Parse(data.Contact.Pni)
|
||||
aci, _ := ParseStringOrBinaryUUID(data.Contact.Aci, data.Contact.AciBinary)
|
||||
pni, _ := ParseStringOrBinaryUUID(data.Contact.Pni, data.Contact.PniBinary)
|
||||
if aci == uuid.Nil && pni == uuid.Nil {
|
||||
log.Warn().
|
||||
Str("raw_aci", data.Contact.Aci).
|
||||
Str("raw_pni", data.Contact.Pni).
|
||||
Hex("raw_aci_binary", data.Contact.AciBinary).
|
||||
Hex("raw_pni_binary", data.Contact.PniBinary).
|
||||
Str("raw_e164", data.Contact.E164).
|
||||
Msg("Storage service has contact record with no ACI or PNI")
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import (
|
|||
"net/http"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog"
|
||||
|
||||
|
|
@ -129,6 +130,7 @@ func SendHTTPRequest(ctx context.Context, host, method, path string, opt *HTTPRe
|
|||
} else {
|
||||
req.Header.Set("Content-Type", string(ContentTypeJSON))
|
||||
}
|
||||
req.ContentLength = int64(len(opt.Body))
|
||||
req.Header.Set("Content-Length", fmt.Sprintf("%d", len(opt.Body)))
|
||||
req.Header.Set("User-Agent", UserAgent)
|
||||
req.Header.Set("X-Signal-Agent", SignalAgent)
|
||||
|
|
@ -139,12 +141,14 @@ func SendHTTPRequest(ctx context.Context, host, method, path string, opt *HTTPRe
|
|||
httpReqCounter++
|
||||
log = log.With().Int("request_number", httpReqCounter).Logger()
|
||||
log.Trace().Msg("Sending HTTP request")
|
||||
start := time.Now()
|
||||
resp, err := SignalHTTPClient.Do(req)
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
log.Err(err).Msg("Error sending request")
|
||||
log.Err(err).Dur("duration", dur).Msg("Error sending request")
|
||||
return nil, err
|
||||
}
|
||||
log.Debug().Int("status_code", resp.StatusCode).Msg("received HTTP response")
|
||||
log.Debug().Int("status_code", resp.StatusCode).Dur("duration", dur).Msg("Received HTTP response")
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue