mirror of
https://github.com/AsamK/signal-cli.git
synced 2026-06-15 17:51:24 +00:00
Compare commits
1089 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
debb8a20e6 | ||
|
|
6bef205b3f | ||
|
|
443b4da8f8 | ||
|
|
afe8c24665 | ||
|
|
9f0676d563 | ||
|
|
b3c1b6a4f6 | ||
|
|
bf1376d74d | ||
|
|
de678596c6 | ||
|
|
29e65a5c8e | ||
|
|
60779c91c6 | ||
|
|
bda4e7fc0f | ||
|
|
12ffc34967 | ||
|
|
9e3585dcce | ||
|
|
46c61c5aac | ||
|
|
8d6264e02e | ||
|
|
f057c5031c | ||
|
|
40b1928844 | ||
|
|
2a827f1285 | ||
|
|
ced9560040 | ||
|
|
44d54b3215 | ||
|
|
393e1efcd1 | ||
|
|
f34b552054 | ||
|
|
46ce552589 | ||
|
|
6da5c37504 | ||
|
|
4601e60118 | ||
|
|
fcf82b9318 | ||
|
|
9c8137fafa | ||
|
|
0a1531dcce | ||
|
|
c10f618a3e | ||
|
|
4a3d9d90a6 | ||
|
|
b4275414e1 | ||
|
|
5f94b7b6d1 | ||
|
|
dc43e44020 | ||
|
|
251bd2d87a | ||
|
|
a3fcda7598 | ||
|
|
c9e2504349 | ||
|
|
9b09df5f17 | ||
|
|
5fe94ff44a | ||
|
|
6286a054eb | ||
|
|
e6635d1bb0 | ||
|
|
056878fad7 | ||
|
|
da214817be | ||
|
|
d6edaf3be2 | ||
|
|
47e50988b5 | ||
|
|
aa446619f2 | ||
|
|
6405655127 | ||
|
|
b8d990b0f9 | ||
|
|
417d2ce971 | ||
|
|
33b2b563b3 | ||
|
|
740cd6f89b | ||
|
|
7887ed408d | ||
|
|
ddfad2c4ce | ||
|
|
7e95ea7403 | ||
|
|
2991cdafe7 | ||
|
|
561dfc373f | ||
|
|
5bfb044245 | ||
|
|
e1b17bf863 | ||
|
|
aafb40fd94 | ||
|
|
7dc55eba81 | ||
|
|
a03d17a9e4 | ||
|
|
364f89f1d0 | ||
|
|
d0ee90dbbc | ||
|
|
398faa50b0 | ||
|
|
e9eabbeeb5 | ||
|
|
132dfb95dc | ||
|
|
2651823d4d | ||
|
|
4709cfacc7 | ||
|
|
9bc4c0ecd8 | ||
|
|
763ddf85e6 | ||
|
|
b2bab0d0dc | ||
|
|
62fc96c4c9 | ||
|
|
2667688139 | ||
|
|
990d1eab58 | ||
|
|
e6b33b8da7 | ||
|
|
d40f62ec21 | ||
|
|
265369e353 | ||
|
|
d1106299fe | ||
|
|
7919a0f4aa | ||
|
|
7a8a34f45e | ||
|
|
0a777ea7df | ||
|
|
103a0807ca | ||
|
|
135d3a1677 | ||
|
|
59a0bd87cd | ||
|
|
c94da00212 | ||
|
|
36649a8526 | ||
|
|
3297acd3f4 | ||
|
|
3e5caf9284 | ||
|
|
53ae9e4266 | ||
|
|
313f5392ef | ||
|
|
7d89375d3a | ||
|
|
db0f660d08 | ||
|
|
b498d2050a | ||
|
|
27a722dc75 | ||
|
|
7014f629fe | ||
|
|
30b57bdb3d | ||
|
|
b94162afbc | ||
|
|
2885ffeee8 | ||
|
|
6071291f16 | ||
|
|
37b8a4a996 | ||
|
|
af56a28b94 | ||
|
|
dfc7e3b495 | ||
|
|
e9114ae8fc | ||
|
|
f77a74d93f | ||
|
|
5cda87ee0e | ||
|
|
7384407823 | ||
|
|
7fa56a37fd | ||
|
|
8fcd953ece | ||
|
|
775236efc3 | ||
|
|
4b8dec26a9 | ||
|
|
d94e05c38c | ||
|
|
1bbf98fac0 | ||
|
|
c70515035f | ||
|
|
a9d235b7f1 | ||
|
|
92ded3fdf2 | ||
|
|
aa1ed9e233 | ||
|
|
3b6c199b1d | ||
|
|
6d22ceef24 | ||
|
|
54ff59737e | ||
|
|
516a37ba69 | ||
|
|
6a6bebd503 | ||
|
|
f9cbfa6d6c | ||
|
|
d4b3816c5d | ||
|
|
4a35d47515 | ||
|
|
52d4d61e2b | ||
|
|
5bff902394 | ||
|
|
f33eb86335 | ||
|
|
2ea26b9d1b | ||
|
|
10fa3e1619 | ||
|
|
956e17c81c | ||
|
|
6f749352d8 | ||
|
|
5f3f6c071b | ||
|
|
5795d43d0d | ||
|
|
de42f55e37 | ||
|
|
7e93a15204 | ||
|
|
715f819c3e | ||
|
|
345de8fb5d | ||
|
|
667a47c03a | ||
|
|
5dd5e304bd | ||
|
|
60a1589616 | ||
|
|
4d1d28672d | ||
|
|
fefca7d837 | ||
|
|
d9f5a573cd | ||
|
|
4c77cde9da | ||
|
|
658b098c3a | ||
|
|
70644ba31b | ||
|
|
06a706d070 | ||
|
|
14297986f2 | ||
|
|
0bd4d554d8 | ||
|
|
32c8d4f801 | ||
|
|
82abc20871 | ||
|
|
e8ab01f665 | ||
|
|
dee557a9ad | ||
|
|
f1fa2eba1d | ||
|
|
ccd58bbf23 | ||
|
|
54700d9cd0 | ||
|
|
984ea47f9d | ||
|
|
9458972d15 | ||
|
|
8eb9662694 | ||
|
|
a9be1aa608 | ||
|
|
3af9dff0ed | ||
|
|
c5e4b250b8 | ||
|
|
5fafa24974 | ||
|
|
b26c521930 | ||
|
|
eb52380ecf | ||
|
|
f1de69d7ff | ||
|
|
ba2214d8c7 | ||
|
|
fca4d7459c | ||
|
|
ad2338b898 | ||
|
|
c237f98044 | ||
|
|
87945ac506 | ||
|
|
11d96c894d | ||
|
|
8dcc16d640 | ||
|
|
9a1ddd0d41 | ||
|
|
b8bb58b083 | ||
|
|
7feba3c8c7 | ||
|
|
dae44c81d2 | ||
|
|
c2ac74a6be | ||
|
|
62811d92c5 | ||
|
|
feaee2bfe1 | ||
|
|
91701f609a | ||
|
|
d27aea2220 | ||
|
|
e832a57f35 | ||
|
|
13e6445498 | ||
|
|
552ce6b06d | ||
|
|
c3bce6730d | ||
|
|
5d2daedba3 | ||
|
|
6ee043449b | ||
|
|
5510d1e20d | ||
|
|
cad61dae37 | ||
|
|
1fcedca0f1 | ||
|
|
7b08225c57 | ||
|
|
06fd350e9c | ||
|
|
9ee747271a | ||
|
|
ef3c1ea0e7 | ||
|
|
3b784aa32b | ||
|
|
05a9635dc4 | ||
|
|
6abe3c7a06 | ||
|
|
98b46353ea | ||
|
|
af0f4a6b01 | ||
|
|
96ec6624c5 | ||
|
|
9f1ae5f4db | ||
|
|
1d06f042e1 | ||
|
|
761bcdd064 | ||
|
|
c108d59cfc | ||
|
|
429c4dca07 | ||
|
|
52d818be45 | ||
|
|
21a546d2bc | ||
|
|
e65fee0efb | ||
|
|
29dc873535 | ||
|
|
69d892e5b1 | ||
|
|
3be0aefa20 | ||
|
|
a399666fba | ||
|
|
1af03e3e16 | ||
|
|
7a82283762 | ||
|
|
fb92bc3894 | ||
|
|
a22af8303a | ||
|
|
371dc06842 | ||
|
|
e60b80effc | ||
|
|
b9008f0b66 | ||
|
|
2239231601 | ||
|
|
9a45138d8b | ||
|
|
edd52a97b4 | ||
|
|
f469a4d166 | ||
|
|
b2076cfc12 | ||
|
|
991ff04196 | ||
|
|
597f0368cf | ||
|
|
c37d8c6ce1 | ||
|
|
61bc30eb43 | ||
|
|
f6d81e3c05 | ||
|
|
42f10670b6 | ||
|
|
b453d7a0b9 | ||
|
|
f9a36c6e04 | ||
|
|
be48afb2b5 | ||
|
|
a0960fcabd | ||
|
|
dbc454ba9e | ||
|
|
2225e69277 | ||
|
|
783201d12e | ||
|
|
3e981d66e9 | ||
|
|
7c7fc76a64 | ||
|
|
c924d5c03a | ||
|
|
dc787be17b | ||
|
|
3d4070a139 | ||
|
|
dbdff83132 | ||
|
|
4ce194afe2 | ||
|
|
ca33249170 | ||
|
|
a96626c468 | ||
|
|
d54be747da | ||
|
|
ff846bc678 | ||
|
|
1b7f755590 | ||
|
|
887ed3bb44 | ||
|
|
3180eba836 | ||
|
|
cb06cbdcca | ||
|
|
069325af47 | ||
|
|
e7ca02f1fb | ||
|
|
fa9bb3c210 | ||
|
|
e6113d4d96 | ||
|
|
6cc3a6f561 | ||
|
|
70c79eac01 | ||
|
|
5dc66f839d | ||
|
|
a0d5744c49 | ||
|
|
6b60a6d5a5 | ||
|
|
0257344940 | ||
|
|
17cd99be59 | ||
|
|
2f8328847c | ||
|
|
7e9727aa38 | ||
|
|
bf87fcc652 | ||
|
|
6b46314eab | ||
|
|
e89803464b | ||
|
|
a9bb8d9aae | ||
|
|
74909408c4 | ||
|
|
bb124a922d | ||
|
|
56e11d0857 | ||
|
|
d0d0021f57 | ||
|
|
7aafb05995 | ||
|
|
e594f3b237 | ||
|
|
bb86830a61 | ||
|
|
bcc1eadc7d | ||
|
|
4fd9e55c3c | ||
|
|
a2900085c9 | ||
|
|
5e11cf1c50 | ||
|
|
4e455d85d6 | ||
|
|
1e685c7cab | ||
|
|
ce813e4529 | ||
|
|
bd7948e246 | ||
|
|
b998f322f5 | ||
|
|
db2182aa7d | ||
|
|
69a9b30732 | ||
|
|
3dc8844cb4 | ||
|
|
adb6787d5b | ||
|
|
14b07be0dc | ||
|
|
6befda7ef1 | ||
|
|
67302eb9c3 | ||
|
|
f18015ff2e | ||
|
|
1295ef69ca | ||
|
|
f26a0d2891 | ||
|
|
2b150112ff | ||
|
|
7aede7c17f | ||
|
|
b92cbc6a7c | ||
|
|
68b7416e57 | ||
|
|
4feba68afd | ||
|
|
4eb34c7a93 | ||
|
|
26fd3e379a | ||
|
|
93d281e712 | ||
|
|
985af6e445 | ||
|
|
5693d871f7 | ||
|
|
dba8cf7a6f | ||
|
|
141d3326ab | ||
|
|
d3d2caac5a | ||
|
|
e1f4dae5c2 | ||
|
|
cf5c943127 | ||
|
|
ed79e0b377 | ||
|
|
a089a5ef04 | ||
|
|
90145655f4 | ||
|
|
3cd07ae9cd | ||
|
|
8aa71c132f | ||
|
|
b579935846 | ||
|
|
dfa886fae9 | ||
|
|
f04f789231 | ||
|
|
a6ec71dc31 | ||
|
|
47d65586cd | ||
|
|
b8d8413a22 | ||
|
|
5e16123632 | ||
|
|
d57442bd2a | ||
|
|
70313c45a9 | ||
|
|
f14c204764 | ||
|
|
71d3b83a1c | ||
|
|
148bf7dee2 | ||
|
|
2d1ba6b4ca | ||
|
|
055a8ee8b9 | ||
|
|
407a20d4bb | ||
|
|
05cd6aee6a | ||
|
|
a1378507b2 | ||
|
|
78cd0b13de | ||
|
|
c25468a71e | ||
|
|
a5d2e1ea23 | ||
|
|
6acf16ef4e | ||
|
|
e11e093020 | ||
|
|
74c2604dc8 | ||
|
|
e4af0be0ad | ||
|
|
5ac5938c8b | ||
|
|
94269744ad | ||
|
|
7a25ae5b9c | ||
|
|
cbd92654cf | ||
|
|
bd95373a70 | ||
|
|
d982633215 | ||
|
|
f91ca82902 | ||
|
|
c55ee85c5c | ||
|
|
a3776c88bd | ||
|
|
4a781656b4 | ||
|
|
11d38f29ef | ||
|
|
22a0ff976a | ||
|
|
c05b47e4d0 | ||
|
|
ac145e6a27 | ||
|
|
f00b8523d9 | ||
|
|
c3f8d68ceb | ||
|
|
9d92a3e06b | ||
|
|
f2df600d38 | ||
|
|
24d344fda4 | ||
|
|
0a296e77a0 | ||
|
|
ba147a48f8 | ||
|
|
77a5c454b7 | ||
|
|
2c68b5a9e1 | ||
|
|
68c9d84d19 | ||
|
|
fe752e0c79 | ||
|
|
26b5a4c582 | ||
|
|
10ee295ea3 | ||
|
|
6a5ea5fc01 | ||
|
|
ff6cb5262a | ||
|
|
f2005593ec | ||
|
|
3533500b73 | ||
|
|
e5251ae158 | ||
|
|
a5e272be3f | ||
|
|
277652e3f2 | ||
|
|
181086aefe | ||
|
|
a1d552698a | ||
|
|
1b959608c3 | ||
|
|
acddef6e35 | ||
|
|
0e77870b59 | ||
|
|
0a287b0b3e | ||
|
|
5a4f4ba6db | ||
|
|
5171107a29 | ||
|
|
47e6fc1769 | ||
|
|
9afd4e4328 | ||
|
|
eac2a47163 | ||
|
|
5646f65195 | ||
|
|
fab1b96c21 | ||
|
|
91eacc18c2 | ||
|
|
7f1fc932ad | ||
|
|
304c44064d | ||
|
|
946c483f35 | ||
|
|
69d691f416 | ||
|
|
a6ab8f7e80 | ||
|
|
19dc2d446b | ||
|
|
8524037900 | ||
|
|
dbbc3fbd71 | ||
|
|
c6e93126fa | ||
|
|
352699c4b6 | ||
|
|
bea2772491 | ||
|
|
bab8ddf35a | ||
|
|
1d5d16f57e | ||
|
|
6f9e9e9302 | ||
|
|
20add0f27b | ||
|
|
eca3c6fa30 | ||
|
|
a0d1b081ff | ||
|
|
d852c60c37 | ||
|
|
2b5451f74a | ||
|
|
b322716215 | ||
|
|
41726d339f | ||
|
|
52bb92dce4 | ||
|
|
65adfdd6f5 | ||
|
|
d8b1a2fffe | ||
|
|
ea436ecb64 | ||
|
|
82fbde4f19 | ||
|
|
19b15e68e4 | ||
|
|
b51f849fe6 | ||
|
|
7cc0ef1c70 | ||
|
|
485c4fd467 | ||
|
|
bda395191b | ||
|
|
cb129db95e | ||
|
|
130cee9906 | ||
|
|
6bdc9a4b16 | ||
|
|
a69a9b7b0e | ||
|
|
6ea373fbd5 | ||
|
|
62da514850 | ||
|
|
fe3934171d | ||
|
|
3d11221732 | ||
|
|
e961488b1a | ||
|
|
2db3d3259e | ||
|
|
e51b1ee23a | ||
|
|
5ff66728e3 | ||
|
|
baf7b74a61 | ||
|
|
c716f94649 | ||
|
|
8b355918e8 | ||
|
|
67012b40b1 | ||
|
|
fd402b52c8 | ||
|
|
5a97b9e134 | ||
|
|
17596795c2 | ||
|
|
10b9c264fd | ||
|
|
a2b002ac5e | ||
|
|
6d764db114 | ||
|
|
777cfbb69f | ||
|
|
9781c56571 | ||
|
|
04cf54263e | ||
|
|
6baf0eac13 | ||
|
|
fb21a42cce | ||
|
|
53d7e0f08b | ||
|
|
8f756cd90c | ||
|
|
fb81bf1d05 | ||
|
|
04726f005c | ||
|
|
09e3e7f335 | ||
|
|
90b1e4bc02 | ||
|
|
3f31f1a8a6 | ||
|
|
3cd8e323c9 | ||
|
|
7060faf5d3 | ||
|
|
c9f2cca024 | ||
|
|
f0054372b8 | ||
|
|
0a82c51b79 | ||
|
|
cef83d962c | ||
|
|
c1775913b9 | ||
|
|
e4c5144fbf | ||
|
|
8aeaf927e6 | ||
|
|
7e0d4c9b89 | ||
|
|
71de8e63cc | ||
|
|
e456d06cb0 | ||
|
|
e0cd5b987e | ||
|
|
e5ebb732cb | ||
|
|
419beee29a | ||
|
|
d4e1f9b7f1 | ||
|
|
edce33ae15 | ||
|
|
95f9e18de2 | ||
|
|
95d4b7d012 | ||
|
|
17c24b3ff2 | ||
|
|
be0e8ddd8a | ||
|
|
49cc9cd9f8 | ||
|
|
c85c995fef | ||
|
|
dda23e76ac | ||
|
|
95e70b9d15 | ||
|
|
abddf24752 | ||
|
|
d356d92b5e | ||
|
|
8b4f377cf1 | ||
|
|
323a801600 | ||
|
|
3372992dc2 | ||
|
|
ee39733978 | ||
|
|
5e17fe8414 | ||
|
|
aebe64571d | ||
|
|
0cc2da690a | ||
|
|
2424fc1f53 | ||
|
|
2e4cd0eddc | ||
|
|
189b21dbde | ||
|
|
e77d9e3d60 | ||
|
|
df76aa9919 | ||
|
|
378ac23c6c | ||
|
|
fc2ae856d2 | ||
|
|
57164ad7fb | ||
|
|
6c44662496 | ||
|
|
22ac3cb50f | ||
|
|
b76964f219 | ||
|
|
2f3c064462 | ||
|
|
c9002d9481 | ||
|
|
83d471818d | ||
|
|
0bb2a64781 | ||
|
|
08ba774b71 | ||
|
|
59c1f4eed2 | ||
|
|
f1e3b5c9cc | ||
|
|
7bc7242f08 | ||
|
|
6f407ab509 | ||
|
|
db9acaf4ff | ||
|
|
7821815429 | ||
|
|
cd88e896fa | ||
|
|
67fd10b978 | ||
|
|
9051f68ba6 | ||
|
|
3b3377e6e9 | ||
|
|
fb99ff5284 | ||
|
|
ed40d116b7 | ||
|
|
d84362eb0f | ||
|
|
2c0ad7feb7 | ||
|
|
7206b4da25 | ||
|
|
fd671576a4 | ||
|
|
6cd57312a1 | ||
|
|
25258db55d | ||
|
|
91ed49e019 | ||
|
|
bd792f5b7f | ||
|
|
ed4b1e8f02 | ||
|
|
e78146eb67 | ||
|
|
9f6b6cb657 | ||
|
|
fb85e1a068 | ||
|
|
c78299e7bc | ||
|
|
9a5e29e015 | ||
|
|
7cf3a989bf | ||
|
|
d486563099 | ||
|
|
be699cbd85 | ||
|
|
4e61f2b2e5 | ||
|
|
1bf703b012 | ||
|
|
a48fdaf8b7 | ||
|
|
a0f33ac942 | ||
|
|
bea659f948 | ||
|
|
7fb263fdf0 | ||
|
|
3be1c24b1b | ||
|
|
0b33cb55b8 | ||
|
|
00e71ed0fc | ||
|
|
a40810e33e | ||
|
|
15c9d04703 | ||
|
|
e13dcdc85a | ||
|
|
2ab5b2817e | ||
|
|
080c14d111 | ||
|
|
d1e32f2b11 | ||
|
|
0840e0dedb | ||
|
|
888d6bf091 | ||
|
|
e2f308a57a | ||
|
|
76fe6ad799 | ||
|
|
90df256e85 | ||
|
|
f92466f6be | ||
|
|
6a5dcd00b2 | ||
|
|
6c65de8ddf | ||
|
|
f696097301 | ||
|
|
7d3db03d4a | ||
|
|
78c87e501e | ||
|
|
2974b466aa | ||
|
|
ca1a852b44 | ||
|
|
ac2343b142 | ||
|
|
be9efb9a25 | ||
|
|
30e8e36635 | ||
|
|
3290a5bf4d | ||
|
|
c07ba14fc6 | ||
|
|
c6e9e19858 | ||
|
|
375bdb7948 | ||
|
|
5e7899675e | ||
|
|
328ba0202f | ||
|
|
59cbbde835 | ||
|
|
caa4fa0180 | ||
|
|
fc6a4b78eb | ||
|
|
2729772adb | ||
|
|
70e0f7027e | ||
|
|
4dcdffda0a | ||
|
|
2535cd9c2c | ||
|
|
d3eef6c820 | ||
|
|
35fb1d60af | ||
|
|
089ec22666 | ||
|
|
66077f317b | ||
|
|
5904bfa92b | ||
|
|
2c1d7a803f | ||
|
|
6d5b8b6a7b | ||
|
|
b88f8c205e | ||
|
|
ce4afbe4c2 | ||
|
|
fcaecef961 | ||
|
|
81d2e315e3 | ||
|
|
fddf982832 | ||
|
|
3602ef9be9 | ||
|
|
37c65ca6b4 | ||
|
|
77f284661b | ||
|
|
0d60c4d464 | ||
|
|
f06eeb01b9 | ||
|
|
fbcc1cfb50 | ||
|
|
26cef99cdf | ||
|
|
5cac7feabe | ||
|
|
d844e0f396 | ||
|
|
ed11bf6368 | ||
|
|
eaa6b7cf57 | ||
|
|
f8ea631b03 | ||
|
|
7b0744ec75 | ||
|
|
9f4a2b3e26 | ||
|
|
9741c93ce9 | ||
|
|
7e9940be4a | ||
|
|
c0aa338d7c | ||
|
|
b20978e08e | ||
|
|
5d33f71d4d | ||
|
|
1058e33f12 | ||
|
|
b7fedff511 | ||
|
|
f252597002 | ||
|
|
cbbfc4ea6e | ||
|
|
6b04197eaa | ||
|
|
3027ba2cf1 | ||
|
|
19e9f31afd | ||
|
|
5a1d2580cb | ||
|
|
cb5cace8da | ||
|
|
e734c125ad | ||
|
|
d351f64fb1 | ||
|
|
e61f587bfc | ||
|
|
4e8f0a41c7 | ||
|
|
4fbc97c92a | ||
|
|
1e35ac380e | ||
|
|
85b0647a3e | ||
|
|
7b899d1853 | ||
|
|
699b21f066 | ||
|
|
8d423adb4d | ||
|
|
506dcfa6c0 | ||
|
|
91e0d5164b | ||
|
|
67d8ffcde5 | ||
|
|
44c9aded65 | ||
|
|
f1ccfc0361 | ||
|
|
cdef9c435c | ||
|
|
ed8ac5b84c | ||
|
|
8d55dfb66b | ||
|
|
80c1a6d2af | ||
|
|
895740755d | ||
|
|
90601b7b6b | ||
|
|
cc2ffbb4da | ||
|
|
0c24064939 | ||
|
|
7859084be8 | ||
|
|
101c217ef8 | ||
|
|
7887a5a613 | ||
|
|
800ff09a37 | ||
|
|
20f8fa2ebd | ||
|
|
314159c273 | ||
|
|
bf16885278 | ||
|
|
3ae6f7ab7c | ||
|
|
e829dd8b5c | ||
|
|
62c71eaafa | ||
|
|
24ec25ac62 | ||
|
|
19b5c76154 | ||
|
|
2852b2ea6d | ||
|
|
fc2e9bbfae | ||
|
|
d51dd7ae57 | ||
|
|
9ba70c1808 | ||
|
|
9ec942ea1d | ||
|
|
b9e644269b | ||
|
|
5b56445741 | ||
|
|
1ed5148624 | ||
|
|
fb7c63c507 | ||
|
|
2c5edbc981 | ||
|
|
1addffe622 | ||
|
|
733c14bbc8 | ||
|
|
ca2e6adedb | ||
|
|
5cc20ace1f | ||
|
|
400dcf2899 | ||
|
|
dd3326f038 | ||
|
|
505de39d2a | ||
|
|
24069c8277 | ||
|
|
bb78e9aaeb | ||
|
|
5c39344cff | ||
|
|
7cd24a74af | ||
|
|
a675631965 | ||
|
|
33c4e17c0d | ||
|
|
56ee173d03 | ||
|
|
af4709255a | ||
|
|
527e1aefc9 | ||
|
|
a66dd0dc79 | ||
|
|
7b5b5776f0 | ||
|
|
91ab0b12b0 | ||
|
|
c2ea7045f5 | ||
|
|
af3cae5f3d | ||
|
|
54c3b19052 | ||
|
|
04de0010b5 | ||
|
|
66161b74a6 | ||
|
|
889ef66784 | ||
|
|
fae83f8d22 | ||
|
|
6f4d538832 | ||
|
|
a0c345185b | ||
|
|
c0f771684d | ||
|
|
90ec01bfbf | ||
|
|
7f83bfefd6 | ||
|
|
310aadbdc0 | ||
|
|
6b2de3a24d | ||
|
|
002a87d3ba | ||
|
|
6f63346905 | ||
|
|
735766669e | ||
|
|
0dda8b405e | ||
|
|
47626b2af4 | ||
|
|
fed2c94431 | ||
|
|
da7428d6bd | ||
|
|
dced7a14c8 | ||
|
|
f1d735f93d | ||
|
|
73b4239744 | ||
|
|
67747253e8 | ||
|
|
0bdc400a30 | ||
|
|
b12a016f3a | ||
|
|
fd851ba6cb | ||
|
|
b2a32666e9 | ||
|
|
a7744e837c | ||
|
|
e5aa10a730 | ||
|
|
e626cc0390 | ||
|
|
4d93415485 | ||
|
|
ed746c389c | ||
|
|
a7a5947a1b | ||
|
|
c8daef5113 | ||
|
|
ee195c966e | ||
|
|
6ecda07577 | ||
|
|
26fea2d6a0 | ||
|
|
87e79bceaa | ||
|
|
bc3bdbbf21 | ||
|
|
884fa2748e | ||
|
|
4a37227b95 | ||
|
|
a9f1944636 | ||
|
|
6d23eb3bf6 | ||
|
|
3d13c69e41 | ||
|
|
fb8624f630 | ||
|
|
795c5f6a04 | ||
|
|
98a8c991e2 | ||
|
|
e867c57af8 | ||
|
|
133e2cc222 | ||
|
|
e0a326f15b | ||
|
|
b3f550ee68 | ||
|
|
29923cf930 | ||
|
|
9a63f97a19 | ||
|
|
2d73ba6735 | ||
|
|
8037fb2d66 | ||
|
|
edbf803a98 | ||
|
|
b51c791629 | ||
|
|
6cbd583746 | ||
|
|
b55d75ef99 | ||
|
|
5e692df08c | ||
|
|
e19ad40023 | ||
|
|
934697af28 | ||
|
|
ca088bcc33 | ||
|
|
1559d28ed8 | ||
|
|
376a1704df | ||
|
|
68dbf27b2f | ||
|
|
6bde5960aa | ||
|
|
86e1079195 | ||
|
|
409a707baa | ||
|
|
86f50e0355 | ||
|
|
02d4cb4a14 | ||
|
|
2487fff44a | ||
|
|
ffeae1a95a | ||
|
|
e57e5b090e | ||
|
|
c8e35991b9 | ||
|
|
0ebfd989d1 | ||
|
|
306e38c9ee | ||
|
|
4e5c859aab | ||
|
|
ac815f7598 | ||
|
|
a3f7de89f1 | ||
|
|
b70a43aeb5 | ||
|
|
8726c4ede0 | ||
|
|
0c5993c0ad | ||
|
|
da25b2a763 | ||
|
|
aad4b53524 | ||
|
|
3d5c440aa2 | ||
|
|
4f8da7819e | ||
|
|
a96c4938b1 | ||
|
|
c62a1e829f | ||
|
|
106af6a801 | ||
|
|
2ae5297f7d | ||
|
|
a7db3a5610 | ||
|
|
d0d3e20713 | ||
|
|
c852bd8a85 | ||
|
|
7499b41d6b | ||
|
|
ee12805d05 | ||
|
|
dacb48b4f4 | ||
|
|
90f82b6d4c | ||
|
|
227f87e1ce | ||
|
|
83c75acd0a | ||
|
|
ff162cb44d | ||
|
|
e5a67d6ce1 | ||
|
|
5197212d3f | ||
|
|
8c1b5d54f7 | ||
|
|
8a0005d900 | ||
|
|
a754eb6faf | ||
|
|
c9082a63f0 | ||
|
|
314b3cafbb | ||
|
|
91700ce995 | ||
|
|
145a2f1179 | ||
|
|
6e61bc2000 | ||
|
|
9da6f3a702 | ||
|
|
760934d5a5 | ||
|
|
a3bc754e80 | ||
|
|
ae652b1294 | ||
|
|
ab01867235 | ||
|
|
6b0b36a555 | ||
|
|
ee63a27fe9 | ||
|
|
5f0c49d653 | ||
|
|
8a31b7f2c1 | ||
|
|
72390e595d | ||
|
|
e0e8e11443 | ||
|
|
f7f882e834 | ||
|
|
60ad582012 | ||
|
|
f6aebb5917 | ||
|
|
3a4ad96a00 | ||
|
|
e0ed651e53 | ||
|
|
c703644dbe | ||
|
|
da4cc7dc6b | ||
|
|
842f13b2fc | ||
|
|
d2251ccd14 | ||
|
|
6a3ebfd4c8 | ||
|
|
ff803eaf45 | ||
|
|
c93480692c | ||
|
|
542a3f36a4 | ||
|
|
24a8c528d0 | ||
|
|
780c69d804 | ||
|
|
22c948166a | ||
|
|
64436bc9ab | ||
|
|
6106e1878b | ||
|
|
c788c5a40e | ||
|
|
9f60ed534a | ||
|
|
03f193b34c | ||
|
|
db42f61cbb | ||
|
|
49591aedb4 | ||
|
|
21aa2b2a7f | ||
|
|
276ecef300 | ||
|
|
20b3563f21 | ||
|
|
15630356e1 | ||
|
|
f1fd528483 | ||
|
|
75d7270d5a | ||
|
|
3206639778 | ||
|
|
2e63c3b4f7 | ||
|
|
d63405d170 | ||
|
|
91e0db185c | ||
|
|
f97543eecd | ||
|
|
3606fb67bb | ||
|
|
426b59d13e | ||
|
|
d94ec8e144 | ||
|
|
4186349bba | ||
|
|
7816325e63 | ||
|
|
15da210de7 | ||
|
|
a4f7632981 | ||
|
|
a1b16a9118 | ||
|
|
c100b504dc | ||
|
|
161ec9f828 | ||
|
|
210466e7d9 | ||
|
|
0702159596 | ||
|
|
8d7e533196 | ||
|
|
47feda6ae4 | ||
|
|
44c945f45d | ||
|
|
35def4445d | ||
|
|
3e60303b90 | ||
|
|
b6e9dfa97d | ||
|
|
5771bb858f | ||
|
|
dcaf1cc189 | ||
|
|
5e1fc79c33 | ||
|
|
8997d7f91f | ||
|
|
54a08f560e | ||
|
|
ccb37c00f6 | ||
|
|
6281cbfd5f | ||
|
|
6502f3f487 | ||
|
|
00535c9a42 | ||
|
|
e6cf11cb3d | ||
|
|
c5eb0fd351 | ||
|
|
a780be70dd | ||
|
|
1d98e5307a | ||
|
|
36abb8ae8f | ||
|
|
0c4642aa20 | ||
|
|
1b029b765f | ||
|
|
9563496efb | ||
|
|
c628e27d2e | ||
|
|
1ad0e94b64 | ||
|
|
43face8ead | ||
|
|
2e4d346bc8 | ||
|
|
bf76c04664 | ||
|
|
ae678871ec | ||
|
|
9620eb06ac | ||
|
|
9096229637 | ||
|
|
eec3d782d3 | ||
|
|
43a7478791 | ||
|
|
175057e781 | ||
|
|
de2bfc7f79 | ||
|
|
5ed9db4f08 | ||
|
|
fea19c9e20 | ||
|
|
207764e0be | ||
|
|
49aaff2bbe | ||
|
|
25e84f2f5d | ||
|
|
e63f2fafb9 | ||
|
|
0b5a063b62 | ||
|
|
e0c2f58e8d | ||
|
|
0084a2e722 | ||
|
|
7ff1500122 | ||
|
|
7805622f07 | ||
|
|
a8e68dce3a | ||
|
|
b9eee539bd | ||
|
|
e450f36e81 | ||
|
|
ae221e0447 | ||
|
|
2a1be0bd85 | ||
|
|
af324eeca5 | ||
|
|
eb71fd1a5a | ||
|
|
e4a4788d5e | ||
|
|
47b6fe7dbe | ||
|
|
9ffacfe90e | ||
|
|
3f7d8c60b9 | ||
|
|
2e5d8fe561 | ||
|
|
7188c75351 | ||
|
|
316c35b258 | ||
|
|
9da42e27f1 | ||
|
|
0aee7ff552 | ||
|
|
228713ebb5 | ||
|
|
266129c61b | ||
|
|
3522e43617 | ||
|
|
45a5795c9c | ||
|
|
94d79692df | ||
|
|
58bb4b5358 | ||
|
|
51fef48016 | ||
|
|
7ab013cee9 | ||
|
|
f2b334b57a | ||
|
|
7eb7ee44f2 | ||
|
|
34cc64f8ce | ||
|
|
ca5951861a | ||
|
|
605f31d1ad | ||
|
|
30167d81e6 | ||
|
|
a247b444e5 | ||
|
|
1424a2980f | ||
|
|
01e1115806 | ||
|
|
c9c8af42c2 | ||
|
|
489fb2ac22 | ||
|
|
a708025a16 | ||
|
|
31429b7faf | ||
|
|
9c5235c273 | ||
|
|
8e717e00b1 | ||
|
|
9a4693136d | ||
|
|
cf0110ab95 | ||
|
|
abc5d5e863 | ||
|
|
0c74338c9c | ||
|
|
1dd22132ff | ||
|
|
76c400d2c3 | ||
|
|
d9472ec19c | ||
|
|
9d821fb892 | ||
|
|
8c6553ce73 | ||
|
|
1d4ed23394 | ||
|
|
c1fb44a145 | ||
|
|
333aacf4ab | ||
|
|
5b5827f885 | ||
|
|
6fbbf38a84 | ||
|
|
c1004fb4f8 | ||
|
|
de8ddb2a2b | ||
|
|
6feff1e42b | ||
|
|
ed3992d993 | ||
|
|
60ed2c292f | ||
|
|
1d77153a2b | ||
|
|
2e8e81a926 | ||
|
|
c7aa9834a9 | ||
|
|
ac8925b2bd | ||
|
|
25fb1b08bc | ||
|
|
adcc88823f | ||
|
|
280d8d7f10 | ||
|
|
04fa046815 | ||
|
|
11a06d6b33 | ||
|
|
38c9fe9cb5 | ||
|
|
2c586266ff | ||
|
|
4120630309 | ||
|
|
1ea4309a2a | ||
|
|
08dc65350f | ||
|
|
0c4a037dde | ||
|
|
dc8b83a110 | ||
|
|
484daa4c69 | ||
|
|
65c9a2e185 | ||
|
|
46adc1af98 | ||
|
|
7da2e1b262 | ||
|
|
9a698929f4 | ||
|
|
862c2fec87 | ||
|
|
9d534dc7bb | ||
|
|
a25043e5d4 | ||
|
|
cd77d3d410 | ||
|
|
0d72c03fa5 | ||
|
|
173a2416fa | ||
|
|
71fff4b14f | ||
|
|
007acf8c6d | ||
|
|
6843643aad | ||
|
|
64f6a1f072 | ||
|
|
b09811c1d4 | ||
|
|
a593051512 | ||
|
|
81e36d4f9b | ||
|
|
597ac9b504 | ||
|
|
525f04d446 | ||
|
|
d8a5244a88 | ||
|
|
d69b9ea394 | ||
|
|
7a42737287 | ||
|
|
1cc21834e2 | ||
|
|
956cb97331 | ||
|
|
72293d8d87 | ||
|
|
de583475f9 | ||
|
|
ed7d023581 | ||
|
|
457b093dce | ||
|
|
dcde9fbe8e | ||
|
|
f4346e3f0a | ||
|
|
9da2a00403 | ||
|
|
1c7d1861d6 | ||
|
|
9f7979314f | ||
|
|
dca1d479e8 | ||
|
|
c586f58286 | ||
|
|
9553b1ef00 | ||
|
|
a4db5d616a | ||
|
|
c1dc44d4fd | ||
|
|
6bbbccb9ac | ||
|
|
280bdbefdc | ||
|
|
abebffb2cd | ||
|
|
adce64bc21 | ||
|
|
4ea3d94d07 | ||
|
|
aaa6412469 | ||
|
|
c487929bcd | ||
|
|
0b63e78d2b | ||
|
|
e9e66e1005 | ||
|
|
7bb690e58e | ||
|
|
26620f3137 | ||
|
|
c8cd36bde8 | ||
|
|
7bf06aef5e | ||
|
|
0e65e67077 | ||
|
|
936a68433d | ||
|
|
8236696492 | ||
|
|
1757e939e1 | ||
|
|
5afe9c5337 | ||
|
|
5b5a1718e9 | ||
|
|
51c2352d67 | ||
|
|
3ad87e1362 | ||
|
|
cb5e3c6bf7 | ||
|
|
63e94a9fb4 | ||
|
|
badbb55ef2 | ||
|
|
27dbc671e0 | ||
|
|
fd92a96e1a | ||
|
|
8828b60288 | ||
|
|
e03c48e0ae | ||
|
|
425e451237 | ||
|
|
d8d859ab02 | ||
|
|
b178c7c67a | ||
|
|
0f701df91f | ||
|
|
b292de8ae6 | ||
|
|
87016f6ecf | ||
|
|
145962597c | ||
|
|
9ad24614cb | ||
|
|
ad65eb7ea2 | ||
|
|
ce7aeb02bc | ||
|
|
5b1c6c0d64 | ||
|
|
69e952738b | ||
|
|
621d822a6c | ||
|
|
3abb641c7c | ||
|
|
995eaa6e7c | ||
|
|
cf07512d24 | ||
|
|
5a63b5419f | ||
|
|
34c0968f5e | ||
|
|
bf75d9b4e0 | ||
|
|
3666531f8b | ||
|
|
7587a60387 | ||
|
|
b18991b9fb | ||
|
|
2ecddba375 | ||
|
|
5f941004f5 | ||
|
|
496cd5e621 | ||
|
|
470aeadbd9 | ||
|
|
06e2811012 | ||
|
|
be28d13d0d | ||
|
|
cf1626ea31 | ||
|
|
b1e56faab2 | ||
|
|
06a9884e99 | ||
|
|
7ac6c9a170 | ||
|
|
53f47d42fc | ||
|
|
2d60f98e93 | ||
|
|
bb9d44811c | ||
|
|
376fcba9ec | ||
|
|
e844abcad1 | ||
|
|
c3425979dd | ||
|
|
68eb6b6bb4 | ||
|
|
f0fe1fac66 | ||
|
|
477e6516ed | ||
|
|
22add1cbee | ||
|
|
55dde93811 | ||
|
|
656282459c | ||
|
|
35679216f7 | ||
|
|
a80e18169a | ||
|
|
5837a6982b | ||
|
|
275be59c25 | ||
|
|
a0c304d3ca | ||
|
|
f968d9bf3b | ||
|
|
0309c85c6a | ||
|
|
59b2d2f5a1 | ||
|
|
a48601b028 |
57
.github/workflows/build.yml
vendored
Normal file
57
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
||||
name: build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "**"
|
||||
pull_request:
|
||||
workflow_call:
|
||||
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
# java="25" is the LTS Java version used in reproducible builds script (default in Containerfile).
|
||||
# More Java versions can be added to test compatibility, eg. "26".
|
||||
java: ["25", "26"]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Build
|
||||
run: |
|
||||
if [ "${{ matrix.java }}" != "25" ]; then
|
||||
export OVERRIDE_JAVA_VERSION="${{ matrix.java }}"
|
||||
fi
|
||||
./reproducible-builds/build.sh
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: signal-cli-archive-${{ matrix.java }}
|
||||
path: dist/*
|
||||
|
||||
build-client:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- ubuntu
|
||||
- macos
|
||||
- windows
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./client
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Install rust
|
||||
run: rustup default stable
|
||||
- name: Build client
|
||||
run: cargo build --release --verbose
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: signal-cli-client-${{ matrix.os }}
|
||||
path: |
|
||||
client/target/release/signal-cli-client
|
||||
client/target/release/signal-cli-client.exe
|
||||
27
.github/workflows/ci.yml
vendored
27
.github/workflows/ci.yml
vendored
@ -1,27 +0,0 @@
|
||||
name: signal-cli CI
|
||||
|
||||
on: [ push, pull_request, workflow_call ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ '17' ]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- name: Build with Gradle
|
||||
run: ./gradlew build
|
||||
- name: Compress archive
|
||||
run: gzip -n -9 build/distributions/signal-cli-*.tar
|
||||
- name: Archive production artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: signal-cli-archive-${{ matrix.java }}
|
||||
path: build/distributions/signal-cli-*.tar.gz
|
||||
17
.github/workflows/codeql-analysis.yml
vendored
17
.github/workflows/codeql-analysis.yml
vendored
@ -9,6 +9,10 @@ on:
|
||||
schedule:
|
||||
- cron: '0 7 * * 4'
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
security-events: write
|
||||
|
||||
jobs:
|
||||
analyse:
|
||||
name: Analyse
|
||||
@ -17,12 +21,13 @@ jobs:
|
||||
steps:
|
||||
|
||||
- name: Setup Java JDK
|
||||
uses: actions/setup-java@v1
|
||||
uses: actions/setup-java@v5
|
||||
with:
|
||||
java-version: 17
|
||||
distribution: 'zulu'
|
||||
java-version: 25
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
@ -30,7 +35,7 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v1
|
||||
uses: github/codeql-action/init@v4
|
||||
# Override language selection by uncommenting this and choosing your languages
|
||||
# with:
|
||||
# languages: go, javascript, csharp, python, cpp, java
|
||||
@ -38,7 +43,7 @@ jobs:
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v1
|
||||
uses: github/codeql-action/autobuild@v4
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
@ -52,4 +57,4 @@ jobs:
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v1
|
||||
uses: github/codeql-action/analyze@v4
|
||||
|
||||
198
.github/workflows/release.yml
vendored
Normal file
198
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,198 @@
|
||||
name: release
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
permissions: {}
|
||||
|
||||
env:
|
||||
IMAGE_NAME: signal-cli
|
||||
IMAGE_REGISTRY: ghcr.io/asamk
|
||||
REGISTRY_USER: ${{ github.actor }}
|
||||
REGISTRY_PASSWORD: ${{ github.token }}
|
||||
ARCHIVE_JAVA_VERSION: 25
|
||||
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/build.yml
|
||||
|
||||
release:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
outputs:
|
||||
version: ${{ steps.version.outputs.version }}
|
||||
steps:
|
||||
- name: Download signal-cli build from CI workflow
|
||||
uses: actions/download-artifact@v8
|
||||
|
||||
- name: Get signal-cli version
|
||||
id: version
|
||||
run: |
|
||||
mv ./signal-cli-archive-${{ env.ARCHIVE_JAVA_VERSION }}/* .
|
||||
echo "version=$(cat VERSION)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: v${{ steps.version.outputs.version }} # note: added `v`
|
||||
release_name: v${{ steps.version.outputs.version }} # note: added `v`
|
||||
draft: true
|
||||
|
||||
- name: Upload archive
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: signal-cli-${{ steps.version.outputs.version }}.tar.gz
|
||||
asset_name: signal-cli-${{ steps.version.outputs.version }}.tar.gz
|
||||
asset_content_type: application/x-compressed-tar # .tar.gz
|
||||
|
||||
- name: Upload Linux native archive
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: signal-cli-${{ steps.version.outputs.version }}-Linux-native.tar.gz
|
||||
asset_name: signal-cli-${{ steps.version.outputs.version }}-Linux-native.tar.gz
|
||||
asset_content_type: application/x-compressed-tar # .tar.gz
|
||||
|
||||
- name: Upload Linux client archive
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: signal-cli-${{ steps.version.outputs.version }}-Linux-client.tar.gz
|
||||
asset_name: signal-cli-${{ steps.version.outputs.version }}-Linux-client.tar.gz
|
||||
asset_content_type: application/x-compressed-tar # .tar.gz
|
||||
|
||||
build-container:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Download signal-cli build from CI workflow
|
||||
uses: actions/download-artifact@v8
|
||||
|
||||
- name: Move archive file
|
||||
run: |
|
||||
tar xf signal-cli-archive-${{ env.ARCHIVE_JAVA_VERSION }}/signal-cli-${{ needs.release.outputs.version }}.tar.gz
|
||||
mkdir -p build/install/
|
||||
mv ./signal-cli-"${{ needs.release.outputs.version }}"/ build/install/signal-cli
|
||||
|
||||
- name: Build Image
|
||||
id: build_image
|
||||
uses: redhat-actions/buildah-build@v2
|
||||
with:
|
||||
image: ${{ env.IMAGE_NAME }}
|
||||
tags: latest ${{ github.sha }} ${{ needs.release.outputs.version }}
|
||||
containerfiles: ./Containerfile
|
||||
oci: true
|
||||
|
||||
- name: Push To GHCR
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
id: push
|
||||
with:
|
||||
image: ${{ steps.build_image.outputs.image }}
|
||||
tags: ${{ steps.build_image.outputs.tags }}
|
||||
registry: ${{ env.IMAGE_REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USER }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Echo outputs
|
||||
run: |
|
||||
echo "${{ toJSON(steps.push.outputs) }}"
|
||||
|
||||
build-container-native:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Download signal-cli build from CI workflow
|
||||
uses: actions/download-artifact@v8
|
||||
|
||||
- name: Move archive file
|
||||
run: |
|
||||
tar xf signal-cli-archive-${{ env.ARCHIVE_JAVA_VERSION }}/signal-cli-${{ needs.release.outputs.version }}-Linux-native.tar.gz
|
||||
mkdir -p build/native/nativeCompile/
|
||||
mv signal-cli build/native/nativeCompile/
|
||||
chmod +x build/native/nativeCompile/signal-cli
|
||||
|
||||
- name: Build Image
|
||||
id: build_image
|
||||
uses: redhat-actions/buildah-build@v2
|
||||
with:
|
||||
image: ${{ env.IMAGE_NAME }}
|
||||
tags: latest-native ${{ github.sha }}-native ${{ needs.release.outputs.version }}-native
|
||||
containerfiles: ./native.Containerfile
|
||||
oci: true
|
||||
|
||||
- name: Push To GHCR
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
id: push
|
||||
with:
|
||||
image: ${{ steps.build_image.outputs.image }}
|
||||
tags: ${{ steps.build_image.outputs.tags }}
|
||||
registry: ${{ env.IMAGE_REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USER }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Echo outputs
|
||||
run: |
|
||||
echo "${{ toJSON(steps.push.outputs) }}"
|
||||
|
||||
build-container-client:
|
||||
needs: release
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- name: Download signal-cli build from CI workflow
|
||||
uses: actions/download-artifact@v8
|
||||
|
||||
- name: Move archive file
|
||||
run: |
|
||||
tar xf signal-cli-archive-${{ env.ARCHIVE_JAVA_VERSION }}/signal-cli-${{ needs.release.outputs.version }}-Linux-client.tar.gz
|
||||
mkdir -p client/target/release/
|
||||
mv signal-cli-client client/target/release/
|
||||
chmod +x client/target/release/signal-cli-client
|
||||
|
||||
- name: Build Image
|
||||
id: build_image
|
||||
uses: redhat-actions/buildah-build@v2
|
||||
with:
|
||||
image: ${{ env.IMAGE_NAME }}
|
||||
tags: latest-client ${{ github.sha }}-client ${{ needs.release.outputs.version }}-client
|
||||
containerfiles: ./client.Containerfile
|
||||
oci: true
|
||||
|
||||
- name: Push To GHCR
|
||||
uses: redhat-actions/push-to-registry@v2
|
||||
id: push
|
||||
with:
|
||||
image: ${{ steps.build_image.outputs.image }}
|
||||
tags: ${{ steps.build_image.outputs.tags }}
|
||||
registry: ${{ env.IMAGE_REGISTRY }}
|
||||
username: ${{ env.REGISTRY_USER }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Echo outputs
|
||||
run: |
|
||||
echo "${{ toJSON(steps.push.outputs) }}"
|
||||
172
.github/workflows/repackage-native-libs.yml
vendored
172
.github/workflows/repackage-native-libs.yml
vendored
@ -1,172 +0,0 @@
|
||||
name: repackage-native-libs
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- v*
|
||||
|
||||
|
||||
jobs:
|
||||
|
||||
ci_wf:
|
||||
uses: AsamK/signal-cli/.github/workflows/ci.yml@master
|
||||
# ${{ github.repository }} not accpeted here
|
||||
|
||||
|
||||
lib_to_jar:
|
||||
needs: ci_wf
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
outputs:
|
||||
signal_cli_version: ${{ steps.cli_ver.outputs.signal_cli_version }}
|
||||
release_id: ${{ steps.create_release.outputs.id }}
|
||||
|
||||
steps:
|
||||
|
||||
- name: Download signal-cli build from CI workflow
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Get signal-cli version
|
||||
id: cli_ver
|
||||
run: |
|
||||
#echo ${GITHUB_REF#refs/tag/}
|
||||
tree .
|
||||
mv ./*/*.tar.gz .
|
||||
ver=$(ls ./*.tar.gz | xargs basename | sed -E 's/signal-cli-(.*).tar.gz/\1/')
|
||||
echo $ver
|
||||
echo "::set-output name=signal_cli_version::${ver}"
|
||||
tar -xzf ./*.tar.gz
|
||||
|
||||
- name: Get signal-client jar version
|
||||
id: lib_ver
|
||||
run: |
|
||||
JAR_PREFIX=signal-client-java-
|
||||
jar_file=$(find ./signal-cli-*/lib/ -name "$JAR_PREFIX*.jar")
|
||||
jar_version=$(echo "$jar_file" | xargs basename | sed "s/$JAR_PREFIX//; s/.jar//")
|
||||
echo "$jar_version"
|
||||
echo "::set-output name=signal_client_version::$jar_version"
|
||||
|
||||
- name: Download signal-client builds
|
||||
env:
|
||||
RELEASES_URL: https://github.com/signalapp/libsignal-client/releases/download/
|
||||
FILE_NAMES: signal_jni.dll libsignal_jni.dylib
|
||||
SIGNAL_CLIENT_VER: ${{ steps.lib_ver.outputs.signal_client_version }}
|
||||
run: |
|
||||
for file_name in $FILE_NAMES; do
|
||||
curl -sOL "${RELEASES_URL}/v${SIGNAL_CLIENT_VER}/${file_name}" # note: added v
|
||||
done
|
||||
tree .
|
||||
|
||||
- name: Replace Windows lib
|
||||
env:
|
||||
SIGNAL_CLI_VER: ${{ steps.cli_ver.outputs.signal_cli_version }}
|
||||
SIGNAL_CLIENT_VER: ${{ steps.lib_ver.outputs.signal_client_version }}
|
||||
run: |
|
||||
mv signal_jni.dll libsignal_jni.so
|
||||
zip -u ./signal-cli-${SIGNAL_CLI_VER}/lib/signal-client-java-${SIGNAL_CLIENT_VER}.jar ./libsignal_jni.so
|
||||
tar -czf signal-cli-${SIGNAL_CLI_VER}-Windows.tar.gz signal-cli-${SIGNAL_CLI_VER}/
|
||||
|
||||
- name: Replace macOS lib
|
||||
env:
|
||||
SIGNAL_CLI_VER: ${{ steps.cli_ver.outputs.signal_cli_version }}
|
||||
SIGNAL_CLIENT_VER: ${{ steps.lib_ver.outputs.signal_client_version }}
|
||||
run: |
|
||||
jar_file=./signal-cli-${SIGNAL_CLI_VER}/lib/signal-client-java-${SIGNAL_CLIENT_VER}.jar
|
||||
zip -d "$jar_file" libsignal_jni.so
|
||||
zip "$jar_file" libsignal_jni.dylib
|
||||
tar -czf signal-cli-${SIGNAL_CLI_VER}-macOS.tar.gz signal-cli-${SIGNAL_CLI_VER}/
|
||||
|
||||
- name: Create release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
tag_name: v${{ steps.cli_ver.outputs.signal_cli_version }} # note: added `v`
|
||||
release_name: v${{ steps.cli_ver.outputs.signal_cli_version }} # note: added `v`
|
||||
draft: true
|
||||
|
||||
- name: Upload Linux archive
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: signal-cli-${{ steps.cli_ver.outputs.signal_cli_version }}.tar.gz
|
||||
asset_name: signal-cli-${{ steps.cli_ver.outputs.signal_cli_version }}-Linux.tar.gz
|
||||
asset_content_type: application/x-compressed-tar # .tar.gz
|
||||
|
||||
- name: Upload windows archive
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: signal-cli-${{ steps.cli_ver.outputs.signal_cli_version }}-Windows.tar.gz
|
||||
asset_name: signal-cli-${{ steps.cli_ver.outputs.signal_cli_version }}-Windows.tar.gz
|
||||
asset_content_type: application/x-compressed-tar # .tar.gz
|
||||
|
||||
- name: Upload macos archive
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: signal-cli-${{ steps.cli_ver.outputs.signal_cli_version }}-macOS.tar.gz
|
||||
asset_name: signal-cli-${{ steps.cli_ver.outputs.signal_cli_version }}-macOS.tar.gz
|
||||
asset_content_type: application/x-compressed-tar # .tar.gz
|
||||
|
||||
|
||||
run_repackaged:
|
||||
|
||||
needs:
|
||||
- lib_to_jar
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
runner:
|
||||
- windows-latest
|
||||
- macos-latest
|
||||
|
||||
runs-on: ${{ matrix.runner }}
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash # Explicit for windows
|
||||
|
||||
env:
|
||||
JAVA_VERSION: 17
|
||||
|
||||
steps:
|
||||
|
||||
- name: Download the release file
|
||||
env:
|
||||
SIGNAL_CLI_VER: ${{ needs.lib_to_jar.outputs.signal_cli_version }}
|
||||
RELEASE_ID: ${{ needs.lib_to_jar.outputs.release_id }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
file_name=signal-cli-${SIGNAL_CLI_VER}-${RUNNER_OS}.tar.gz
|
||||
echo "$file_name"
|
||||
assets_json=$(curl -s \
|
||||
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||
"${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}/assets")
|
||||
asset_dl_url=$(echo "$assets_json" | jq -r ".[] | select (.name == \"$file_name\") | .url")
|
||||
echo "$asset_dl_url"
|
||||
curl -sLOJ \
|
||||
-H 'Accept: application/octet-stream' \
|
||||
-H "Authorization: Bearer $GITHUB_TOKEN" \
|
||||
"$asset_dl_url"
|
||||
tar -xzf "$file_name"
|
||||
|
||||
- name: Set up JDK for running signal-cli executable
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ env.JAVA_VERSION }}
|
||||
|
||||
- name: Run signal-cli
|
||||
run: |
|
||||
cd signal-cli-*/bin
|
||||
if [[ "$RUNNER_OS" == 'Windows' ]]; then
|
||||
EXECUTABLE_SUFFIX=".bat"
|
||||
fi
|
||||
./signal-cli${EXECUTABLE_SUFFIX} listAccounts
|
||||
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
.gradle/
|
||||
.kotlin/
|
||||
.idea/*
|
||||
!.idea/codeStyles/
|
||||
build/
|
||||
@ -12,3 +13,10 @@ local.properties
|
||||
out/
|
||||
.DS_Store
|
||||
/bin/
|
||||
/test-config/
|
||||
/dist/
|
||||
/github/
|
||||
man/*.1
|
||||
man/*.5
|
||||
man/man1
|
||||
man/man5
|
||||
|
||||
8
.idea/codeStyles/Project.xml
generated
8
.idea/codeStyles/Project.xml
generated
@ -4,8 +4,9 @@
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="GENERATE_FINAL_LOCALS" value="true" />
|
||||
<option name="GENERATE_FINAL_PARAMETERS" value="true" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="50" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="50" />
|
||||
<option name="ALIGN_MULTILINE_TEXT_BLOCKS" value="true" />
|
||||
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
|
||||
<option name="IMPORT_LAYOUT_TABLE">
|
||||
<value>
|
||||
<package name="com" withSubpackages="true" static="false" />
|
||||
@ -53,6 +54,9 @@
|
||||
<option name="TERNARY_OPERATION_WRAP" value="5" />
|
||||
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
|
||||
<option name="KEEP_SIMPLE_CLASSES_IN_ONE_LINE" value="true" />
|
||||
<option name="ARRAY_INITIALIZER_WRAP" value="5" />
|
||||
<option name="ARRAY_INITIALIZER_LBRACE_ON_NEXT_LINE" value="true" />
|
||||
<option name="ARRAY_INITIALIZER_RBRACE_ON_NEXT_LINE" value="true" />
|
||||
<option name="ENUM_CONSTANTS_WRAP" value="2" />
|
||||
</codeStyleSettings>
|
||||
<codeStyleSettings language="XML">
|
||||
|
||||
953
CHANGELOG.md
953
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -1,13 +1,18 @@
|
||||
# Question
|
||||
|
||||
If you have a question you can ask it in the [GitHub discussions page](https://github.com/AsamK/signal-cli/discussions)
|
||||
|
||||
# Report a bug
|
||||
|
||||
- Search [existing issues](https://github.com/AsamK/signal-cli/issues?q=is%3Aissue) if it has been reported already
|
||||
- If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/AsamK/signal-cli/issues/new).
|
||||
- Be sure to include a **title and clear description**, as much relevant information as possible.
|
||||
- Specify the signal-cli, JDK and OS version you're using. (and libsignal-client version, if self-compiled)
|
||||
- Run the failing command with `--verbose` flag to get a more detailed log output and include that in the bug report
|
||||
- If you're unable to find an open issue addressing the
|
||||
problem, [open a new one](https://github.com/AsamK/signal-cli/issues/new).
|
||||
- Be sure to include a **title and clear description**, as much relevant information as possible.
|
||||
- Specify the versions of signal-cli, libsignal-client (if self-compiled), JDK and OS you're using
|
||||
- Specify if it's the normal java or the graalvm native version.
|
||||
- Run the failing command with `-vv --scrub-log` flags to get a more detailed log output and include that in the bug report
|
||||
|
||||
# Pull request
|
||||
|
||||
- Code style should match the existing code, IntelliJ users can use the auto formatter
|
||||
- Separate PRs should be opened for each implemented feature or bug fix
|
||||
|
||||
11
Containerfile
Normal file
11
Containerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM docker.io/azul/zulu-openjdk:25-jre-headless
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/AsamK/signal-cli
|
||||
LABEL org.opencontainers.image.description="signal-cli provides an unofficial commandline, dbus and JSON-RPC interface for the Signal messenger."
|
||||
LABEL org.opencontainers.image.licenses=GPL-3.0-only
|
||||
|
||||
RUN useradd signal-cli --system --create-home --home-dir /var/lib/signal-cli
|
||||
ADD build/install/signal-cli /opt/signal-cli
|
||||
|
||||
USER signal-cli
|
||||
ENTRYPOINT ["/opt/signal-cli/bin/signal-cli", "--config=/var/lib/signal-cli"]
|
||||
@ -1,3 +1,4 @@
|
||||
github: AsamK
|
||||
liberapay: asamk
|
||||
ko_fi: asamk
|
||||
#bitcoin: bc1qykae53fry8a8ycgdzgv0rlxfc959hmmllvz698
|
||||
|
||||
119
README.md
119
README.md
@ -1,49 +1,58 @@
|
||||
# signal-cli
|
||||
|
||||
signal-cli is a commandline interface
|
||||
for [libsignal-service-java](https://github.com/WhisperSystems/libsignal-service-java). It supports registering,
|
||||
verifying, sending and receiving messages. To be able to link to an existing Signal-Android/signal-cli instance,
|
||||
signal-cli uses a [patched libsignal-service-java](https://github.com/AsamK/libsignal-service-java), because
|
||||
libsignal-service-java does not yet
|
||||
support [provisioning as a linked device](https://github.com/WhisperSystems/libsignal-service-java/pull/21). For
|
||||
registering you need a phone number where you can receive SMS or incoming calls. signal-cli is primarily intended to be
|
||||
used on servers to notify admins of important events. For this use-case, it has a dbus
|
||||
interface ([man page](https://github.com/AsamK/signal-cli/blob/master/man/signal-cli-dbus.5.adoc)), that can be used to
|
||||
send messages from any programming language that has dbus bindings. It also has a JSON-RPC based interface, see
|
||||
the [documentation](https://github.com/AsamK/signal-cli/wiki/JSON-RPC-service) for more information.
|
||||
signal-cli is a commandline interface for the [Signal messenger](https://signal.org/).
|
||||
It supports registering, verifying, sending and receiving messages.
|
||||
signal-cli uses a [patched libsignal-service-java](https://github.com/Turasa/libsignal-service-java),
|
||||
extracted from the [Signal-Android source code](https://github.com/signalapp/Signal-Android/tree/main/libsignal-service).
|
||||
For registering you need a phone number where you can receive SMS or incoming calls.
|
||||
|
||||
signal-cli is primarily intended to be used on servers to notify admins of important events.
|
||||
For this use-case, it has a daemon mode with JSON-RPC interface ([man page](https://github.com/AsamK/signal-cli/blob/master/man/signal-cli-jsonrpc.5.adoc))
|
||||
and D-BUS interface ([man page](https://github.com/AsamK/signal-cli/blob/master/man/signal-cli-dbus.5.adoc)).
|
||||
For the JSON-RPC interface there's also a simple [example client](https://github.com/AsamK/signal-cli/tree/master/client), written in Rust.
|
||||
|
||||
signal-cli needs to be kept up-to-date to keep up with Signal-Server changes.
|
||||
The official Signal clients expire after three months and then the Signal-Server can make incompatible changes.
|
||||
So signal-cli releases older than three months may not work correctly.
|
||||
|
||||
## Installation
|
||||
|
||||
You can [build signal-cli](#building) yourself, or use
|
||||
You can [build signal-cli](#building) yourself or use
|
||||
the [provided binary files](https://github.com/AsamK/signal-cli/releases/latest), which should work on Linux, macOS and
|
||||
Windows. For Arch Linux there is also a [package in AUR](https://aur.archlinux.org/packages/signal-cli/), as well as
|
||||
a [FreeBSD port](https://www.freshports.org/net-im/signal-cli) and
|
||||
an [Alpine aport](https://pkgs.alpinelinux.org/packages?name=signal-cli).
|
||||
Windows. There's also a [docker image and some Linux packages](https://github.com/AsamK/signal-cli/wiki/Binary-distributions) provided by the community.
|
||||
|
||||
System requirements:
|
||||
|
||||
- at least Java Runtime Environment (JRE) 17
|
||||
- at least Java Runtime Environment (JRE) 25
|
||||
- native library: libsignal-client
|
||||
|
||||
The native libs are bundled for x86_64 Linux (with recent enough glibc, see #643), Windows and MacOS. For other
|
||||
The native libs are bundled for x86_64 Linux (with recent enough glibc), Windows and MacOS. For other
|
||||
systems/architectures
|
||||
see: [Provide native lib for libsignal](https://github.com/AsamK/signal-cli/wiki/Provide-native-lib-for-libsignal)
|
||||
|
||||
### Install system-wide on Linux
|
||||
### Install system-wide on Linux [ JVM build ]
|
||||
|
||||
See [latest version](https://github.com/AsamK/signal-cli/releases).
|
||||
|
||||
```sh
|
||||
export VERSION=<latest version, format "x.y.z">
|
||||
wget https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}"-Linux.tar.gz
|
||||
sudo tar xf signal-cli-"${VERSION}"-Linux.tar.gz -C /opt
|
||||
VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/AsamK/signal-cli/releases/latest | sed -e 's/^.*\/v//')
|
||||
curl -L -O https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}".tar.gz
|
||||
sudo tar xf signal-cli-"${VERSION}".tar.gz -C /opt
|
||||
sudo ln -sf /opt/signal-cli-"${VERSION}"/bin/signal-cli /usr/local/bin/
|
||||
```
|
||||
|
||||
### Install system-wide on Linux [ GraalVM native build ]
|
||||
|
||||
```sh
|
||||
VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/AsamK/signal-cli/releases/latest | sed -e 's/^.*\/v//')
|
||||
curl -L -O https://github.com/AsamK/signal-cli/releases/download/v"${VERSION}"/signal-cli-"${VERSION}"-Linux-native.tar.gz
|
||||
sudo tar xf signal-cli-"${VERSION}"-Linux-native.tar.gz -C /opt
|
||||
sudo ln -sf /opt/signal-cli /usr/local/bin/
|
||||
```
|
||||
|
||||
You can find further instructions on the Wiki:
|
||||
|
||||
- [Quickstart](https://github.com/AsamK/signal-cli/wiki/Quickstart)
|
||||
- [DBus Service](https://github.com/AsamK/signal-cli/wiki/DBus-service)
|
||||
|
||||
## Usage
|
||||
|
||||
@ -57,10 +66,17 @@ of all country codes.)
|
||||
|
||||
* Register a number (with SMS verification)
|
||||
|
||||
signal-cli -a ACCOUNT register
|
||||
signal-cli -a ACCOUNT register
|
||||
|
||||
You can register Signal using a land line number. In this case you can skip SMS verification process and jump directly
|
||||
to the voice call verification by adding the `--voice` switch at the end of above register command.
|
||||
You can register Signal using a landline number. In this case, you need to follow the procedure below:
|
||||
* Attempt a SMS verification process first (`signal-cli -a ACCOUNT register`)
|
||||
* You will get an error `400 (InvalidTransportModeException)`, this is normal
|
||||
* Wait 60 seconds
|
||||
* Attempt a voice call verification by adding the `--voice` switch and wait for the call:
|
||||
|
||||
```sh
|
||||
signal-cli -a ACCOUNT register --voice
|
||||
```
|
||||
|
||||
Registering may require solving a CAPTCHA
|
||||
challenge: [Registration with captcha](https://github.com/AsamK/signal-cli/wiki/Registration-with-captcha)
|
||||
@ -68,19 +84,27 @@ of all country codes.)
|
||||
* Verify the number using the code received via SMS or voice, optionally add `--pin PIN_CODE` if you've added a pin code
|
||||
to your account
|
||||
|
||||
signal-cli -a ACCOUNT verify CODE
|
||||
signal-cli -a ACCOUNT verify CODE
|
||||
|
||||
* Send a message
|
||||
|
||||
signal-cli -a ACCOUNT send -m "This is a message" RECIPIENT
|
||||
```sh
|
||||
signal-cli -a ACCOUNT send -m "This is a message" RECIPIENT
|
||||
```
|
||||
|
||||
* Send a message to a username, usernames need to be prefixed with `u:`
|
||||
|
||||
```sh
|
||||
signal-cli -a ACCOUNT send -m "This is a message" u:USERNAME.000
|
||||
```
|
||||
|
||||
* Pipe the message content from another process.
|
||||
|
||||
uname -a | signal-cli -a ACCOUNT send --message-from-stdin RECIPIENT
|
||||
uname -a | signal-cli -a ACCOUNT send --message-from-stdin RECIPIENT
|
||||
|
||||
* Receive messages
|
||||
|
||||
signal-cli -a ACCOUNT receive
|
||||
signal-cli -a ACCOUNT receive
|
||||
|
||||
**Hint**: The Signal protocol expects that incoming messages are regularly received (using `daemon` or `receive`
|
||||
command). This is required for the encryption to work efficiently and for getting updates to groups, expiration timer
|
||||
@ -90,8 +114,8 @@ and other features.
|
||||
|
||||
The password and cryptographic keys are created when registering and stored in the current users home directory:
|
||||
|
||||
$XDG_DATA_HOME/signal-cli/data/
|
||||
$HOME/.local/share/signal-cli/data/
|
||||
$XDG_DATA_HOME/signal-cli/data/
|
||||
$HOME/.local/share/signal-cli/data/
|
||||
|
||||
## Building
|
||||
|
||||
@ -100,44 +124,55 @@ version installed, you can replace `./gradlew` with `gradle` in the following st
|
||||
|
||||
1. Checkout the source somewhere on your filesystem with
|
||||
|
||||
git clone https://github.com/AsamK/signal-cli.git
|
||||
git clone https://github.com/AsamK/signal-cli.git
|
||||
|
||||
2. Execute Gradle:
|
||||
|
||||
./gradlew build
|
||||
./gradlew build
|
||||
|
||||
2a. Create shell wrapper in *build/install/signal-cli/bin*:
|
||||
|
||||
./gradlew installDist
|
||||
./gradlew installDist
|
||||
|
||||
2b. Create tar file in *build/distributions*:
|
||||
|
||||
./gradlew distTar
|
||||
./gradlew distTar
|
||||
|
||||
2c. Create a fat tar file in *build/libs/signal-cli-fat*:
|
||||
|
||||
./gradlew fatJar
|
||||
./gradlew fatJar
|
||||
|
||||
2d. Compile and run signal-cli:
|
||||
|
||||
./gradlew run --args="--help"
|
||||
```sh
|
||||
./gradlew run --args="--help"
|
||||
```
|
||||
|
||||
### JSON Schemas for the JSON-RPC mode
|
||||
|
||||
1. Generate [JSON Schema](https://json-schema.org/) files for all the JSON-RPC data classes (`src/main/java/org/asamk/signal/json`):
|
||||
|
||||
```sh
|
||||
./gradlew jsonSchemas
|
||||
```
|
||||
|
||||
2. The generated files can be found in the `build/generated/META-INF/schemas` folder.
|
||||
|
||||
### Building a native binary with GraalVM (EXPERIMENTAL)
|
||||
|
||||
It is possible to build a native binary with [GraalVM](https://www.graalvm.org). This is still experimental and will not
|
||||
work in all situations.
|
||||
|
||||
1. [Install GraalVM and setup the enviroment](https://www.graalvm.org/docs/getting-started/#install-graalvm)
|
||||
2. [Install prerequisites](https://www.graalvm.org/reference-manual/native-image/#prerequisites)
|
||||
3. Execute Gradle:
|
||||
1. [Install GraalVM and setup the environment](https://www.graalvm.org/docs/getting-started/#install-graalvm)
|
||||
2. Execute Gradle:
|
||||
|
||||
./gradlew nativeCompile
|
||||
./gradlew nativeCompile
|
||||
|
||||
The binary is available at *build/native/nativeCompile/signal-cli*
|
||||
|
||||
## FAQ and Troubleshooting
|
||||
|
||||
For frequently asked questions and issues have a look at the [wiki](https://github.com/AsamK/signal-cli/wiki/FAQ)
|
||||
For frequently asked questions and issues have a look at the [wiki](https://github.com/AsamK/signal-cli/wiki/FAQ).
|
||||
|
||||
## License
|
||||
|
||||
|
||||
168
build.gradle.kts
168
build.gradle.kts
@ -1,46 +1,117 @@
|
||||
import groovy.json.JsonOutput
|
||||
|
||||
plugins {
|
||||
java
|
||||
application
|
||||
eclipse
|
||||
`check-lib-versions`
|
||||
id("org.graalvm.buildtools.native") version "0.9.11"
|
||||
id("org.graalvm.buildtools.native") version "1.1.2"
|
||||
}
|
||||
|
||||
version = "0.10.5"
|
||||
allprojects {
|
||||
group = "org.asamk"
|
||||
version = "0.14.5"
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_25
|
||||
targetCompatibility = JavaVersion.VERSION_25
|
||||
|
||||
if (!JavaVersion.current().isCompatibleWith(targetCompatibility)) {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(targetCompatibility.majorVersion))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass.set("org.asamk.signal.Main")
|
||||
applicationDefaultJvmArgs = listOf("--enable-native-access=ALL-UNNAMED")
|
||||
}
|
||||
|
||||
graalvmNative {
|
||||
binaries {
|
||||
this["main"].run {
|
||||
configurationFileDirectories.from(file("graalvm-config-dir"))
|
||||
buildArgs.add("--allow-incomplete-classpath")
|
||||
buildArgs.add("--report-unsupported-elements-at-runtime")
|
||||
buildArgs.add("-Dfile.encoding=UTF-8")
|
||||
buildArgs.add("-J-Dfile.encoding=UTF-8")
|
||||
buildArgs.add("-march=compatibility")
|
||||
buildArgs.add("--enable-native-access=ALL-UNNAMED")
|
||||
resources.autodetect()
|
||||
if (System.getenv("GRAALVM_HOME") == null) {
|
||||
toolchainDetection.set(true)
|
||||
javaLauncher.set(javaToolchains.launcherFor {
|
||||
languageVersion.set(JavaLanguageVersion.of(25))
|
||||
})
|
||||
} else {
|
||||
toolchainDetection.set(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
val artifactType = Attribute.of("artifactType", String::class.java)
|
||||
val minified = Attribute.of("minified", Boolean::class.javaObjectType)
|
||||
dependencies {
|
||||
attributesSchema {
|
||||
attribute(minified)
|
||||
}
|
||||
artifactTypes.getByName("jar") {
|
||||
attributes.attribute(minified, false)
|
||||
}
|
||||
}
|
||||
|
||||
configurations.runtimeClasspath.configure {
|
||||
attributes {
|
||||
attribute(minified, true)
|
||||
}
|
||||
}
|
||||
val excludePatterns = mapOf(
|
||||
"libsignal-client" to setOf(
|
||||
"libsignal_jni_testing_amd64.so",
|
||||
"signal_jni_testing_amd64.dll",
|
||||
"libsignal_jni_testing_amd64.dylib",
|
||||
"libsignal_jni_testing_aarch64.dylib",
|
||||
)
|
||||
)
|
||||
|
||||
val schemaAnnotationProcessor by configurations.creating {
|
||||
isCanBeConsumed = false
|
||||
isCanBeResolved = true
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")
|
||||
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.2.2")
|
||||
implementation("net.sourceforge.argparse4j", "argparse4j", "0.9.0")
|
||||
implementation("com.github.hypfvieh", "dbus-java-transport-native-unixsocket", "4.0.0")
|
||||
implementation("org.slf4j", "slf4j-api", "1.7.36")
|
||||
implementation("ch.qos.logback", "logback-classic", "1.2.10")
|
||||
implementation("org.slf4j", "jul-to-slf4j", "1.7.36")
|
||||
implementation(project(":lib"))
|
||||
registerTransform(JarFileExcluder::class) {
|
||||
from.attribute(minified, false).attribute(artifactType, "jar")
|
||||
to.attribute(minified, true).attribute(artifactType, "jar")
|
||||
|
||||
parameters {
|
||||
excludeFilesByArtifact = excludePatterns
|
||||
}
|
||||
}
|
||||
|
||||
schemaAnnotationProcessor(libs.micronaut.json.schema.processor)
|
||||
schemaAnnotationProcessor(libs.micronaut.inject.java)
|
||||
implementation(libs.bouncycastle)
|
||||
implementation(libs.jackson.databind)
|
||||
implementation(libs.argparse4j)
|
||||
implementation(libs.dbusjava)
|
||||
implementation(libs.slf4j.api)
|
||||
implementation(libs.slf4j.jul)
|
||||
implementation(libs.logback)
|
||||
implementation(libs.zxing)
|
||||
implementation(libs.micronaut.json.schema.annotations)
|
||||
if (gradle.startParameter.taskNames.any { it.contains("jsonSchemas") }) {
|
||||
implementation(libs.micronaut.json.schema.generator)
|
||||
}
|
||||
implementation(project(":libsignal-cli"))
|
||||
|
||||
testImplementation(libs.junit.jupiter)
|
||||
testImplementation(platform(libs.junit.jupiter.bom))
|
||||
testRuntimeOnly(libs.junit.launcher)
|
||||
}
|
||||
|
||||
tasks.named<Test>("test") {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
configurations {
|
||||
@ -64,21 +135,68 @@ tasks.withType<Jar> {
|
||||
attributes(
|
||||
"Implementation-Title" to project.name,
|
||||
"Implementation-Version" to project.version,
|
||||
"Main-Class" to application.mainClass.get()
|
||||
"Main-Class" to application.mainClass.get(),
|
||||
"Enable-Native-Access" to "ALL-UNNAMED",
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
task("fatJar", type = Jar::class) {
|
||||
tasks.register("fatJar", type = Jar::class) {
|
||||
archiveBaseName.set("${project.name}-fat")
|
||||
exclude(
|
||||
"META-INF/*.SF",
|
||||
"META-INF/**/*.MF",
|
||||
"META-INF/*.DSA",
|
||||
"META-INF/*.RSA",
|
||||
"META-INF/NOTICE",
|
||||
"META-INF/LICENSE",
|
||||
"**/module-info.class"
|
||||
"META-INF/NOTICE*",
|
||||
"META-INF/LICENSE*",
|
||||
"META-INF/INDEX.LIST",
|
||||
"**/module-info.class",
|
||||
)
|
||||
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
||||
with(tasks.jar.get() as CopySpec)
|
||||
duplicatesStrategy = DuplicatesStrategy.WARN
|
||||
doFirst {
|
||||
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })
|
||||
}
|
||||
with(tasks.jar.get())
|
||||
}
|
||||
|
||||
tasks.register("writeLibsignalVersion") {
|
||||
doLast {
|
||||
val resolutionResult = configurations.runtimeClasspath.get().incoming.resolutionResult
|
||||
val libsignalDep =
|
||||
resolutionResult.allDependencies.find { dep -> dep.requested is ModuleComponentSelector && (dep.requested as ModuleComponentSelector).group == "org.signal" && (dep.requested as ModuleComponentSelector).moduleIdentifier.name == "libsignal-client" }
|
||||
if (libsignalDep != null) {
|
||||
val version = (libsignalDep.requested as ModuleComponentSelector).version
|
||||
file("libsignal-version").writeText(version + "\n")
|
||||
} else {
|
||||
throw GradleException("Could not find libsignal-client dependency")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<JavaCompile>("jsonSchemas") {
|
||||
dependsOn(tasks.compileJava)
|
||||
val schemaBaseUri = "http://localhost:8080/schemas/"
|
||||
source = sourceSets.main.get().java
|
||||
include("org/asamk/signal/json/**/*.java")
|
||||
classpath = sourceSets.main.get().compileClasspath + files(sourceSets.main.get().java.destinationDirectory)
|
||||
destinationDirectory.set(layout.buildDirectory.dir("generated"))
|
||||
options.annotationProcessorPath = schemaAnnotationProcessor
|
||||
options.compilerArgs.addAll(
|
||||
listOf(
|
||||
"-Amicronaut.processing.group=org.asamk",
|
||||
"-Amicronaut.processing.module=signal-cli",
|
||||
"-Amicronaut.processing.annotations=org.asamk.signal.json.*",
|
||||
"-Amicronaut.jsonschema.baseUri=$schemaBaseUri",
|
||||
)
|
||||
)
|
||||
doLast {
|
||||
fileTree(destinationDirectory.get().dir("META-INF/schemas").asFile) {
|
||||
include("*.schema.json")
|
||||
}.forEach { schemaFile ->
|
||||
val normalized = schemaFile.readText().replace("\"$schemaBaseUri/", "\"")
|
||||
val prettyJson = JsonOutput.prettyPrint(normalized)
|
||||
schemaFile.writeText("$prettyJson\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,19 @@
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmCompilerOptions
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
|
||||
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
}
|
||||
|
||||
tasks.named<KotlinCompilationTask<KotlinJvmCompilerOptions>>("compileKotlin").configure {
|
||||
compilerOptions.jvmTarget.set(JvmTarget.JVM_25)
|
||||
}
|
||||
|
||||
java {
|
||||
targetCompatibility = JavaVersion.VERSION_25
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
import groovy.util.XmlSlurper
|
||||
import groovy.util.slurpersupport.GPathResult
|
||||
import org.codehaus.groovy.runtime.ResourceGroovyMethods
|
||||
import org.gradle.api.Plugin
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.Task
|
||||
import org.gradle.api.artifacts.Dependency
|
||||
import javax.xml.parsers.DocumentBuilderFactory
|
||||
|
||||
class CheckLibVersionsPlugin : Plugin<Project> {
|
||||
override fun apply(project: Project) {
|
||||
project.task("checkLibVersions") {
|
||||
project.tasks.register("checkLibVersions") {
|
||||
description =
|
||||
"Find any 3rd party libraries which have released new versions to the central Maven repo since we last upgraded."
|
||||
doLast {
|
||||
@ -26,15 +24,15 @@ class CheckLibVersionsPlugin : Plugin<Project> {
|
||||
val name = dependency.name
|
||||
val metaDataUrl = "https://repo1.maven.org/maven2/$path/$name/maven-metadata.xml"
|
||||
try {
|
||||
val url = ResourceGroovyMethods.toURL(metaDataUrl)
|
||||
val metaDataText = ResourceGroovyMethods.getText(url)
|
||||
val metadata = XmlSlurper().parseText(metaDataText)
|
||||
val newest = (metadata.getProperty("versioning") as GPathResult).getProperty("latest")
|
||||
val dbf = DocumentBuilderFactory.newInstance()
|
||||
val db = dbf.newDocumentBuilder()
|
||||
val doc = db.parse(metaDataUrl)
|
||||
val newest = doc.getElementsByTagName("latest").item(0).textContent
|
||||
if (version != newest.toString()) {
|
||||
println("UPGRADE {\"group\": \"$group\", \"name\": \"$name\", \"current\": \"$version\", \"latest\": \"$newest\"}")
|
||||
}
|
||||
} catch (e: Throwable) {
|
||||
logger.debug("Unable to download or parse $metaDataUrl: $e.message")
|
||||
logger.debug("Unable to download or parse {}: {}", metaDataUrl, e.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
53
buildSrc/src/main/kotlin/ExcludeFileFromJar.kt
Normal file
53
buildSrc/src/main/kotlin/ExcludeFileFromJar.kt
Normal file
@ -0,0 +1,53 @@
|
||||
import org.gradle.api.artifacts.transform.*
|
||||
import org.gradle.api.file.FileSystemLocation
|
||||
import org.gradle.api.provider.Provider
|
||||
import org.gradle.api.tasks.Input
|
||||
import org.gradle.api.tasks.PathSensitive
|
||||
import org.gradle.api.tasks.PathSensitivity
|
||||
import java.io.File
|
||||
import java.io.FileInputStream
|
||||
import java.io.FileOutputStream
|
||||
import java.util.zip.ZipInputStream
|
||||
import java.util.zip.ZipOutputStream
|
||||
|
||||
@CacheableTransform
|
||||
abstract class JarFileExcluder : TransformAction<JarFileExcluder.Parameters> {
|
||||
interface Parameters : TransformParameters {
|
||||
@get:Input
|
||||
var excludeFilesByArtifact: Map<String, Set<String>>
|
||||
}
|
||||
|
||||
@get:PathSensitive(PathSensitivity.NAME_ONLY)
|
||||
@get:InputArtifact
|
||||
abstract val inputArtifact: Provider<FileSystemLocation>
|
||||
|
||||
override
|
||||
fun transform(outputs: TransformOutputs) {
|
||||
val fileName = inputArtifact.get().asFile.name
|
||||
for (entry in parameters.excludeFilesByArtifact) {
|
||||
if (fileName.startsWith(entry.key)) {
|
||||
val nameWithoutExtension = fileName.substring(0, fileName.lastIndexOf("."))
|
||||
excludeFiles(inputArtifact.get().asFile, entry.value, outputs.file("${nameWithoutExtension}.jar"))
|
||||
return
|
||||
}
|
||||
}
|
||||
outputs.file(inputArtifact)
|
||||
}
|
||||
|
||||
private fun excludeFiles(artifact: File, excludeFiles: Set<String>, jarFile: File) {
|
||||
ZipInputStream(FileInputStream(artifact)).use { input ->
|
||||
ZipOutputStream(FileOutputStream(jarFile)).use { output ->
|
||||
var entry = input.nextEntry
|
||||
while (entry != null) {
|
||||
if (!excludeFiles.contains(entry.name)) {
|
||||
output.putNextEntry(entry)
|
||||
input.copyTo(output)
|
||||
output.closeEntry()
|
||||
}
|
||||
|
||||
entry = input.nextEntry
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
client.Containerfile
Normal file
11
client.Containerfile
Normal file
@ -0,0 +1,11 @@
|
||||
FROM docker.io/debian:testing-slim
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/AsamK/signal-cli
|
||||
LABEL org.opencontainers.image.description="signal-cli provides an unofficial commandline, dbus and JSON-RPC interface for the Signal messenger."
|
||||
LABEL org.opencontainers.image.licenses=GPL-3.0-only
|
||||
|
||||
RUN useradd signal-cli --system
|
||||
ADD client/target/release/signal-cli-client /usr/bin/signal-cli-client
|
||||
|
||||
USER signal-cli
|
||||
ENTRYPOINT ["/usr/bin/signal-cli-client"]
|
||||
1766
client/Cargo.lock
generated
1766
client/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -1,25 +1,22 @@
|
||||
[package]
|
||||
name = "signal-cli-client"
|
||||
version = "0.0.1"
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
anyhow = "1"
|
||||
clap = { version = "3", features = ["cargo", "derive"] }
|
||||
jsonrpc-core = "18"
|
||||
jsonrpc-core-client = "18"
|
||||
jsonrpc-client-transports = { version = "18", default-features = false, features = [
|
||||
"ipc",
|
||||
] }
|
||||
jsonrpc-derive = "18"
|
||||
jsonrpc-server-utils = "18"
|
||||
log = "0.4"
|
||||
clap = { version = "4", features = ["cargo", "derive", "wrap_help"] }
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
tokio = { version = "1", features = ["rt", "macros", "net"] }
|
||||
|
||||
[patch.crates-io]
|
||||
jsonrpc-client-transports = { git = "https://github.com/AsamK/jsonrpc", branch = "client_subscribe_named_params" }
|
||||
jsonrpc-derive = { git = "https://github.com/AsamK/jsonrpc", branch = "client_subscribe_named_params" }
|
||||
tokio = { version = "1", features = ["rt", "macros", "net", "rt-multi-thread"] }
|
||||
jsonrpsee = { version = "0.26", features = [
|
||||
"macros",
|
||||
"async-client",
|
||||
"http-client",
|
||||
] }
|
||||
bytes = "1"
|
||||
tokio-util = "0.7"
|
||||
futures-util = "0.3"
|
||||
thiserror = "2"
|
||||
|
||||
@ -1,198 +1,473 @@
|
||||
use clap::{crate_version, ArgEnum, Parser, Subcommand};
|
||||
use std::{ffi::OsString, net::SocketAddr};
|
||||
|
||||
use clap::{crate_version, Parser, Subcommand, ValueEnum};
|
||||
|
||||
/// JSON-RPC client for signal-cli
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(rename_all = "kebab-case", version=crate_version!())]
|
||||
#[command(rename_all = "kebab-case", version = crate_version!())]
|
||||
pub struct Cli {
|
||||
/// Account to use (for daemon in multi-account mode)
|
||||
#[clap(short = 'a', long)]
|
||||
#[arg(short = 'a', long)]
|
||||
pub account: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
pub output: Option<String>,
|
||||
|
||||
/// TCP host and port of signal-cli daemon
|
||||
#[clap(long)]
|
||||
#[arg(long, conflicts_with = "json_rpc_http")]
|
||||
pub json_rpc_tcp: Option<Option<SocketAddr>>,
|
||||
|
||||
/// UNIX socket address and port of signal-cli daemon
|
||||
#[clap(long)]
|
||||
#[cfg(unix)]
|
||||
#[arg(long, conflicts_with = "json_rpc_tcp")]
|
||||
pub json_rpc_socket: Option<Option<OsString>>,
|
||||
|
||||
#[clap(arg_enum, long, default_value_t = OutputTypes::Json)]
|
||||
pub output: OutputTypes,
|
||||
/// HTTP URL of signal-cli daemon
|
||||
#[arg(long, conflicts_with = "json_rpc_socket")]
|
||||
pub json_rpc_http: Option<Option<String>>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
pub verbose: bool,
|
||||
|
||||
#[clap(subcommand)]
|
||||
#[command(subcommand)]
|
||||
pub command: CliCommands,
|
||||
}
|
||||
|
||||
#[derive(ArgEnum, Clone, Debug)]
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
pub enum OutputTypes {
|
||||
PlainText,
|
||||
Json,
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
#[derive(Subcommand, Debug)]
|
||||
#[clap(rename_all = "camelCase", version=crate_version!())]
|
||||
#[command(rename_all = "camelCase", version = crate_version!())]
|
||||
pub enum CliCommands {
|
||||
AddDevice {
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
uri: String,
|
||||
},
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
AddStickerPack {
|
||||
#[arg(long)]
|
||||
uri: String,
|
||||
},
|
||||
#[command(rename_all = "kebab-case")]
|
||||
Block {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[clap(short = 'g', long)]
|
||||
#[arg(short = 'g', long)]
|
||||
group_id: Vec<String>,
|
||||
},
|
||||
DeleteLocalAccountData {
|
||||
#[arg(long = "ignore-registered")]
|
||||
ignore_registered: Option<bool>,
|
||||
},
|
||||
FinishChangeNumber {
|
||||
number: String,
|
||||
#[arg(short = 'v', long = "verification-code")]
|
||||
verification_code: String,
|
||||
|
||||
#[arg(short = 'p', long)]
|
||||
pin: Option<String>,
|
||||
},
|
||||
GetAttachment {
|
||||
#[arg(long)]
|
||||
id: String,
|
||||
#[arg(long)]
|
||||
recipient: Option<String>,
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Option<String>,
|
||||
},
|
||||
GetAvatar {
|
||||
#[arg(long)]
|
||||
contact: Option<String>,
|
||||
#[arg(long)]
|
||||
profile: Option<String>,
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Option<String>,
|
||||
},
|
||||
GetSticker {
|
||||
#[arg(long = "pack-id")]
|
||||
pack_id: String,
|
||||
#[arg(long = "sticker-id")]
|
||||
sticker_id: u32,
|
||||
},
|
||||
GetUserStatus {
|
||||
recipient: Vec<String>,
|
||||
#[arg(long)]
|
||||
username: Vec<String>,
|
||||
},
|
||||
JoinGroup {
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
uri: String,
|
||||
},
|
||||
Link {
|
||||
#[clap(short = 'n', long)]
|
||||
name: String,
|
||||
#[arg(short = 'n', long)]
|
||||
name: Option<String>,
|
||||
},
|
||||
ListAccounts,
|
||||
ListContacts,
|
||||
ListContacts {
|
||||
recipient: Vec<String>,
|
||||
#[arg(short = 'a', long = "all-recipients")]
|
||||
all_recipients: bool,
|
||||
#[arg(long)]
|
||||
blocked: Option<bool>,
|
||||
#[arg(long)]
|
||||
name: Option<String>,
|
||||
#[arg(long)]
|
||||
detailed: bool,
|
||||
#[arg(long)]
|
||||
internal: bool,
|
||||
},
|
||||
ListDevices,
|
||||
ListGroups {
|
||||
#[clap(short = 'd', long)]
|
||||
#[arg(short = 'd', long)]
|
||||
detailed: bool,
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
},
|
||||
ListIdentities {
|
||||
#[clap(short = 'n', long)]
|
||||
#[arg(short = 'n', long)]
|
||||
number: Option<String>,
|
||||
},
|
||||
ListStickerPacks,
|
||||
QuitGroup {
|
||||
#[clap(short = 'g', long = "group-id")]
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: String,
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
delete: bool,
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
admin: Vec<String>,
|
||||
},
|
||||
Receive {
|
||||
#[clap(short = 't', long, default_value_t = 3.0)]
|
||||
#[arg(short = 't', long, default_value_t = 3.0)]
|
||||
timeout: f64,
|
||||
},
|
||||
Register {
|
||||
#[clap(short = 'v', long)]
|
||||
#[arg(short = 'v', long)]
|
||||
voice: bool,
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
captcha: Option<String>,
|
||||
#[arg(long)]
|
||||
reregister: bool,
|
||||
},
|
||||
RemoveContact {
|
||||
recipient: String,
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
forget: bool,
|
||||
#[arg(long)]
|
||||
hide: bool,
|
||||
},
|
||||
RemoveDevice {
|
||||
#[clap(short = 'd', long = "device-id")]
|
||||
#[arg(short = 'd', long = "device-id")]
|
||||
device_id: u32,
|
||||
},
|
||||
RemovePin,
|
||||
RemoteDelete {
|
||||
#[clap(short = 't', long = "target-timestamp")]
|
||||
#[arg(short = 't', long = "target-timestamp")]
|
||||
target_timestamp: u64,
|
||||
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[clap(short = 'g', long = "group-id")]
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[clap(long = "note-to-self")]
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
},
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
Send {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[clap(short = 'g', long)]
|
||||
#[arg(short = 'g', long)]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
note_to_self: bool,
|
||||
|
||||
#[clap(short = 'e', long)]
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
|
||||
#[arg(short = 'e', long)]
|
||||
end_session: bool,
|
||||
|
||||
#[clap(short = 'm', long)]
|
||||
#[arg(short = 'm', long)]
|
||||
message: Option<String>,
|
||||
|
||||
#[clap(short = 'a', long)]
|
||||
#[arg(long)]
|
||||
message_from_stdin: bool,
|
||||
|
||||
#[arg(short = 'a', long)]
|
||||
attachment: Vec<String>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
view_once: bool,
|
||||
|
||||
#[arg(long)]
|
||||
mention: Vec<String>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
text_style: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
quote_timestamp: Option<u64>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
quote_author: Option<String>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
quote_message: Option<String>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
quote_mention: Vec<String>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
quote_text_style: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
quote_attachment: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
preview_url: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
preview_title: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
preview_description: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
preview_image: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
sticker: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
story_timestamp: Option<u64>,
|
||||
|
||||
#[arg(long)]
|
||||
story_author: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
edit_timestamp: Option<u64>,
|
||||
|
||||
#[arg(long = "no-urgent")]
|
||||
no_urgent: bool,
|
||||
},
|
||||
SendAdminDelete {
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'a', long = "target-author")]
|
||||
target_author: String,
|
||||
|
||||
#[arg(short = 't', long = "target-timestamp")]
|
||||
target_timestamp: u64,
|
||||
|
||||
#[arg(long)]
|
||||
story: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
},
|
||||
SendContacts,
|
||||
SendPaymentNotification {
|
||||
recipient: String,
|
||||
|
||||
#[arg(long)]
|
||||
receipt: String,
|
||||
|
||||
#[arg(long)]
|
||||
note: String,
|
||||
},
|
||||
SendPinMessage {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(short = 'a', long = "target-author")]
|
||||
target_author: String,
|
||||
|
||||
#[arg(short = 't', long = "target-timestamp")]
|
||||
target_timestamp: u64,
|
||||
|
||||
#[arg(short = 'd', long = "pin-duration")]
|
||||
pin_duration: Option<i32>,
|
||||
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
story: bool,
|
||||
},
|
||||
SendPollCreate {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(short = 'q', long = "question")]
|
||||
question: String,
|
||||
|
||||
#[arg(short = 'o', long = "option")]
|
||||
option: Vec<String>,
|
||||
|
||||
#[arg(long = "no-multi")]
|
||||
no_multi: bool,
|
||||
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
},
|
||||
SendPollTerminate {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(long = "poll-timestamp")]
|
||||
poll_timestamp: u64,
|
||||
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
},
|
||||
SendPollVote {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(long = "poll-author")]
|
||||
poll_author: Option<String>,
|
||||
|
||||
#[arg(long = "poll-timestamp")]
|
||||
poll_timestamp: u64,
|
||||
|
||||
#[arg(short = 'o', long = "option")]
|
||||
option: Vec<i32>,
|
||||
|
||||
#[arg(long = "vote-count")]
|
||||
vote_count: i32,
|
||||
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
},
|
||||
SendReaction {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[clap(short = 'g', long = "group-id")]
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[clap(long = "note-to-self")]
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
|
||||
#[clap(short = 'e', long)]
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
|
||||
#[arg(short = 'e', long)]
|
||||
emoji: String,
|
||||
|
||||
#[clap(short = 'a', long = "target-author")]
|
||||
#[arg(short = 'a', long = "target-author")]
|
||||
target_author: String,
|
||||
|
||||
#[clap(short = 't', long = "target-timestamp")]
|
||||
#[arg(short = 't', long = "target-timestamp")]
|
||||
target_timestamp: u64,
|
||||
|
||||
#[clap(short = 'r', long)]
|
||||
#[arg(short = 'r', long)]
|
||||
remove: bool,
|
||||
|
||||
#[arg(long)]
|
||||
story: bool,
|
||||
},
|
||||
SendReceipt {
|
||||
recipient: String,
|
||||
|
||||
#[clap(short = 't', long = "target-timestamp")]
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(short = 't', long = "target-timestamp")]
|
||||
target_timestamp: Vec<u64>,
|
||||
|
||||
#[clap(arg_enum, long)]
|
||||
#[arg(value_enum, long)]
|
||||
r#type: ReceiptType,
|
||||
},
|
||||
SendSyncRequest,
|
||||
SendTyping {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[clap(short = 'g', long = "group-id")]
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[clap(short = 's', long)]
|
||||
#[arg(short = 's', long)]
|
||||
stop: bool,
|
||||
},
|
||||
SendUnpinMessage {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Vec<String>,
|
||||
|
||||
#[arg(short = 'a', long = "target-author")]
|
||||
target_author: String,
|
||||
|
||||
#[arg(short = 't', long = "target-timestamp")]
|
||||
target_timestamp: u64,
|
||||
|
||||
#[arg(long = "note-to-self")]
|
||||
note_to_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
notify_self: bool,
|
||||
|
||||
#[arg(long)]
|
||||
story: bool,
|
||||
},
|
||||
SendMessageRequestResponse {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
r#type: MessageRequestResponseType,
|
||||
},
|
||||
SetPin {
|
||||
pin: String,
|
||||
},
|
||||
StartChangeNumber {
|
||||
number: String,
|
||||
#[arg(short = 'v', long)]
|
||||
voice: bool,
|
||||
#[arg(long)]
|
||||
captcha: Option<String>,
|
||||
},
|
||||
SubmitRateLimitChallenge {
|
||||
challenge: String,
|
||||
captcha: String,
|
||||
@ -200,115 +475,156 @@ pub enum CliCommands {
|
||||
Trust {
|
||||
recipient: String,
|
||||
|
||||
#[clap(short = 'a', long = "trust-all-known-keys")]
|
||||
#[arg(short = 'a', long = "trust-all-known-keys")]
|
||||
trust_all_known_keys: bool,
|
||||
|
||||
#[clap(short = 'v', long = "verified-safety-number")]
|
||||
#[arg(short = 'v', long = "verified-safety-number")]
|
||||
verified_safety_number: Option<String>,
|
||||
},
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
#[command(rename_all = "kebab-case")]
|
||||
Unblock {
|
||||
recipient: Vec<String>,
|
||||
|
||||
#[clap(short = 'g', long)]
|
||||
#[arg(short = 'g', long)]
|
||||
group_id: Vec<String>,
|
||||
},
|
||||
Unregister {
|
||||
#[clap(long = "delete-account")]
|
||||
#[arg(long = "delete-account")]
|
||||
delete_account: bool,
|
||||
},
|
||||
UpdateAccount {
|
||||
#[clap(short = 'n', long = "device-name")]
|
||||
#[arg(short = 'n', long = "device-name")]
|
||||
device_name: Option<String>,
|
||||
#[arg(long = "unrestricted-unidentified-sender")]
|
||||
unrestricted_unidentified_sender: Option<bool>,
|
||||
#[arg(long = "discoverable-by-number")]
|
||||
discoverable_by_number: Option<bool>,
|
||||
#[arg(long = "number-sharing")]
|
||||
number_sharing: Option<bool>,
|
||||
#[arg(short = 'u', long = "username")]
|
||||
username: Option<String>,
|
||||
#[arg(long = "delete-username")]
|
||||
delete_username: bool,
|
||||
},
|
||||
UpdateConfiguration {
|
||||
#[clap(long = "read-receipts", parse(try_from_str))]
|
||||
#[arg(long = "read-receipts")]
|
||||
read_receipts: Option<bool>,
|
||||
|
||||
#[clap(long = "unidentified-delivery-indicators")]
|
||||
#[arg(long = "unidentified-delivery-indicators")]
|
||||
unidentified_delivery_indicators: Option<bool>,
|
||||
|
||||
#[clap(long = "typing-indicators")]
|
||||
#[arg(long = "typing-indicators")]
|
||||
typing_indicators: Option<bool>,
|
||||
|
||||
#[clap(long = "link-previews")]
|
||||
#[arg(long = "link-previews")]
|
||||
link_previews: Option<bool>,
|
||||
},
|
||||
UpdateContact {
|
||||
recipient: String,
|
||||
|
||||
#[clap(short = 'e', long)]
|
||||
#[arg(short = 'e', long)]
|
||||
expiration: Option<u32>,
|
||||
|
||||
#[clap(short = 'n', long)]
|
||||
name: Option<String>,
|
||||
},
|
||||
UpdateGroup {
|
||||
#[clap(short = 'g', long = "group-id")]
|
||||
group_id: Option<String>,
|
||||
|
||||
#[clap(short = 'n', long)]
|
||||
#[arg(short = 'n', long)]
|
||||
name: Option<String>,
|
||||
|
||||
#[clap(short = 'd', long)]
|
||||
description: Option<String>,
|
||||
|
||||
#[clap(short = 'a', long)]
|
||||
avatar: Option<String>,
|
||||
|
||||
#[clap(short = 'm', long)]
|
||||
member: Vec<String>,
|
||||
|
||||
#[clap(short = 'r', long = "remove-member")]
|
||||
remove_member: Vec<String>,
|
||||
|
||||
#[clap(long)]
|
||||
admin: Vec<String>,
|
||||
|
||||
#[clap(long = "remove-admin")]
|
||||
remove_admin: Vec<String>,
|
||||
|
||||
#[clap(long)]
|
||||
ban: Vec<String>,
|
||||
|
||||
#[clap(long)]
|
||||
unban: Vec<String>,
|
||||
|
||||
#[clap(long = "reset-link")]
|
||||
reset_link: bool,
|
||||
|
||||
#[clap(arg_enum, long)]
|
||||
link: Option<LinkState>,
|
||||
|
||||
#[clap(arg_enum, long = "set-permission-add-member")]
|
||||
set_permission_add_member: Option<GroupPermission>,
|
||||
|
||||
#[clap(arg_enum, long = "set-permission-edit-details")]
|
||||
set_permission_edit_details: Option<GroupPermission>,
|
||||
|
||||
#[clap(arg_enum, long = "set-permission-send-messages")]
|
||||
set_permission_send_messages: Option<GroupPermission>,
|
||||
|
||||
#[clap(short = 'e', long)]
|
||||
expiration: Option<u32>,
|
||||
},
|
||||
UpdateProfile {
|
||||
#[clap(long = "given-name")]
|
||||
#[arg(long = "given-name")]
|
||||
given_name: Option<String>,
|
||||
|
||||
#[clap(long = "family-name")]
|
||||
#[arg(long = "family-name")]
|
||||
family_name: Option<String>,
|
||||
|
||||
#[clap(long)]
|
||||
about: Option<String>,
|
||||
#[arg(long = "nick-given-name")]
|
||||
nick_given_name: Option<String>,
|
||||
|
||||
#[clap(long = "about-emoji")]
|
||||
about_emoji: Option<String>,
|
||||
#[arg(long = "nick-family-name")]
|
||||
nick_family_name: Option<String>,
|
||||
|
||||
#[clap(long)]
|
||||
#[arg(long)]
|
||||
note: Option<String>,
|
||||
},
|
||||
UpdateDevice {
|
||||
#[arg(short = 'd', long = "device-id")]
|
||||
device_id: u32,
|
||||
|
||||
#[arg(short = 'n', long = "device-name")]
|
||||
device_name: String,
|
||||
},
|
||||
UpdateGroup {
|
||||
#[arg(short = 'g', long = "group-id")]
|
||||
group_id: Option<String>,
|
||||
|
||||
#[arg(short = 'n', long)]
|
||||
name: Option<String>,
|
||||
|
||||
#[arg(short = 'd', long)]
|
||||
description: Option<String>,
|
||||
|
||||
#[arg(short = 'a', long)]
|
||||
avatar: Option<String>,
|
||||
|
||||
#[clap(long = "remove-avatar")]
|
||||
#[arg(short = 'm', long)]
|
||||
member: Vec<String>,
|
||||
|
||||
#[arg(short = 'r', long = "remove-member")]
|
||||
remove_member: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
admin: Vec<String>,
|
||||
|
||||
#[arg(long = "remove-admin")]
|
||||
remove_admin: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
ban: Vec<String>,
|
||||
|
||||
#[arg(long)]
|
||||
unban: Vec<String>,
|
||||
|
||||
#[arg(long = "reset-link")]
|
||||
reset_link: bool,
|
||||
|
||||
#[arg(value_enum, long)]
|
||||
link: Option<LinkState>,
|
||||
|
||||
#[arg(value_enum, long = "set-permission-add-member")]
|
||||
set_permission_add_member: Option<GroupPermission>,
|
||||
|
||||
#[arg(value_enum, long = "set-permission-edit-details")]
|
||||
set_permission_edit_details: Option<GroupPermission>,
|
||||
|
||||
#[arg(value_enum, long = "set-permission-send-messages")]
|
||||
set_permission_send_messages: Option<GroupPermission>,
|
||||
|
||||
#[arg(short = 'e', long)]
|
||||
expiration: Option<u32>,
|
||||
|
||||
#[arg(long = "member-label-emoji")]
|
||||
member_label_emoji: Option<String>,
|
||||
|
||||
#[arg(long = "member-label")]
|
||||
member_label: Option<String>,
|
||||
},
|
||||
UpdateProfile {
|
||||
#[arg(long = "given-name")]
|
||||
given_name: Option<String>,
|
||||
|
||||
#[arg(long = "family-name")]
|
||||
family_name: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
about: Option<String>,
|
||||
|
||||
#[arg(long = "about-emoji")]
|
||||
about_emoji: Option<String>,
|
||||
|
||||
#[arg(long = "mobile-coin-address", visible_alias = "mobilecoin-address")]
|
||||
mobile_coin_address: Option<String>,
|
||||
|
||||
#[arg(long)]
|
||||
avatar: Option<String>,
|
||||
|
||||
#[arg(long = "remove-avatar")]
|
||||
remove_avatar: bool,
|
||||
},
|
||||
UploadStickerPack {
|
||||
@ -317,30 +633,37 @@ pub enum CliCommands {
|
||||
Verify {
|
||||
verification_code: String,
|
||||
|
||||
#[clap(short = 'p', long)]
|
||||
#[arg(short = 'p', long)]
|
||||
pin: Option<String>,
|
||||
},
|
||||
Version,
|
||||
}
|
||||
|
||||
#[derive(ArgEnum, Clone, Debug)]
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
#[value(rename_all = "kebab-case")]
|
||||
pub enum ReceiptType {
|
||||
Read,
|
||||
Viewed,
|
||||
}
|
||||
|
||||
#[derive(ArgEnum, Clone, Debug)]
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
#[value(rename_all = "kebab-case")]
|
||||
pub enum LinkState {
|
||||
Enabled,
|
||||
EnabledWithApproval,
|
||||
Disabled,
|
||||
}
|
||||
|
||||
#[derive(ArgEnum, Clone, Debug)]
|
||||
#[clap(rename_all = "kebab-case")]
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
#[value(rename_all = "kebab-case")]
|
||||
pub enum GroupPermission {
|
||||
EveryMember,
|
||||
OnlyAdmins,
|
||||
}
|
||||
|
||||
#[derive(ValueEnum, Clone, Debug)]
|
||||
#[value(rename_all = "kebab-case")]
|
||||
pub enum MessageRequestResponseType {
|
||||
Accept,
|
||||
Delete,
|
||||
}
|
||||
|
||||
@ -1,92 +1,171 @@
|
||||
use std::path::Path;
|
||||
|
||||
use jsonrpc_client_transports::{transports::ipc, RpcError};
|
||||
use jsonrpc_core::serde::Deserialize;
|
||||
use jsonrpc_derive::rpc;
|
||||
use jsonrpsee::async_client::ClientBuilder;
|
||||
use jsonrpsee::core::client::{Error, SubscriptionClientT};
|
||||
use jsonrpsee::http_client::HttpClientBuilder;
|
||||
use jsonrpsee::proc_macros::rpc;
|
||||
use serde::Deserialize;
|
||||
use serde_json::Value;
|
||||
use tokio::net::ToSocketAddrs;
|
||||
|
||||
pub type SignalCliClient = gen_client::Client;
|
||||
|
||||
#[rpc(client, params = "named")]
|
||||
#[rpc(client)]
|
||||
pub trait Rpc {
|
||||
#[rpc(name = "addDevice", params = "named")]
|
||||
fn add_device(&self, account: Option<String>, uri: String) -> Result<Value>;
|
||||
#[method(name = "addDevice", param_kind = map)]
|
||||
async fn add_device(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
uri: String,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "block", params = "named")]
|
||||
#[method(name = "addStickerPack", param_kind = map)]
|
||||
async fn add_sticker_pack(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
uri: String,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "block", param_kind = map)]
|
||||
fn block(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "getUserStatus", params = "named")]
|
||||
fn get_user_status(&self, account: Option<String>, recipients: Vec<String>) -> Result<Value>;
|
||||
#[method(name = "deleteLocalAccountData", param_kind = map)]
|
||||
fn delete_local_account_data(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] ignoreRegistered: Option<bool>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "joinGroup", params = "named")]
|
||||
fn join_group(&self, account: Option<String>, uri: String) -> Result<Value>;
|
||||
#[method(name = "getAttachment", param_kind = map)]
|
||||
fn get_attachment(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
id: String,
|
||||
recipient: Option<String>,
|
||||
#[allow(non_snake_case)] groupId: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "finishLink", params = "named")]
|
||||
#[method(name = "getAvatar", param_kind = map)]
|
||||
fn get_avatar(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
contact: Option<String>,
|
||||
profile: Option<String>,
|
||||
#[allow(non_snake_case)] groupId: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "getSticker", param_kind = map)]
|
||||
fn get_sticker(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] packId: String,
|
||||
#[allow(non_snake_case)] stickerId: u32,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "getUserStatus", param_kind = map)]
|
||||
fn get_user_status(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "joinGroup", param_kind = map)]
|
||||
fn join_group(&self, account: Option<String>, uri: String) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[allow(non_snake_case)]
|
||||
#[method(name = "finishChangeNumber", param_kind = map)]
|
||||
fn finish_change_number(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
number: String,
|
||||
verificationCode: String,
|
||||
pin: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "finishLink", param_kind = map)]
|
||||
fn finish_link(
|
||||
&self,
|
||||
#[allow(non_snake_case)] deviceLinkUri: String,
|
||||
#[allow(non_snake_case)] deviceName: String,
|
||||
) -> Result<Value>;
|
||||
#[allow(non_snake_case)] deviceName: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "listAccounts", params = "named")]
|
||||
fn list_accounts(&self) -> Result<Value>;
|
||||
#[method(name = "listAccounts", param_kind = map)]
|
||||
fn list_accounts(&self) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "listContacts", params = "named")]
|
||||
fn list_contacts(&self, account: Option<String>) -> Result<Value>;
|
||||
#[method(name = "listContacts", param_kind = map)]
|
||||
fn list_contacts(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] allRecipients: bool,
|
||||
blocked: Option<bool>,
|
||||
name: Option<String>,
|
||||
detailed: bool,
|
||||
internal: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "listDevices", params = "named")]
|
||||
fn list_devices(&self, account: Option<String>) -> Result<Value>;
|
||||
#[method(name = "listDevices", param_kind = map)]
|
||||
fn list_devices(&self, account: Option<String>) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "listGroups", params = "named")]
|
||||
fn list_groups(&self, account: Option<String>) -> Result<Value>;
|
||||
#[method(name = "listGroups", param_kind = map)]
|
||||
fn list_groups(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "listIdentities", params = "named")]
|
||||
fn list_identities(&self, account: Option<String>, number: Option<String>) -> Result<Value>;
|
||||
#[method(name = "listIdentities", param_kind = map)]
|
||||
fn list_identities(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
number: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "listStickerPacks", params = "named")]
|
||||
fn list_sticker_packs(&self, account: Option<String>) -> Result<Value>;
|
||||
#[method(name = "listStickerPacks", param_kind = map)]
|
||||
fn list_sticker_packs(&self, account: Option<String>) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "quitGroup", params = "named")]
|
||||
#[method(name = "quitGroup", param_kind = map)]
|
||||
fn quit_group(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] groupId: String,
|
||||
delete: bool,
|
||||
admins: Vec<String>,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "register", params = "named")]
|
||||
#[method(name = "register", param_kind = map)]
|
||||
fn register(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
voice: bool,
|
||||
captcha: Option<String>,
|
||||
) -> Result<Value>;
|
||||
reregister: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "removeContact", params = "named")]
|
||||
#[method(name = "removeContact", param_kind = map)]
|
||||
fn remove_contact(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipient: String,
|
||||
forget: bool,
|
||||
) -> Result<Value>;
|
||||
hide: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "removeDevice", params = "named")]
|
||||
#[method(name = "removeDevice", param_kind = map)]
|
||||
fn remove_device(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] deviceId: u32,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "removePin", params = "named")]
|
||||
fn remove_pin(&self, account: Option<String>) -> Result<Value>;
|
||||
#[method(name = "removePin", param_kind = map)]
|
||||
fn remove_pin(&self, account: Option<String>) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "remoteDelete", params = "named")]
|
||||
#[method(name = "remoteDelete", param_kind = map)]
|
||||
fn remote_delete(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
@ -94,128 +173,274 @@ pub trait Rpc {
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "send", params = "named")]
|
||||
#[allow(non_snake_case)]
|
||||
#[method(name = "send", param_kind = map)]
|
||||
fn send(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] endSession: bool,
|
||||
message: String,
|
||||
attachments: Vec<String>,
|
||||
#[allow(non_snake_case)] viewOnce: bool,
|
||||
mentions: Vec<String>,
|
||||
#[allow(non_snake_case)] textStyle: Vec<String>,
|
||||
#[allow(non_snake_case)] quoteTimestamp: Option<u64>,
|
||||
#[allow(non_snake_case)] quoteAuthor: Option<String>,
|
||||
#[allow(non_snake_case)] quoteMessage: Option<String>,
|
||||
#[allow(non_snake_case)] quoteMention: Vec<String>,
|
||||
#[allow(non_snake_case)] quoteTextStyle: Vec<String>,
|
||||
#[allow(non_snake_case)] quoteAttachment: Vec<String>,
|
||||
#[allow(non_snake_case)] previewUrl: Option<String>,
|
||||
#[allow(non_snake_case)] previewTitle: Option<String>,
|
||||
#[allow(non_snake_case)] previewDescription: Option<String>,
|
||||
#[allow(non_snake_case)] previewImage: Option<String>,
|
||||
sticker: Option<String>,
|
||||
) -> Result<Value>;
|
||||
#[allow(non_snake_case)] storyTimestamp: Option<u64>,
|
||||
#[allow(non_snake_case)] storyAuthor: Option<String>,
|
||||
#[allow(non_snake_case)] editTimestamp: Option<u64>,
|
||||
#[allow(non_snake_case)] noUrgent: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "sendContacts", params = "named")]
|
||||
fn send_contacts(&self, account: Option<String>) -> Result<Value>;
|
||||
#[method(name = "sendContacts", param_kind = map)]
|
||||
fn send_contacts(&self, account: Option<String>) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "sendReaction", params = "named")]
|
||||
#[method(name = "sendAdminDelete", param_kind = map)]
|
||||
fn send_admin_delete(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
#[allow(non_snake_case)] targetAuthor: String,
|
||||
#[allow(non_snake_case)] targetTimestamp: u64,
|
||||
story: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendPinMessage", param_kind = map)]
|
||||
fn send_pin_message(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] targetAuthor: String,
|
||||
#[allow(non_snake_case)] targetTimestamp: u64,
|
||||
#[allow(non_snake_case)] pinDuration: Option<i32>,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
story: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendPollCreate", param_kind = map)]
|
||||
fn send_poll_create(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
question: String,
|
||||
option: Vec<String>,
|
||||
#[allow(non_snake_case)] noMulti: bool,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendPollVote", param_kind = map)]
|
||||
fn send_poll_vote(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] pollAuthor: Option<String>,
|
||||
#[allow(non_snake_case)] pollTimestamp: u64,
|
||||
option: Vec<i32>,
|
||||
#[allow(non_snake_case)] voteCount: i32,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendPollTerminate", param_kind = map)]
|
||||
fn send_poll_terminate(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] pollTimestamp: u64,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendUnpinMessage", param_kind = map)]
|
||||
fn send_unpin_message(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] targetAuthor: String,
|
||||
#[allow(non_snake_case)] targetTimestamp: u64,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
story: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendPaymentNotification", param_kind = map)]
|
||||
fn send_payment_notification(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipient: String,
|
||||
receipt: String,
|
||||
note: String,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "sendReaction", param_kind = map)]
|
||||
fn send_reaction(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] noteToSelf: bool,
|
||||
#[allow(non_snake_case)] notifySelf: bool,
|
||||
emoji: String,
|
||||
#[allow(non_snake_case)] targetAuthor: String,
|
||||
#[allow(non_snake_case)] targetTimestamp: u64,
|
||||
remove: bool,
|
||||
) -> Result<Value>;
|
||||
story: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "sendReceipt", params = "named")]
|
||||
#[method(name = "sendReceipt", param_kind = map)]
|
||||
fn send_receipt(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipient: String,
|
||||
usernames: Vec<String>,
|
||||
#[allow(non_snake_case)] targetTimestamps: Vec<u64>,
|
||||
r#type: String,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "sendSyncRequest", params = "named")]
|
||||
fn send_sync_request(&self, account: Option<String>) -> Result<Value>;
|
||||
#[method(name = "sendSyncRequest", param_kind = map)]
|
||||
fn send_sync_request(&self, account: Option<String>) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "sendTyping", params = "named")]
|
||||
#[method(name = "sendTyping", param_kind = map)]
|
||||
fn send_typing(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
stop: bool,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "setPin", params = "named")]
|
||||
fn set_pin(&self, account: Option<String>, pin: String) -> Result<Value>;
|
||||
#[method(name = "sendMessageRequestResponse", param_kind = map)]
|
||||
fn send_message_request_response(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
r#type: String,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "submitRateLimitChallenge", params = "named")]
|
||||
#[method(name = "setPin", param_kind = map)]
|
||||
fn set_pin(&self, account: Option<String>, pin: String) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "submitRateLimitChallenge", param_kind = map)]
|
||||
fn submit_rate_limit_challenge(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
challenge: String,
|
||||
captcha: String,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "startLink", params = "named")]
|
||||
fn start_link(&self, account: Option<String>) -> Result<JsonLink>;
|
||||
#[method(name = "startChangeNumber", param_kind = map)]
|
||||
fn start_change_number(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
number: String,
|
||||
voice: bool,
|
||||
captcha: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "trust", params = "named")]
|
||||
#[method(name = "startLink", param_kind = map)]
|
||||
fn start_link(&self, account: Option<String>) -> Result<JsonLink, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "trust", param_kind = map)]
|
||||
fn trust(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipient: String,
|
||||
#[allow(non_snake_case)] trustAllKnownKeys: bool,
|
||||
#[allow(non_snake_case)] verifiedSafetyNumber: Option<String>,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "unblock", params = "named")]
|
||||
#[method(name = "unblock", param_kind = map)]
|
||||
fn unblock(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipients: Vec<String>,
|
||||
#[allow(non_snake_case)] groupIds: Vec<String>,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "unregister", params = "named")]
|
||||
#[method(name = "unregister", param_kind = map)]
|
||||
fn unregister(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] deleteAccount: bool,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "updateAccount", params = "named")]
|
||||
#[allow(non_snake_case)]
|
||||
#[method(name = "updateAccount", param_kind = map)]
|
||||
fn update_account(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] deviceName: Option<String>,
|
||||
) -> Result<Value>;
|
||||
deviceName: Option<String>,
|
||||
unrestrictedUnidentifiedSender: Option<bool>,
|
||||
discoverableByNumber: Option<bool>,
|
||||
numberSharing: Option<bool>,
|
||||
username: Option<String>,
|
||||
deleteUsername: bool,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "updateConfiguration", params = "named")]
|
||||
#[method(name = "updateConfiguration", param_kind = map)]
|
||||
fn update_configuration(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] readReceiptes: Option<bool>,
|
||||
#[allow(non_snake_case)] readReceipts: Option<bool>,
|
||||
#[allow(non_snake_case)] unidentifiedDeliveryIndicators: Option<bool>,
|
||||
#[allow(non_snake_case)] typingIndicators: Option<bool>,
|
||||
#[allow(non_snake_case)] linkPreviews: Option<bool>,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "updateContact", params = "named")]
|
||||
#[method(name = "updateContact", param_kind = map)]
|
||||
fn update_contact(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
recipient: String,
|
||||
name: Option<String>,
|
||||
expiration: Option<u32>,
|
||||
) -> Result<Value>;
|
||||
#[allow(non_snake_case)] givenName: Option<String>,
|
||||
#[allow(non_snake_case)] familyName: Option<String>,
|
||||
#[allow(non_snake_case)] nickGivenName: Option<String>,
|
||||
#[allow(non_snake_case)] nickFamilyName: Option<String>,
|
||||
note: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "updateGroup", params = "named")]
|
||||
#[method(name = "updateDevice", param_kind = map)]
|
||||
fn update_device(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] deviceId: u32,
|
||||
#[allow(non_snake_case)] deviceName: String,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[method(name = "updateGroup", param_kind = map)]
|
||||
fn update_group(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
@ -235,9 +460,11 @@ pub trait Rpc {
|
||||
#[allow(non_snake_case)] setPermissionEditDetails: Option<String>,
|
||||
#[allow(non_snake_case)] setPermissionSendMessages: Option<String>,
|
||||
expiration: Option<u32>,
|
||||
) -> Result<Value>;
|
||||
#[allow(non_snake_case)] memberLabelEmoji: Option<String>,
|
||||
#[allow(non_snake_case)] memberLabel: Option<String>,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "updateProfile", params = "named")]
|
||||
#[method(name = "updateProfile", param_kind = map)]
|
||||
fn update_profile(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
@ -245,34 +472,36 @@ pub trait Rpc {
|
||||
#[allow(non_snake_case)] familyName: Option<String>,
|
||||
about: Option<String>,
|
||||
#[allow(non_snake_case)] aboutEmoji: Option<String>,
|
||||
#[allow(non_snake_case)] mobileCoinAddress: Option<String>,
|
||||
avatar: Option<String>,
|
||||
#[allow(non_snake_case)] removeAvatar: bool,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "uploadStickerPack", params = "named")]
|
||||
fn upload_sticker_pack(&self, account: Option<String>, path: String) -> Result<Value>;
|
||||
#[method(name = "uploadStickerPack", param_kind = map)]
|
||||
fn upload_sticker_pack(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
path: String,
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[rpc(name = "verify", params = "named")]
|
||||
#[method(name = "verify", param_kind = map)]
|
||||
fn verify(
|
||||
&self,
|
||||
account: Option<String>,
|
||||
#[allow(non_snake_case)] verificationCode: String,
|
||||
pin: Option<String>,
|
||||
) -> Result<Value>;
|
||||
) -> Result<Value, ErrorObjectOwned>;
|
||||
|
||||
#[pubsub(
|
||||
subscription = "receive",
|
||||
subscribe,
|
||||
name = "subscribeReceive",
|
||||
params = "named"
|
||||
#[subscription(
|
||||
name = "subscribeReceive" => "receive",
|
||||
unsubscribe = "unsubscribeReceive",
|
||||
item = Value,
|
||||
param_kind = map
|
||||
)]
|
||||
fn subscribe_receive(&self, _: Self::Metadata, _: Subscriber<Value>, account: Option<String>);
|
||||
async fn subscribe_receive(&self, account: Option<String>) -> SubscriptionResult;
|
||||
|
||||
#[pubsub(subscription = "receive", unsubscribe, name = "unsubscribeReceive")]
|
||||
fn unsubscribe_receive(&self, _: Option<Self::Metadata>, _: SubscriptionId) -> Result<bool>;
|
||||
|
||||
#[rpc(name = "version")]
|
||||
fn version(&self) -> Result<Value>;
|
||||
#[method(name = "version")]
|
||||
fn version(&self) -> Result<Value, ErrorObjectOwned>;
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
@ -281,10 +510,23 @@ pub struct JsonLink {
|
||||
pub device_link_uri: String,
|
||||
}
|
||||
|
||||
pub async fn connect_tcp(tcp: impl ToSocketAddrs) -> Result<SignalCliClient, RpcError> {
|
||||
super::tcp::connect::<_, SignalCliClient>(tcp).await
|
||||
pub async fn connect_tcp(
|
||||
tcp: impl ToSocketAddrs,
|
||||
) -> Result<impl SubscriptionClientT, std::io::Error> {
|
||||
let (sender, receiver) = super::transports::tcp::connect(tcp).await?;
|
||||
|
||||
Ok(ClientBuilder::default().build_with_tokio(sender, receiver))
|
||||
}
|
||||
|
||||
pub async fn connect_unix(socket_path: impl AsRef<Path>) -> Result<SignalCliClient, RpcError> {
|
||||
ipc::connect::<_, SignalCliClient>(socket_path).await
|
||||
#[cfg(unix)]
|
||||
pub async fn connect_unix(
|
||||
socket_path: impl AsRef<Path>,
|
||||
) -> Result<impl SubscriptionClientT, std::io::Error> {
|
||||
let (sender, receiver) = super::transports::ipc::connect(socket_path).await?;
|
||||
|
||||
Ok(ClientBuilder::default().build_with_tokio(sender, receiver))
|
||||
}
|
||||
|
||||
pub async fn connect_http(uri: &str) -> Result<impl SubscriptionClientT + use<>, Error> {
|
||||
HttpClientBuilder::default().build(uri)
|
||||
}
|
||||
|
||||
@ -1,68 +1,112 @@
|
||||
use clap::StructOpt;
|
||||
use jsonrpc_client_transports::{RpcError, TypedSubscriptionStream};
|
||||
use jsonrpc_core::{futures_util::StreamExt, Value};
|
||||
use std::{path::PathBuf, time::Duration};
|
||||
|
||||
use clap::Parser;
|
||||
use jsonrpsee::core::client::{Error as RpcError, Subscription, SubscriptionClientT};
|
||||
use serde_json::{Error, Value};
|
||||
use tokio::{select, time::sleep};
|
||||
|
||||
use crate::cli::{GroupPermission, LinkState};
|
||||
use cli::Cli;
|
||||
|
||||
use crate::cli::{CliCommands, GroupPermission, LinkState};
|
||||
use crate::jsonrpc::RpcClient;
|
||||
|
||||
mod cli;
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
#[allow(non_snake_case, clippy::too_many_arguments)]
|
||||
mod jsonrpc;
|
||||
mod tcp;
|
||||
mod transports;
|
||||
|
||||
const DEFAULT_TCP: &str = "127.0.0.1:7583";
|
||||
const DEFAULT_SOCKET_SUFFIX: &str = "signal-cli/socket";
|
||||
const DEFAULT_HTTP: &str = "http://localhost:8080/api/v1/rpc";
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), anyhow::Error> {
|
||||
let cli = cli::Cli::parse();
|
||||
|
||||
let client = connect(&cli)
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("Failed to connect to socket: {e}"))?;
|
||||
let result = connect(cli).await;
|
||||
|
||||
let result = match cli.command {
|
||||
cli::CliCommands::Receive { timeout } => {
|
||||
let mut stream = client
|
||||
.subscribe_receive(cli.account)
|
||||
.map_err(|e| anyhow::anyhow!("JSON-RPC command failed: {:?}", e))?;
|
||||
match result {
|
||||
Ok(Value::Null) => {}
|
||||
Ok(v) => println!("{v}"),
|
||||
Err(e) => return Err(anyhow::anyhow!("JSON-RPC command failed: {e:?}")),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn handle_command(
|
||||
cli: Cli,
|
||||
client: impl SubscriptionClientT + Sync,
|
||||
) -> Result<Value, RpcError> {
|
||||
match cli.command {
|
||||
CliCommands::Receive { timeout } => {
|
||||
let mut stream = client.subscribe_receive(cli.account).await?;
|
||||
|
||||
{
|
||||
while let Some(v) = stream_next(timeout, &mut stream).await {
|
||||
let v = v.map_err(|e| anyhow::anyhow!("JSON-RPC command failed: {:?}", e))?;
|
||||
let v = v?;
|
||||
println!("{v}");
|
||||
}
|
||||
}
|
||||
return Ok(());
|
||||
stream.unsubscribe().await?;
|
||||
Ok(Value::Null)
|
||||
}
|
||||
cli::CliCommands::AddDevice { uri } => client.add_device(cli.account, uri).await,
|
||||
cli::CliCommands::Block {
|
||||
CliCommands::AddDevice { uri } => client.add_device(cli.account, uri).await,
|
||||
CliCommands::Block {
|
||||
recipient,
|
||||
group_id,
|
||||
} => client.block(cli.account, recipient, group_id).await,
|
||||
cli::CliCommands::GetUserStatus { recipient } => {
|
||||
client.get_user_status(cli.account, recipient).await
|
||||
CliCommands::DeleteLocalAccountData { ignore_registered } => {
|
||||
client
|
||||
.delete_local_account_data(cli.account, ignore_registered)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::JoinGroup { uri } => client.join_group(cli.account, uri).await,
|
||||
cli::CliCommands::Link { name } => {
|
||||
CliCommands::GetUserStatus {
|
||||
recipient,
|
||||
username,
|
||||
} => {
|
||||
client
|
||||
.get_user_status(cli.account, recipient, username)
|
||||
.await
|
||||
}
|
||||
CliCommands::JoinGroup { uri } => client.join_group(cli.account, uri).await,
|
||||
CliCommands::Link { name } => {
|
||||
let url = client
|
||||
.start_link(cli.account)
|
||||
.await
|
||||
.map_err(|e| anyhow::anyhow!("JSON-RPC command startLink failed: {e:?}",))?
|
||||
.map_err(|e| RpcError::Custom(format!("JSON-RPC command startLink failed: {e:?}")))?
|
||||
.device_link_uri;
|
||||
println!("{}", url);
|
||||
println!("{url}");
|
||||
client.finish_link(url, name).await
|
||||
}
|
||||
cli::CliCommands::ListAccounts => client.list_accounts().await,
|
||||
cli::CliCommands::ListContacts => client.list_contacts(cli.account).await,
|
||||
cli::CliCommands::ListDevices => client.list_devices(cli.account).await,
|
||||
cli::CliCommands::ListGroups { detailed: _ } => client.list_groups(cli.account).await,
|
||||
cli::CliCommands::ListIdentities { number } => {
|
||||
client.list_identities(cli.account, number).await
|
||||
CliCommands::ListAccounts => client.list_accounts().await,
|
||||
CliCommands::ListContacts {
|
||||
recipient,
|
||||
all_recipients,
|
||||
blocked,
|
||||
name,
|
||||
detailed,
|
||||
internal,
|
||||
} => {
|
||||
client
|
||||
.list_contacts(
|
||||
cli.account,
|
||||
recipient,
|
||||
all_recipients,
|
||||
blocked,
|
||||
name,
|
||||
detailed,
|
||||
internal,
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::ListStickerPacks => client.list_sticker_packs(cli.account).await,
|
||||
cli::CliCommands::QuitGroup {
|
||||
CliCommands::ListDevices => client.list_devices(cli.account).await,
|
||||
CliCommands::ListGroups {
|
||||
detailed: _,
|
||||
group_id,
|
||||
} => client.list_groups(cli.account, group_id).await,
|
||||
CliCommands::ListIdentities { number } => client.list_identities(cli.account, number).await,
|
||||
CliCommands::ListStickerPacks => client.list_sticker_packs(cli.account).await,
|
||||
CliCommands::QuitGroup {
|
||||
group_id,
|
||||
delete,
|
||||
admin,
|
||||
@ -71,17 +115,29 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
.quit_group(cli.account, group_id, delete, admin)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::Register { voice, captcha } => {
|
||||
client.register(cli.account, voice, captcha).await
|
||||
CliCommands::Register {
|
||||
voice,
|
||||
captcha,
|
||||
reregister,
|
||||
} => {
|
||||
client
|
||||
.register(cli.account, voice, captcha, reregister)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::RemoveContact { recipient, forget } => {
|
||||
client.remove_contact(cli.account, recipient, forget).await
|
||||
CliCommands::RemoveContact {
|
||||
recipient,
|
||||
forget,
|
||||
hide,
|
||||
} => {
|
||||
client
|
||||
.remove_contact(cli.account, recipient, forget, hide)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::RemoveDevice { device_id } => {
|
||||
CliCommands::RemoveDevice { device_id } => {
|
||||
client.remove_device(cli.account, device_id).await
|
||||
}
|
||||
cli::CliCommands::RemovePin => client.remove_pin(cli.account).await,
|
||||
cli::CliCommands::RemoteDelete {
|
||||
CliCommands::RemovePin => client.remove_pin(cli.account).await,
|
||||
CliCommands::RemoteDelete {
|
||||
target_timestamp,
|
||||
recipient,
|
||||
group_id,
|
||||
@ -97,63 +153,226 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::Send {
|
||||
CliCommands::Send {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
notify_self,
|
||||
note_to_self,
|
||||
end_session,
|
||||
message,
|
||||
message_from_stdin,
|
||||
attachment,
|
||||
view_once,
|
||||
mention,
|
||||
text_style,
|
||||
quote_timestamp,
|
||||
quote_author,
|
||||
quote_message,
|
||||
quote_mention,
|
||||
quote_text_style,
|
||||
quote_attachment,
|
||||
preview_url,
|
||||
preview_title,
|
||||
preview_description,
|
||||
preview_image,
|
||||
sticker,
|
||||
story_timestamp,
|
||||
story_author,
|
||||
edit_timestamp,
|
||||
no_urgent,
|
||||
} => {
|
||||
client
|
||||
.send(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
notify_self,
|
||||
note_to_self,
|
||||
end_session,
|
||||
message.unwrap_or_default(),
|
||||
if message_from_stdin {
|
||||
std::io::read_to_string(std::io::stdin()).unwrap()
|
||||
} else {
|
||||
message.unwrap_or_default()
|
||||
},
|
||||
attachment,
|
||||
view_once,
|
||||
mention,
|
||||
text_style,
|
||||
quote_timestamp,
|
||||
quote_author,
|
||||
quote_message,
|
||||
quote_mention,
|
||||
quote_text_style,
|
||||
quote_attachment,
|
||||
preview_url,
|
||||
preview_title,
|
||||
preview_description,
|
||||
preview_image,
|
||||
sticker,
|
||||
story_timestamp,
|
||||
story_author,
|
||||
edit_timestamp,
|
||||
no_urgent,
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::SendContacts => client.send_contacts(cli.account).await,
|
||||
cli::CliCommands::SendReaction {
|
||||
CliCommands::SendContacts => client.send_contacts(cli.account).await,
|
||||
CliCommands::SendAdminDelete {
|
||||
group_id,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
story,
|
||||
notify_self,
|
||||
} => {
|
||||
client
|
||||
.send_admin_delete(
|
||||
cli.account,
|
||||
group_id,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
story,
|
||||
notify_self,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::SendPaymentNotification {
|
||||
recipient,
|
||||
receipt,
|
||||
note,
|
||||
} => {
|
||||
client
|
||||
.send_payment_notification(cli.account, recipient, receipt, note)
|
||||
.await
|
||||
}
|
||||
CliCommands::SendPinMessage {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
pin_duration,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
story,
|
||||
} => {
|
||||
client
|
||||
.send_pin_message(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
pin_duration,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
story,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::SendPollCreate {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
question,
|
||||
option,
|
||||
no_multi,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
} => {
|
||||
client
|
||||
.send_poll_create(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
question,
|
||||
option,
|
||||
no_multi,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::SendPollTerminate {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
poll_timestamp,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
} => {
|
||||
client
|
||||
.send_poll_terminate(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
poll_timestamp,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::SendPollVote {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
poll_author,
|
||||
poll_timestamp,
|
||||
option,
|
||||
vote_count,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
} => {
|
||||
client
|
||||
.send_poll_vote(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
poll_author,
|
||||
poll_timestamp,
|
||||
option,
|
||||
vote_count,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::SendReaction {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
emoji,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
remove,
|
||||
story,
|
||||
} => {
|
||||
client
|
||||
.send_reaction(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
emoji,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
remove,
|
||||
story,
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::SendReceipt {
|
||||
CliCommands::SendReceipt {
|
||||
recipient,
|
||||
username,
|
||||
target_timestamp,
|
||||
r#type,
|
||||
} => {
|
||||
@ -161,6 +380,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
.send_receipt(
|
||||
cli.account,
|
||||
recipient,
|
||||
username,
|
||||
target_timestamp,
|
||||
match r#type {
|
||||
cli::ReceiptType::Read => "read".to_owned(),
|
||||
@ -169,8 +389,8 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::SendSyncRequest => client.send_sync_request(cli.account).await,
|
||||
cli::CliCommands::SendTyping {
|
||||
CliCommands::SendSyncRequest => client.send_sync_request(cli.account).await,
|
||||
CliCommands::SendTyping {
|
||||
recipient,
|
||||
group_id,
|
||||
stop,
|
||||
@ -179,13 +399,37 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
.send_typing(cli.account, recipient, group_id, stop)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::SetPin { pin } => client.set_pin(cli.account, pin).await,
|
||||
cli::CliCommands::SubmitRateLimitChallenge { challenge, captcha } => {
|
||||
CliCommands::SendUnpinMessage {
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
story,
|
||||
} => {
|
||||
client
|
||||
.send_unpin_message(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
username,
|
||||
target_author,
|
||||
target_timestamp,
|
||||
note_to_self,
|
||||
notify_self,
|
||||
story,
|
||||
)
|
||||
.await
|
||||
}
|
||||
CliCommands::SetPin { pin } => client.set_pin(cli.account, pin).await,
|
||||
CliCommands::SubmitRateLimitChallenge { challenge, captcha } => {
|
||||
client
|
||||
.submit_rate_limit_challenge(cli.account, challenge, captcha)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::Trust {
|
||||
CliCommands::Trust {
|
||||
recipient,
|
||||
trust_all_known_keys,
|
||||
verified_safety_number,
|
||||
@ -199,17 +443,34 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::Unblock {
|
||||
CliCommands::Unblock {
|
||||
recipient,
|
||||
group_id,
|
||||
} => client.unblock(cli.account, recipient, group_id).await,
|
||||
cli::CliCommands::Unregister { delete_account } => {
|
||||
CliCommands::Unregister { delete_account } => {
|
||||
client.unregister(cli.account, delete_account).await
|
||||
}
|
||||
cli::CliCommands::UpdateAccount { device_name } => {
|
||||
client.update_account(cli.account, device_name).await
|
||||
CliCommands::UpdateAccount {
|
||||
device_name,
|
||||
unrestricted_unidentified_sender,
|
||||
discoverable_by_number,
|
||||
number_sharing,
|
||||
username,
|
||||
delete_username,
|
||||
} => {
|
||||
client
|
||||
.update_account(
|
||||
cli.account,
|
||||
device_name,
|
||||
unrestricted_unidentified_sender,
|
||||
discoverable_by_number,
|
||||
number_sharing,
|
||||
username,
|
||||
delete_username,
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::UpdateConfiguration {
|
||||
CliCommands::UpdateConfiguration {
|
||||
read_receipts,
|
||||
unidentified_delivery_indicators,
|
||||
typing_indicators,
|
||||
@ -225,16 +486,39 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::UpdateContact {
|
||||
CliCommands::UpdateContact {
|
||||
recipient,
|
||||
expiration,
|
||||
name,
|
||||
given_name,
|
||||
family_name,
|
||||
nick_given_name,
|
||||
nick_family_name,
|
||||
note,
|
||||
} => {
|
||||
client
|
||||
.update_contact(cli.account, recipient, name, expiration)
|
||||
.update_contact(
|
||||
cli.account,
|
||||
recipient,
|
||||
name,
|
||||
expiration,
|
||||
given_name,
|
||||
family_name,
|
||||
nick_given_name,
|
||||
nick_family_name,
|
||||
note,
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::UpdateGroup {
|
||||
CliCommands::UpdateDevice {
|
||||
device_id,
|
||||
device_name,
|
||||
} => {
|
||||
client
|
||||
.update_device(cli.account, device_id, device_name)
|
||||
.await
|
||||
}
|
||||
CliCommands::UpdateGroup {
|
||||
group_id,
|
||||
name,
|
||||
description,
|
||||
@ -251,6 +535,8 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
set_permission_edit_details,
|
||||
set_permission_send_messages,
|
||||
expiration,
|
||||
member_label_emoji,
|
||||
member_label,
|
||||
} => {
|
||||
client
|
||||
.update_group(
|
||||
@ -284,14 +570,17 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
GroupPermission::OnlyAdmins => "onlyAdmins".to_owned(),
|
||||
}),
|
||||
expiration,
|
||||
member_label_emoji,
|
||||
member_label,
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::UpdateProfile {
|
||||
CliCommands::UpdateProfile {
|
||||
given_name,
|
||||
family_name,
|
||||
about,
|
||||
about_emoji,
|
||||
mobile_coin_address,
|
||||
avatar,
|
||||
remove_avatar,
|
||||
} => {
|
||||
@ -302,52 +591,132 @@ async fn main() -> Result<(), anyhow::Error> {
|
||||
family_name,
|
||||
about,
|
||||
about_emoji,
|
||||
mobile_coin_address,
|
||||
avatar,
|
||||
remove_avatar,
|
||||
)
|
||||
.await
|
||||
}
|
||||
cli::CliCommands::UploadStickerPack { path } => {
|
||||
CliCommands::UploadStickerPack { path } => {
|
||||
client.upload_sticker_pack(cli.account, path).await
|
||||
}
|
||||
cli::CliCommands::Verify {
|
||||
CliCommands::Verify {
|
||||
verification_code,
|
||||
pin,
|
||||
} => client.verify(cli.account, verification_code, pin).await,
|
||||
cli::CliCommands::Version => client.version().await,
|
||||
};
|
||||
|
||||
result
|
||||
.map(|v| println!("{v}"))
|
||||
.map_err(|e| anyhow::anyhow!("JSON-RPC command failed: {e:?}",))?;
|
||||
Ok(())
|
||||
CliCommands::Version => client.version().await,
|
||||
CliCommands::AddStickerPack { uri } => client.add_sticker_pack(cli.account, uri).await,
|
||||
CliCommands::FinishChangeNumber {
|
||||
number,
|
||||
verification_code,
|
||||
pin,
|
||||
} => {
|
||||
client
|
||||
.finish_change_number(cli.account, number, verification_code, pin)
|
||||
.await
|
||||
}
|
||||
CliCommands::GetAttachment {
|
||||
id,
|
||||
recipient,
|
||||
group_id,
|
||||
} => {
|
||||
client
|
||||
.get_attachment(cli.account, id, recipient, group_id)
|
||||
.await
|
||||
}
|
||||
CliCommands::GetAvatar {
|
||||
contact,
|
||||
profile,
|
||||
group_id,
|
||||
} => {
|
||||
client
|
||||
.get_avatar(cli.account, contact, profile, group_id)
|
||||
.await
|
||||
}
|
||||
CliCommands::GetSticker {
|
||||
pack_id,
|
||||
sticker_id,
|
||||
} => client.get_sticker(cli.account, pack_id, sticker_id).await,
|
||||
CliCommands::StartChangeNumber {
|
||||
number,
|
||||
voice,
|
||||
captcha,
|
||||
} => {
|
||||
client
|
||||
.start_change_number(cli.account, number, voice, captcha)
|
||||
.await
|
||||
}
|
||||
CliCommands::SendMessageRequestResponse {
|
||||
recipient,
|
||||
group_id,
|
||||
r#type,
|
||||
} => {
|
||||
client
|
||||
.send_message_request_response(
|
||||
cli.account,
|
||||
recipient,
|
||||
group_id,
|
||||
match r#type {
|
||||
cli::MessageRequestResponseType::Accept => "accept".to_owned(),
|
||||
cli::MessageRequestResponseType::Delete => "delete".to_owned(),
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn connect(cli: &cli::Cli) -> Result<jsonrpc::SignalCliClient, RpcError> {
|
||||
if let Some(tcp) = cli.json_rpc_tcp {
|
||||
async fn connect(cli: Cli) -> Result<Value, RpcError> {
|
||||
if let Some(http) = &cli.json_rpc_http {
|
||||
let uri = if let Some(uri) = http {
|
||||
uri
|
||||
} else {
|
||||
DEFAULT_HTTP
|
||||
};
|
||||
let client = jsonrpc::connect_http(uri)
|
||||
.await
|
||||
.map_err(|e| RpcError::Custom(format!("Failed to connect to socket: {e}")))?;
|
||||
|
||||
handle_command(cli, client).await
|
||||
} else if let Some(tcp) = cli.json_rpc_tcp {
|
||||
let socket_addr = tcp.unwrap_or_else(|| DEFAULT_TCP.parse().unwrap());
|
||||
jsonrpc::connect_tcp(socket_addr).await
|
||||
let client = jsonrpc::connect_tcp(socket_addr)
|
||||
.await
|
||||
.map_err(|e| RpcError::Custom(format!("Failed to connect to socket: {e}")))?;
|
||||
|
||||
handle_command(cli, client).await
|
||||
} else {
|
||||
let socket_path = cli
|
||||
.json_rpc_socket
|
||||
.clone()
|
||||
.unwrap_or(None)
|
||||
.or_else(|| {
|
||||
std::env::var_os("XDG_RUNTIME_DIR").map(|runtime_dir| {
|
||||
PathBuf::from(runtime_dir)
|
||||
.join(DEFAULT_SOCKET_SUFFIX)
|
||||
.into()
|
||||
#[cfg(windows)]
|
||||
{
|
||||
Err(RpcError::Custom("Invalid socket".into()))
|
||||
}
|
||||
#[cfg(unix)]
|
||||
{
|
||||
let socket_path = cli
|
||||
.json_rpc_socket
|
||||
.clone()
|
||||
.unwrap_or(None)
|
||||
.or_else(|| {
|
||||
std::env::var_os("XDG_RUNTIME_DIR").map(|runtime_dir| {
|
||||
PathBuf::from(runtime_dir)
|
||||
.join(DEFAULT_SOCKET_SUFFIX)
|
||||
.into()
|
||||
})
|
||||
})
|
||||
})
|
||||
.unwrap_or_else(|| ("/run".to_owned() + DEFAULT_SOCKET_SUFFIX).into());
|
||||
jsonrpc::connect_unix(socket_path).await
|
||||
.unwrap_or_else(|| ("/run".to_owned() + DEFAULT_SOCKET_SUFFIX).into());
|
||||
let client = jsonrpc::connect_unix(socket_path)
|
||||
.await
|
||||
.map_err(|e| RpcError::Custom(format!("Failed to connect to socket: {e}")))?;
|
||||
|
||||
handle_command(cli, client).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async fn stream_next(
|
||||
timeout: f64,
|
||||
stream: &mut TypedSubscriptionStream<Value>,
|
||||
) -> Option<Result<Value, RpcError>> {
|
||||
stream: &mut Subscription<Value>,
|
||||
) -> Option<Result<Value, Error>> {
|
||||
if timeout < 0.0 {
|
||||
stream.next().await
|
||||
} else {
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
use jsonrpc_client_transports::{transports::duplex, RpcChannel, RpcError};
|
||||
use jsonrpc_core::futures_util::{SinkExt, StreamExt, TryStreamExt};
|
||||
use jsonrpc_server_utils::{codecs::StreamCodec, tokio_util::codec::Decoder};
|
||||
use tokio::net::{TcpStream, ToSocketAddrs};
|
||||
|
||||
/// Connect to a JSON-RPC TCP server.
|
||||
pub async fn connect<S: ToSocketAddrs, Client: From<RpcChannel>>(
|
||||
socket: S,
|
||||
) -> Result<Client, RpcError> {
|
||||
let connection = TcpStream::connect(socket)
|
||||
.await
|
||||
.map_err(|e| RpcError::Other(Box::new(e)))?;
|
||||
let (sink, stream) = StreamCodec::stream_incoming().framed(connection).split();
|
||||
let sink = sink.sink_map_err(|e| RpcError::Other(Box::new(e)));
|
||||
let stream = stream.map_err(|e| log::error!("TCP stream error: {}", e));
|
||||
|
||||
let (client, sender) = duplex(
|
||||
Box::pin(sink),
|
||||
Box::pin(
|
||||
stream
|
||||
.take_while(|x| std::future::ready(x.is_ok()))
|
||||
.map(|x| x.expect("Stream is closed upon first error.")),
|
||||
),
|
||||
);
|
||||
|
||||
tokio::spawn(client);
|
||||
|
||||
Ok(sender.into())
|
||||
}
|
||||
23
client/src/transports/ipc.rs
Normal file
23
client/src/transports/ipc.rs
Normal file
@ -0,0 +1,23 @@
|
||||
use std::io::Error;
|
||||
use std::path::Path;
|
||||
|
||||
use futures_util::stream::StreamExt;
|
||||
use jsonrpsee::core::client::{TransportReceiverT, TransportSenderT};
|
||||
use tokio::net::UnixStream;
|
||||
use tokio_util::codec::Decoder;
|
||||
|
||||
use super::stream_codec::StreamCodec;
|
||||
use super::{Receiver, Sender};
|
||||
|
||||
/// Connect to a JSON-RPC Unix Socket server.
|
||||
pub async fn connect(
|
||||
socket: impl AsRef<Path>,
|
||||
) -> Result<(impl TransportSenderT + Send, impl TransportReceiverT + Send), Error> {
|
||||
let connection = UnixStream::connect(socket).await?;
|
||||
let (sink, stream) = StreamCodec::stream_incoming().framed(connection).split();
|
||||
|
||||
let sender = Sender { inner: sink };
|
||||
let receiver = Receiver { inner: stream };
|
||||
|
||||
Ok((sender, receiver))
|
||||
}
|
||||
60
client/src/transports/mod.rs
Normal file
60
client/src/transports/mod.rs
Normal file
@ -0,0 +1,60 @@
|
||||
use futures_util::{stream::StreamExt, Sink, SinkExt, Stream};
|
||||
use jsonrpsee::core::client::{ReceivedMessage, TransportReceiverT, TransportSenderT};
|
||||
use thiserror::Error;
|
||||
|
||||
#[cfg(unix)]
|
||||
pub mod ipc;
|
||||
mod stream_codec;
|
||||
pub mod tcp;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
enum Errors {
|
||||
#[error("Other: {0}")]
|
||||
Other(String),
|
||||
#[error("Closed")]
|
||||
Closed,
|
||||
}
|
||||
|
||||
struct Sender<T: Send + Sink<String>> {
|
||||
inner: T,
|
||||
}
|
||||
|
||||
impl<T: Send + Sink<String, Error = impl std::error::Error> + Unpin + 'static> TransportSenderT
|
||||
for Sender<T>
|
||||
{
|
||||
type Error = Errors;
|
||||
|
||||
async fn send(&mut self, body: String) -> Result<(), Self::Error> {
|
||||
self.inner
|
||||
.send(body)
|
||||
.await
|
||||
.map_err(|e| Errors::Other(format!("{e:?}")))?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn close(&mut self) -> Result<(), Self::Error> {
|
||||
self.inner
|
||||
.close()
|
||||
.await
|
||||
.map_err(|e| Errors::Other(format!("{e:?}")))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
struct Receiver<T: Send + Stream> {
|
||||
inner: T,
|
||||
}
|
||||
|
||||
impl<T: Send + Stream<Item = Result<String, std::io::Error>> + Unpin + 'static> TransportReceiverT
|
||||
for Receiver<T>
|
||||
{
|
||||
type Error = Errors;
|
||||
|
||||
async fn receive(&mut self) -> Result<ReceivedMessage, Self::Error> {
|
||||
match self.inner.next().await {
|
||||
None => Err(Errors::Closed),
|
||||
Some(Ok(msg)) => Ok(ReceivedMessage::Text(msg)),
|
||||
Some(Err(e)) => Err(Errors::Other(format!("{e:?}"))),
|
||||
}
|
||||
}
|
||||
}
|
||||
61
client/src/transports/stream_codec.rs
Normal file
61
client/src/transports/stream_codec.rs
Normal file
@ -0,0 +1,61 @@
|
||||
use bytes::BytesMut;
|
||||
use std::{io, str};
|
||||
use tokio_util::codec::{Decoder, Encoder};
|
||||
|
||||
type Separator = u8;
|
||||
|
||||
/// Stream codec for streaming protocols (ipc, tcp)
|
||||
#[derive(Debug, Default)]
|
||||
pub struct StreamCodec {
|
||||
incoming_separator: Separator,
|
||||
outgoing_separator: Separator,
|
||||
}
|
||||
|
||||
impl StreamCodec {
|
||||
/// Default codec with streaming input data. Input can be both enveloped and not.
|
||||
pub fn stream_incoming() -> Self {
|
||||
StreamCodec::new(b'\n', b'\n')
|
||||
}
|
||||
|
||||
/// New custom stream codec
|
||||
pub fn new(incoming_separator: Separator, outgoing_separator: Separator) -> Self {
|
||||
StreamCodec {
|
||||
incoming_separator,
|
||||
outgoing_separator,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Decoder for StreamCodec {
|
||||
type Item = String;
|
||||
type Error = io::Error;
|
||||
|
||||
fn decode(&mut self, buf: &mut BytesMut) -> io::Result<Option<Self::Item>> {
|
||||
if let Some(i) = buf
|
||||
.as_ref()
|
||||
.iter()
|
||||
.position(|&b| b == self.incoming_separator)
|
||||
{
|
||||
let line = buf.split_to(i);
|
||||
let _ = buf.split_to(1);
|
||||
|
||||
match str::from_utf8(line.as_ref()) {
|
||||
Ok(s) => Ok(Some(s.to_string())),
|
||||
Err(_) => Err(io::Error::other("invalid UTF-8")),
|
||||
}
|
||||
} else {
|
||||
Ok(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Encoder<String> for StreamCodec {
|
||||
type Error = io::Error;
|
||||
|
||||
fn encode(&mut self, msg: String, buf: &mut BytesMut) -> io::Result<()> {
|
||||
let mut payload = msg.into_bytes();
|
||||
payload.push(self.outgoing_separator);
|
||||
buf.extend_from_slice(&payload);
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
22
client/src/transports/tcp.rs
Normal file
22
client/src/transports/tcp.rs
Normal file
@ -0,0 +1,22 @@
|
||||
use std::io::Error;
|
||||
|
||||
use futures_util::stream::StreamExt;
|
||||
use jsonrpsee::core::client::{TransportReceiverT, TransportSenderT};
|
||||
use tokio::net::{TcpStream, ToSocketAddrs};
|
||||
use tokio_util::codec::Decoder;
|
||||
|
||||
use super::stream_codec::StreamCodec;
|
||||
use super::{Receiver, Sender};
|
||||
|
||||
/// Connect to a JSON-RPC TCP server.
|
||||
pub async fn connect(
|
||||
socket: impl ToSocketAddrs,
|
||||
) -> Result<(impl TransportSenderT + Send, impl TransportReceiverT + Send), Error> {
|
||||
let connection = TcpStream::connect(socket).await?;
|
||||
let (sink, stream) = StreamCodec::stream_incoming().framed(connection).split();
|
||||
|
||||
let sender = Sender { inner: sink };
|
||||
let receiver = Receiver { inner: stream };
|
||||
|
||||
Ok((sender, receiver))
|
||||
}
|
||||
148
data/org.asamk.SignalCli.metainfo.xml
Normal file
148
data/org.asamk.SignalCli.metainfo.xml
Normal file
@ -0,0 +1,148 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="console-application">
|
||||
<id>org.asamk.SignalCli</id>
|
||||
|
||||
<name>signal-cli</name>
|
||||
<summary>Use Signal messenger in terminal</summary>
|
||||
<developer id="org.asamk">
|
||||
<name>AsamK</name>
|
||||
</developer>
|
||||
<icon type="stock">org.asamk.SignalCli</icon>
|
||||
<keywords>
|
||||
<keyword>signal</keyword>
|
||||
<keyword>signal-cli</keyword>
|
||||
<keyword>messenger</keyword>
|
||||
<keyword>messaging</keyword>
|
||||
</keywords>
|
||||
|
||||
<url type="bugtracker">https://github.com/AsamK/signal-cli/issues</url>
|
||||
<url type="homepage">https://github.com/AsamK/signal-cli</url>
|
||||
<url type="donation">https://github.com/sponsors/AsamK</url>
|
||||
<url type="faq">https://github.com/AsamK/signal-cli/discussions</url>
|
||||
<url type="vcs-browser">https://github.com/AsamK/signal-cli</url>
|
||||
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0-only</project_license>
|
||||
|
||||
<description>
|
||||
<p>
|
||||
signal-cli is an unofficial commandline interface for the Signal Messenger.
|
||||
It supports many Signal functions, including registering, verifying, sending and receiving messages.
|
||||
For registering you need a phone number where you can receive SMS or incoming calls.
|
||||
Alternatively signal-cli can be linked to an existing App account.
|
||||
</p>
|
||||
</description>
|
||||
|
||||
<categories>
|
||||
<category>Utility</category>
|
||||
<category>Java</category>
|
||||
</categories>
|
||||
|
||||
<provides>
|
||||
<binary>signal-cli</binary>
|
||||
</provides>
|
||||
<content_rating type="oars-1.1">
|
||||
<content_attribute id="social-chat">intense</content_attribute>
|
||||
</content_rating>
|
||||
<releases>
|
||||
<release version="0.14.5" date="2026-06-11">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.5</url>
|
||||
</release>
|
||||
<release version="0.14.4" date="2026-05-23">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.4</url>
|
||||
</release>
|
||||
<release version="0.14.3" date="2026-04-22">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.3</url>
|
||||
</release>
|
||||
<release version="0.14.2" date="2026-04-04">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.2</url>
|
||||
</release>
|
||||
<release version="0.14.1" date="2026-03-08">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.1</url>
|
||||
</release>
|
||||
<release version="0.14.0" date="2026-03-01">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.14.0</url>
|
||||
</release>
|
||||
<release version="0.13.24" date="2026-02-05">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.24</url>
|
||||
</release>
|
||||
<release version="0.13.23" date="2026-01-24">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.23</url>
|
||||
</release>
|
||||
<release version="0.13.22" date="2025-11-14">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.22</url>
|
||||
</release>
|
||||
<release version="0.13.21" date="2025-10-25">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.21</url>
|
||||
</release>
|
||||
<release version="0.13.20" date="2025-09-23">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.20</url>
|
||||
</release>
|
||||
<release version="0.13.19" date="2025-09-15">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.19</url>
|
||||
</release>
|
||||
<release version="0.13.18" date="2025-07-16">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.18</url>
|
||||
</release>
|
||||
<release version="0.13.17" date="2025-06-28">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.17</url>
|
||||
</release>
|
||||
<release version="0.13.16" date="2025-06-07">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.16</url>
|
||||
</release>
|
||||
<release version="0.13.15" date="2025-05-08">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.15</url>
|
||||
</release>
|
||||
<release version="0.13.14" date="2025-04-06">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.14</url>
|
||||
</release>
|
||||
<release version="0.13.13" date="2025-02-28">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.13</url>
|
||||
</release>
|
||||
<release version="0.13.12" date="2025-01-18">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.12</url>
|
||||
</release>
|
||||
<release version="0.13.11" date="2024-12-26">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.11</url>
|
||||
</release>
|
||||
<release version="0.13.10" date="2024-11-30">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.10</url>
|
||||
</release>
|
||||
<release version="0.13.9" date="2024-10-28">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.9</url>
|
||||
</release>
|
||||
<release version="0.13.8" date="2024-10-26">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.8</url>
|
||||
</release>
|
||||
<release version="0.13.7" date="2024-09-28">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.7</url>
|
||||
</release>
|
||||
<release version="0.13.6" date="2024-09-08">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.6</url>
|
||||
</release>
|
||||
<release version="0.13.5" date="2024-07-25">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.5</url>
|
||||
</release>
|
||||
<release version="0.13.4" date="2024-06-06">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.4</url>
|
||||
</release>
|
||||
<release version="0.13.3" date="2024-04-19">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.3</url>
|
||||
</release>
|
||||
<release version="0.13.2" date="2024-03-23">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.2</url>
|
||||
</release>
|
||||
<release version="0.13.1" date="2024-02-27">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.1</url>
|
||||
</release>
|
||||
<release version="0.13.0" date="2024-02-18">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.13.0</url>
|
||||
</release>
|
||||
<release version="0.12.8" date="2024-02-08">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.12.8</url>
|
||||
</release>
|
||||
<release version="0.12.7" date="2023-12-15">
|
||||
<url type="details">https://github.com/AsamK/signal-cli/releases/tag/v0.12.7</url>
|
||||
</release>
|
||||
</releases>
|
||||
</component>
|
||||
10
data/org.asamk.SignalCli.svg
Normal file
10
data/org.asamk.SignalCli.svg
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="128" height="128" version="1.1" viewBox="0 0 33.867 33.867" xmlns="http://www.w3.org/2000/svg">
|
||||
<g transform="translate(-32.279 -138.64)">
|
||||
<g transform="matrix(.45526 0 0 .45526 33.984 140.17)">
|
||||
<path d="m33.468 66.938c-18.454 0-33.468-15.014-33.468-33.469s15.014-33.469 33.468-33.469c18.455 0 33.469 15.014 33.469 33.469 0 5.621-1.421 11.161-4.116 16.076l4.608 17.2-16.849-4.516c-5.172 3.084-11.069 4.709-17.112 4.709z" fill="#fff"/>
|
||||
<path d="m33.468 67.184c-18.454 0-33.468-15.014-33.468-33.469s15.014-33.469 33.468-33.469c18.455 0 33.469 15.014 33.469 33.469 0 5.621-1.421 11.161-4.116 16.076l4.608 17.2-16.849-4.516c-5.172 3.084-11.069 4.709-17.112 4.709zm0-62.938c-16.249 0-29.468 13.22-29.468 29.469s13.219 29.469 29.468 29.469c5.582 0 11.021-1.574 15.729-4.554l0.74-0.468 11.835 3.171-3.243-12.1 0.419-0.72c2.609-4.484 3.988-9.602 3.988-14.799 0-16.248-13.219-29.468-29.468-29.468z"/>
|
||||
<path d="m25.515 45.296q-2.3937 0-4.2817-0.97772-1.8543-0.97772-2.9332-3.0343-1.0451-2.0566-1.0451-5.2595 0-3.3377 1.1126-5.428 1.1126-2.0903 3.0006-3.068 1.9217-0.97772 4.3492-0.97772 1.3823 0 2.6634 0.30343 1.2812 0.26972 2.0903 0.67429l-0.91029 2.4612q-0.80915-0.30343-1.888-0.57315t-2.0229-0.26972q-5.3269 0-5.3269 6.844 0 3.2703 1.2812 5.0235 1.3149 1.7194 3.8772 1.7194 1.4834 0 2.596-0.30343 1.1463-0.30343 2.0903-0.74172v2.6297q-0.91029 0.472-2.0229 0.708-1.0789 0.26972-2.6297 0.26972zm11.901-0.33714h-2.9669v-25.623h2.9669zm7.2486-24.848q0.67429 0 1.18 0.472 0.53943 0.43829 0.53943 1.416 0 0.94401-0.53943 1.416-0.50572 0.472-1.18 0.472-0.74172 0-1.2474-0.472-0.50572-0.472-0.50572-1.416 0-0.97772 0.50572-1.416 0.50572-0.472 1.2474-0.472zm1.4497 6.7766v18.071h-2.9669v-18.071z" aria-label="cli"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.7 KiB |
@ -32,8 +32,6 @@ RestrictAddressFamilies=AF_INET AF_INET6
|
||||
RestrictNamespaces=true
|
||||
RestrictRealtime=true
|
||||
RestrictSUIDSGID=true
|
||||
# JVM always exits with 143 in reaction to SIGTERM signal
|
||||
SuccessExitStatus=143
|
||||
StandardInput=socket
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
@ -8,11 +8,9 @@ After=network-online.target
|
||||
[Service]
|
||||
Type=dbus
|
||||
Environment="SIGNAL_CLI_OPTS=-Xms2m"
|
||||
ExecStart=%dir%/bin/signal-cli --config /var/lib/signal-cli daemon --system
|
||||
ExecStart=%dir%/bin/signal-cli --config /var/lib/signal-cli daemon --dbus-system
|
||||
User=signal-cli
|
||||
BusName=org.asamk.Signal
|
||||
# JVM always exits with 143 in reaction to SIGTERM signal
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
Alias=dbus-org.asamk.Signal.service
|
||||
|
||||
@ -8,11 +8,9 @@ After=network-online.target
|
||||
[Service]
|
||||
Type=dbus
|
||||
Environment="SIGNAL_CLI_OPTS=-Xms2m"
|
||||
ExecStart=%dir%/bin/signal-cli -a %I --config /var/lib/signal-cli daemon --system
|
||||
ExecStart=%dir%/bin/signal-cli -a %I --config /var/lib/signal-cli daemon --dbus-system
|
||||
User=signal-cli
|
||||
BusName=org.asamk.Signal
|
||||
# JVM always exits with 143 in reaction to SIGTERM signal
|
||||
SuccessExitStatus=143
|
||||
|
||||
[Install]
|
||||
Alias=dbus-org.asamk.Signal.service
|
||||
|
||||
359
docs/CALL_TUNNEL.md
Normal file
359
docs/CALL_TUNNEL.md
Normal file
@ -0,0 +1,359 @@
|
||||
# Voice Call Support
|
||||
|
||||
## Overview
|
||||
|
||||
signal-cli supports voice calls by spawning a subprocess called
|
||||
`signal-call-tunnel` for each call. The tunnel handles WebRTC negotiation and
|
||||
audio transport. signal-cli communicates with the tunnel over its stdin/stdout
|
||||
using newline-delimited JSON messages, relaying signaling between the tunnel
|
||||
and the Signal protocol.
|
||||
|
||||
```
|
||||
signal-cli signal-call-tunnel
|
||||
| |
|
||||
|-- spawn --------------------------->|
|
||||
|-- config JSON on stdin ------------>|
|
||||
| |
|
||||
|-- commands on stdin --------------->|
|
||||
|<-- events on stdout ----------------|
|
||||
| | WebRTC
|
||||
| signaling relay | audio I/O
|
||||
| |
|
||||
| (stderr: tunnel logging) -------->| (captured by signal-cli)
|
||||
```
|
||||
|
||||
Each call gets its own tunnel process. When the call ends, signal-cli closes
|
||||
stdin and destroys the process.
|
||||
|
||||
Audio device names (`inputDeviceName`, `outputDeviceName`) are opaque strings
|
||||
returned by the tunnel in its `ready` message. signal-cli passes them through
|
||||
to JSON-RPC clients, which use them to connect audio via platform APIs.
|
||||
|
||||
---
|
||||
|
||||
## Spawning the Tunnel
|
||||
|
||||
For each call, signal-cli:
|
||||
|
||||
1. Spawns `signal-call-tunnel`
|
||||
2. Writes config JSON followed by a newline to stdin
|
||||
3. Keeps stdin open for subsequent control messages
|
||||
4. Reads control events from stdout
|
||||
5. Captures stderr for logging
|
||||
|
||||
The `signal-call-tunnel` binary is located by searching (in order):
|
||||
|
||||
1. `SIGNAL_CALL_TUNNEL_BIN` environment variable
|
||||
2. `<signal-cli install dir>/bin/signal-call-tunnel` (detected from jar location)
|
||||
3. `signal-call-tunnel` on `PATH`
|
||||
|
||||
### Config JSON
|
||||
|
||||
The first line written to the tunnel's stdin:
|
||||
|
||||
```json
|
||||
{
|
||||
"call_id": 12345,
|
||||
"is_outgoing": true,
|
||||
"local_device_id": 1,
|
||||
"input_device_name": "signal_input",
|
||||
"output_device_name": "signal_output"
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Type | Description |
|
||||
|----------------------|-------------------------|-----------------------------------------------|
|
||||
| `call_id` | unsigned 64-bit integer | Call identifier (use unsigned representation) |
|
||||
| `is_outgoing` | boolean | Whether this is an outgoing call |
|
||||
| `local_device_id` | integer | Signal device ID |
|
||||
| `input_device_name` | string (optional) | Requested input audio device name |
|
||||
| `output_device_name` | string (optional) | Requested output audio device name |
|
||||
|
||||
If `input_device_name` or `output_device_name` are omitted, the tunnel
|
||||
chooses default names. On Linux, these are per-call unique names (e.g.,
|
||||
`signal_input_<call_id>`). On macOS, these are the fixed names `signal_input`
|
||||
and `signal_output`, which must match the pre-installed BlackHole drivers.
|
||||
|
||||
---
|
||||
|
||||
## Control Protocol
|
||||
|
||||
Newline-delimited JSON messages over stdin (signal-cli to tunnel) and stdout
|
||||
(tunnel to signal-cli). The first line on stdin is the config JSON. Subsequent
|
||||
lines are control messages.
|
||||
|
||||
### signal-cli -> Tunnel (stdin)
|
||||
|
||||
| Type | When | Fields |
|
||||
|----------------------|----------------------------|---------------------------------------------------------------------------------------------------|
|
||||
| `createOutgoingCall` | Outgoing call setup | `callId`, `peerId` |
|
||||
| `proceed` | After offer/receivedOffer | `callId`, `hideIp`, `iceServers` |
|
||||
| `receivedOffer` | Incoming call | `callId`, `peerId`, `opaque`, `age`, `senderDeviceId`, `senderIdentityKey`, `receiverIdentityKey` |
|
||||
| `receivedAnswer` | Outgoing call answered | `opaque`, `senderDeviceId`, `senderIdentityKey`, `receiverIdentityKey` |
|
||||
| `receivedIce` | ICE candidates arrive | `candidates` (array of base64 opaque blobs) |
|
||||
| `accept` | User accepts incoming call | *(none)* |
|
||||
| `hangup` | End the call | *(none)* |
|
||||
|
||||
### Tunnel -> signal-cli (stdout)
|
||||
|
||||
| Type | When | Fields |
|
||||
|---------------|---------------------------------------------|------------------------------------------------------|
|
||||
| `ready` | Control socket bound, audio devices created | `inputDeviceName`, `outputDeviceName` |
|
||||
| `sendOffer` | Tunnel generated an offer | `callId`, `opaque`, `callMediaType` |
|
||||
| `sendAnswer` | Tunnel generated an answer | `callId`, `opaque` |
|
||||
| `sendIce` | ICE candidates gathered | `callId`, `candidates` (array of `{"opaque":"..."}`) |
|
||||
| `sendHangup` | Tunnel wants to hang up | `callId`, `hangupType` |
|
||||
| `sendBusy` | Line is busy | `callId` |
|
||||
| `stateChange` | Call state transition | `state`, `reason` (optional) |
|
||||
| `error` | Something went wrong | `message` |
|
||||
|
||||
Opaque blobs and identity keys are base64-encoded. ICE servers use the format:
|
||||
|
||||
```json
|
||||
{
|
||||
"urls": [
|
||||
"turn:example.com"
|
||||
],
|
||||
"username": "u",
|
||||
"password": "p"
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Startup Sequence
|
||||
|
||||
```
|
||||
signal-cli signal-call-tunnel
|
||||
| |
|
||||
|-- spawn process ------------------> |
|
||||
|-- config JSON + newline on stdin ---->|
|
||||
| | parse config
|
||||
| | initialize audio
|
||||
| |
|
||||
|<-------- ready (on stdout) -----------|
|
||||
| {"type":"ready", |
|
||||
| "inputDeviceName":"...", |
|
||||
| "outputDeviceName":"..."} |
|
||||
| |
|
||||
|-- control messages on stdin --------->|
|
||||
|<-- control events on stdout ----------|
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Call Flows
|
||||
|
||||
### Outgoing call
|
||||
|
||||
```
|
||||
signal-cli signal-call-tunnel Remote Phone
|
||||
| | |
|
||||
|-- spawn + config ------->| |
|
||||
|<-- ready ----------------| |
|
||||
|-- createOutgoingCall --->| |
|
||||
|-- proceed (TURN) ------->| |
|
||||
| | create offer |
|
||||
|<-- sendOffer ------------| |
|
||||
|-- offer via Signal -------------------------------->|
|
||||
|<-- answer via Signal -------------------------------|
|
||||
|-- receivedAnswer ------->| (+ identity keys) |
|
||||
|<-- sendIce --------------| |
|
||||
|-- ICE via Signal -------------------------------> |
|
||||
|<-- ICE via Signal -------------------------------- |
|
||||
|-- receivedIce ---------->| |
|
||||
| | ICE connects |
|
||||
|<-- stateChange:Connected | |
|
||||
```
|
||||
|
||||
### Incoming call
|
||||
|
||||
```
|
||||
signal-cli signal-call-tunnel Remote Phone
|
||||
| | |
|
||||
|<-- offer via Signal --------------------------------|
|
||||
|-- spawn + config ------->| |
|
||||
|<-- ready ----------------| |
|
||||
|-- receivedOffer -------->| (+ identity keys) |
|
||||
|-- proceed (TURN) ------->| |
|
||||
| | process offer |
|
||||
|<-- sendAnswer -----------| |
|
||||
|-- answer via Signal -------------------------------->|
|
||||
|<-- sendIce --------------| |
|
||||
|-- ICE via Signal ------------------------------> |
|
||||
|<-- ICE via Signal -------------------------------- |
|
||||
|-- receivedIce ---------->| |
|
||||
| | ICE connecting... |
|
||||
| | |
|
||||
| (user accepts call) | |
|
||||
| Java defers accept | |
|
||||
| | |
|
||||
|<-- stateChange:Ringing --| (tunnel ready to accept)|
|
||||
|-- accept --------------->| (deferred accept sent) |
|
||||
| | accept |
|
||||
|<-- stateChange:Connected | |
|
||||
```
|
||||
|
||||
### JSON-RPC client perspective
|
||||
|
||||
An external application (bot, UI, test script) interacts via JSON-RPC only.
|
||||
|
||||
**Important:** Call event notifications are not sent by default. Clients must
|
||||
call `subscribeCallEvents` before initiating or receiving calls. Without this,
|
||||
incoming calls are silently ignored (no tunnel is spawned).
|
||||
|
||||
```
|
||||
JSON-RPC Client signal-cli daemon
|
||||
| |
|
||||
|-- subscribeCallEvents() ------------>| (required: enables call support)
|
||||
| |
|
||||
|-- startCall(recipient) ------------->|
|
||||
|<-- {callId, state, -|
|
||||
| inputDeviceName, |
|
||||
| outputDeviceName} |
|
||||
| |
|
||||
|<-- callEvent: RINGING_OUTGOING ------|
|
||||
| ... remote answers ... |
|
||||
|<-- callEvent: CONNECTED -------------|
|
||||
| |
|
||||
| connect to audio devices |
|
||||
| (via platform audio APIs) |
|
||||
| |
|
||||
|-- hangupCall(callId) --------------->| (or: receive callEvent ENDED)
|
||||
|<-- callEvent: ENDED -----------------|
|
||||
| disconnect from audio devices |
|
||||
```
|
||||
|
||||
For incoming calls:
|
||||
|
||||
```
|
||||
JSON-RPC Client signal-cli daemon
|
||||
| |
|
||||
|-- subscribeCallEvents() ------------>| (if not already subscribed)
|
||||
| |
|
||||
|<-- callEvent: RINGING_INCOMING ------| (includes callId, device names)
|
||||
| |
|
||||
|-- acceptCall(callId) --------------->|
|
||||
|<-- {callId, state, -|
|
||||
| inputDeviceName, |
|
||||
| outputDeviceName} |
|
||||
| |
|
||||
|<-- callEvent: CONNECTING ------------|
|
||||
|<-- callEvent: CONNECTED -------------|
|
||||
| |
|
||||
| connect to audio devices |
|
||||
| (via platform audio APIs) |
|
||||
```
|
||||
|
||||
To stop receiving call events, call `unsubscribeCallEvents`.
|
||||
|
||||
---
|
||||
|
||||
## State Machine
|
||||
|
||||
Call states as seen by JSON-RPC clients:
|
||||
|
||||
```
|
||||
startCall()
|
||||
|
|
||||
v
|
||||
+----- RINGING_OUTGOING ----+ RINGING_INCOMING -----+
|
||||
| | | | |
|
||||
| (timeout | (answered) | (rejected) | acceptCall() | (timeout
|
||||
| ~60s) | | | | ~60s)
|
||||
v v v v v
|
||||
ENDED CONNECTED ENDED CONNECTING ENDED
|
||||
| |
|
||||
| v
|
||||
| CONNECTED
|
||||
| |
|
||||
| (hangup/error) | (hangup/error)
|
||||
v v
|
||||
ENDED ENDED
|
||||
```
|
||||
|
||||
For outgoing calls, `CONNECTED` fires directly when the tunnel reports
|
||||
`Connected` state -- there is no intermediate `CONNECTING` event.
|
||||
|
||||
For incoming calls, `CONNECTING` is set by Java when the user calls
|
||||
`acceptCall()`, before the tunnel completes ICE negotiation.
|
||||
|
||||
Both directions have a 60-second ring timeout.
|
||||
|
||||
Reconnection (ICE restart):
|
||||
|
||||
```
|
||||
CONNECTED --> RECONNECTING --> CONNECTED (ICE restart succeeded)
|
||||
|
|
||||
v
|
||||
ENDED (ICE restart failed)
|
||||
```
|
||||
|
||||
`RECONNECTING` maps from the tunnel's `Connecting` state, which is emitted
|
||||
during ICE restarts (not during initial connection).
|
||||
|
||||
---
|
||||
|
||||
## CallManager.java
|
||||
|
||||
`lib/src/main/java/org/asamk/signal/manager/helper/CallManager.java`
|
||||
|
||||
Manages the call lifecycle from the Java side:
|
||||
|
||||
1. Spawns `signal-call-tunnel` and writes config JSON to stdin
|
||||
2. Keeps stdin open as the control write channel; reads stdout for control events
|
||||
3. Captures stderr for tunnel logging
|
||||
4. Parses `inputDeviceName` and `outputDeviceName` from the tunnel's `ready`
|
||||
message and includes them in `CallInfo`
|
||||
5. Translates tunnel state changes into `CallInfo.State` values and fires
|
||||
`callEvent` JSON-RPC notifications to connected clients
|
||||
6. Defers the `accept` message for incoming calls until the tunnel reports
|
||||
`Ringing` state (sending earlier causes the tunnel to drop it)
|
||||
7. Schedules a 60-second ring timeout for both incoming and outgoing calls
|
||||
8. On hangup: sends hangup message, closes stdin, and destroys the process
|
||||
|
||||
---
|
||||
|
||||
## Implementation Notes
|
||||
|
||||
### Peer ID consistency
|
||||
|
||||
The `peerId` field in `createOutgoingCall` and `receivedOffer` must be the actual
|
||||
remote peer UUID (e.g., `senderAddress.toString()`). The tunnel rejects ICE
|
||||
candidates if the peer ID doesn't match across calls, causing "Ignoring
|
||||
peer-reflexive ICE candidate because the ufrag is unknown."
|
||||
|
||||
### sendHangup semantics
|
||||
|
||||
`sendHangup` from the tunnel is a request to send a hangup message via Signal
|
||||
protocol. It is **not** a local state change -- local state transitions come
|
||||
exclusively from `stateChange` events. For single-device clients, ignore
|
||||
`AcceptedOnAnotherDevice`, `DeclinedOnAnotherDevice`, and
|
||||
`BusyOnAnotherDevice` hangup types in the `hangupType` field -- sending these to
|
||||
the remote peer causes it to terminate the call prematurely.
|
||||
|
||||
### Call ID serialization
|
||||
|
||||
Call IDs can exceed `Long.MAX_VALUE` in Java. Use `Long.toUnsignedString()` when
|
||||
serializing to JSON for the tunnel (which expects unsigned 64-bit integers). In
|
||||
the config JSON, `call_id` should also use unsigned representation.
|
||||
|
||||
### Incoming hangup filtering
|
||||
|
||||
When receiving hangup messages via Signal protocol, only honor `NORMAL` type
|
||||
hangups. `ACCEPTED`, `DECLINED`, and `BUSY` types are multi-device coordination
|
||||
messages and should be ignored by single-device clients.
|
||||
|
||||
### JSON-RPC call ID types
|
||||
|
||||
JSON-RPC clients may send call IDs as various numeric types (Long, BigInteger,
|
||||
Integer). Use `Number.longValue()` rather than direct casting when extracting
|
||||
call IDs from JSON-RPC parameters.
|
||||
|
||||
### Identity key format
|
||||
|
||||
Identity keys in `senderIdentityKey` and `receiverIdentityKey` must be **raw
|
||||
32-byte Curve25519 public keys** (without the 0x05 DJB type prefix). If the
|
||||
33-byte serialized form is used instead, SRTP key derivation produces different
|
||||
keys on each side, causing authentication failures.
|
||||
|
||||
@ -1,204 +0,0 @@
|
||||
[
|
||||
{
|
||||
"name":"com.sun.security.auth.module.UnixSystem",
|
||||
"fields":[
|
||||
{"name":"gid"},
|
||||
{"name":"groups"},
|
||||
{"name":"uid"},
|
||||
{"name":"username"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"java.lang.Boolean",
|
||||
"methods":[{"name":"getBoolean","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"java.lang.Class",
|
||||
"methods":[{"name":"getCanonicalName","parameterTypes":[] }]
|
||||
},
|
||||
{
|
||||
"name":"java.lang.ClassLoader",
|
||||
"methods":[
|
||||
{"name":"getPlatformClassLoader","parameterTypes":[] },
|
||||
{"name":"loadClass","parameterTypes":["java.lang.String"] }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"java.lang.IllegalArgumentException",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"java.lang.IllegalStateException",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"java.lang.NoSuchMethodError"
|
||||
},
|
||||
{
|
||||
"name":"java.lang.Throwable",
|
||||
"methods":[{"name":"getMessage","parameterTypes":[] }]
|
||||
},
|
||||
{
|
||||
"name":"java.lang.UnsatisfiedLinkError",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"java.util.UUID",
|
||||
"methods":[
|
||||
{"name":"<init>","parameterTypes":["long","long"] },
|
||||
{"name":"getLeastSignificantBits","parameterTypes":[] },
|
||||
{"name":"getMostSignificantBits","parameterTypes":[] }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"jdk.internal.loader.ClassLoaders$PlatformClassLoader"
|
||||
},
|
||||
{
|
||||
"name":"org.asamk.signal.manager.storage.protocol.SignalProtocolStore",
|
||||
"methods":[
|
||||
{"name":"getIdentity","parameterTypes":["org.signal.libsignal.protocol.SignalProtocolAddress"] },
|
||||
{"name":"getIdentityKeyPair","parameterTypes":[] },
|
||||
{"name":"getLocalRegistrationId","parameterTypes":[] },
|
||||
{"name":"isTrustedIdentity","parameterTypes":["org.signal.libsignal.protocol.SignalProtocolAddress","org.signal.libsignal.protocol.IdentityKey","org.signal.libsignal.protocol.state.IdentityKeyStore$Direction"] },
|
||||
{"name":"loadPreKey","parameterTypes":["int"] },
|
||||
{"name":"loadSenderKey","parameterTypes":["org.signal.libsignal.protocol.SignalProtocolAddress","java.util.UUID"] },
|
||||
{"name":"loadSession","parameterTypes":["org.signal.libsignal.protocol.SignalProtocolAddress"] },
|
||||
{"name":"loadSignedPreKey","parameterTypes":["int"] },
|
||||
{"name":"removePreKey","parameterTypes":["int"] },
|
||||
{"name":"saveIdentity","parameterTypes":["org.signal.libsignal.protocol.SignalProtocolAddress","org.signal.libsignal.protocol.IdentityKey"] },
|
||||
{"name":"storeSenderKey","parameterTypes":["org.signal.libsignal.protocol.SignalProtocolAddress","java.util.UUID","org.signal.libsignal.protocol.groups.state.SenderKeyRecord"] },
|
||||
{"name":"storeSession","parameterTypes":["org.signal.libsignal.protocol.SignalProtocolAddress","org.signal.libsignal.protocol.state.SessionRecord"] }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"org.graalvm.jniutils.JNIExceptionWrapperEntryPoints",
|
||||
"methods":[{"name":"getClassName","parameterTypes":["java.lang.Class"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.DuplicateMessageException",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.IdentityKey",
|
||||
"methods":[
|
||||
{"name":"<init>","parameterTypes":["byte[]"] },
|
||||
{"name":"serialize","parameterTypes":[] }
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.IdentityKeyPair",
|
||||
"methods":[{"name":"serialize","parameterTypes":[] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.InvalidKeyException",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.InvalidKeyIdException"
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.InvalidMessageException",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.SignalProtocolAddress",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String","int"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.UntrustedIdentityException",
|
||||
"methods":[{"name":"<init>","parameterTypes":["java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.groups.state.SenderKeyRecord",
|
||||
"fields":[{"name":"unsafeHandle"}],
|
||||
"methods":[{"name":"<init>","parameterTypes":["long"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.groups.state.SenderKeyStore"
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.logging.Log",
|
||||
"methods":[{"name":"log","parameterTypes":["int","java.lang.String","java.lang.String"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.message.PlaintextContent",
|
||||
"fields":[{"name":"unsafeHandle"}]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.message.PreKeySignalMessage",
|
||||
"fields":[{"name":"unsafeHandle"}],
|
||||
"methods":[{"name":"<init>","parameterTypes":["long"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.message.SenderKeyMessage",
|
||||
"fields":[{"name":"unsafeHandle"}],
|
||||
"methods":[{"name":"<init>","parameterTypes":["long"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.message.SignalMessage",
|
||||
"fields":[{"name":"unsafeHandle"}],
|
||||
"methods":[{"name":"<init>","parameterTypes":["long"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.IdentityKeyStore"
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.IdentityKeyStore$Direction",
|
||||
"fields":[
|
||||
{"name":"RECEIVING"},
|
||||
{"name":"SENDING"}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.PreKeyRecord",
|
||||
"fields":[{"name":"unsafeHandle"}]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.PreKeyStore"
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.SessionRecord",
|
||||
"fields":[{"name":"unsafeHandle"}],
|
||||
"methods":[{"name":"<init>","parameterTypes":["byte[]"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.SessionStore"
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.SignedPreKeyRecord",
|
||||
"fields":[{"name":"unsafeHandle"}]
|
||||
},
|
||||
{
|
||||
"name":"org.signal.libsignal.protocol.state.SignedPreKeyStore"
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.Collation"
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.Function"
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.Function$Aggregate"
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.Function$Window"
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.ProgressHandler"
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.core.DB",
|
||||
"methods":[{"name":"throwex","parameterTypes":["int"] }]
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.core.DB$ProgressObserver"
|
||||
},
|
||||
{
|
||||
"name":"org.sqlite.core.NativeDB",
|
||||
"fields":[
|
||||
{"name":"colldatalist"},
|
||||
{"name":"pointer"},
|
||||
{"name":"udfdatalist"}
|
||||
]
|
||||
}
|
||||
]
|
||||
@ -1,8 +0,0 @@
|
||||
[
|
||||
{
|
||||
"type":"agent-extracted",
|
||||
"classes":[
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
@ -1,23 +0,0 @@
|
||||
[
|
||||
{
|
||||
"interfaces":["java.sql.Connection"]}
|
||||
,
|
||||
{
|
||||
"interfaces":["org.asamk.Signal"]}
|
||||
,
|
||||
{
|
||||
"interfaces":["org.asamk.Signal$Configuration"]}
|
||||
,
|
||||
{
|
||||
"interfaces":["org.asamk.Signal$Device"]}
|
||||
,
|
||||
{
|
||||
"interfaces":["org.asamk.Signal$Group"]}
|
||||
,
|
||||
{
|
||||
"interfaces":["org.asamk.SignalControl"]}
|
||||
,
|
||||
{
|
||||
"interfaces":["org.freedesktop.dbus.interfaces.DBus"]}
|
||||
|
||||
]
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,229 +0,0 @@
|
||||
{
|
||||
"resources":{
|
||||
"includes":[
|
||||
{
|
||||
"pattern":"\\QMETA-INF/maven/org.xerial/sqlite-jdbc/pom.properties\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\QMETA-INF/services/ch.qos.logback.classic.spi.Configurator\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\QMETA-INF/services/java.sql.Driver\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\QMETA-INF/services/org.freedesktop.dbus.spi.transport.ITransportProvider\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AG\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AI\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AR\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AT\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AU\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AZ\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BB\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BD\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BE\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BM\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BR\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BS\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CA\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CH\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CI\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CL\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CN\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_CZ\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_DE\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EC\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_EE\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ES\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FI\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_FR\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GB\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_GR\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HK\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HR\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_HU\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_ID\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IL\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IN\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IR\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_IT\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_JP\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LV\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MM\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MO\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MX\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_MY\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NG\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NL\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_NZ\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PA\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PE\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PH\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_PL\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RO\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_RU\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SA\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SI\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_SK\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TH\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_TR\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UA\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_UG\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_US\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_VE\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qcom/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_XK\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qjni/x86_64-Linux/libjffi-1.2.so\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qlibsignal_jni.so\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qorg/asamk/signal/manager/config/ias.store\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qorg/asamk/signal/manager/config/whisper.store\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qorg/slf4j/impl/StaticLoggerBinder.class\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qorg/sqlite/native/Linux/x86_64/libsqlitejdbc.so\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"\\Qsqlite-jdbc.properties\\E"
|
||||
},
|
||||
{
|
||||
"pattern":"com/google/i18n/phonenumbers/data/.*"
|
||||
}
|
||||
]},
|
||||
"bundles":[{
|
||||
"name":"net.sourceforge.argparse4j.internal.ArgumentParserImpl",
|
||||
"locales":[
|
||||
"",
|
||||
"en",
|
||||
"und"
|
||||
]
|
||||
}]
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
[
|
||||
]
|
||||
27
gradle/libs.versions.toml
Normal file
27
gradle/libs.versions.toml
Normal file
@ -0,0 +1,27 @@
|
||||
[versions]
|
||||
slf4j = "2.0.18"
|
||||
junit = "6.1.0"
|
||||
micronaut-json-schema = "2.0.1"
|
||||
micronaut-core = "5.0.0"
|
||||
signal-service = "2.15.3_unofficial_148"
|
||||
|
||||
[libraries]
|
||||
bouncycastle = "org.bouncycastle:bcprov-jdk18on:1.84"
|
||||
jackson-databind = "com.fasterxml.jackson.core:jackson-databind:2.20.2"
|
||||
argparse4j = "net.sourceforge.argparse4j:argparse4j:0.9.0"
|
||||
dbusjava = "com.github.hypfvieh:dbus-java-transport-native-unixsocket:5.0.0"
|
||||
zxing = "com.google.zxing:core:3.5.4"
|
||||
micronaut-json-schema-annotations = { module = "io.micronaut.jsonschema:micronaut-json-schema-annotations", version.ref = "micronaut-json-schema" }
|
||||
micronaut-json-schema-processor = { module = "io.micronaut.jsonschema:micronaut-json-schema-processor", version.ref = "micronaut-json-schema" }
|
||||
micronaut-json-schema-generator = { module = "io.micronaut.jsonschema:micronaut-json-schema-generator", version.ref = "micronaut-json-schema" }
|
||||
micronaut-inject-java = { module = "io.micronaut:micronaut-inject-java", version.ref = "micronaut-core" }
|
||||
slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
|
||||
slf4j-jul = { module = "org.slf4j:jul-to-slf4j", version.ref = "slf4j" }
|
||||
logback = "ch.qos.logback:logback-classic:1.5.32"
|
||||
|
||||
signalnetwork = { module = "com.github.turasa:signal-network", version.ref = "signal-service" }
|
||||
sqlite = "org.xerial:sqlite-jdbc:3.53.1.0"
|
||||
hikari = "com.zaxxer:HikariCP:7.0.2"
|
||||
junit-jupiter-bom = { module = "org.junit:junit-bom", version.ref = "junit" }
|
||||
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit" }
|
||||
junit-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit" }
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,5 +1,9 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
|
||||
networkTimeout=10000
|
||||
retries=0
|
||||
retryBackOffMs=500
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
50
gradlew
vendored
50
gradlew
vendored
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
#
|
||||
# Copyright © 2015-2021 the original authors.
|
||||
# Copyright © 2015 the original authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
@ -15,6 +15,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
@ -55,7 +57,7 @@
|
||||
# Darwin, MinGW, and NonStop.
|
||||
#
|
||||
# (3) This script is generated from the Groovy template
|
||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||
# within the Gradle project.
|
||||
#
|
||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||
@ -80,13 +82,11 @@ do
|
||||
esac
|
||||
done
|
||||
|
||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||
|
||||
APP_NAME="Gradle"
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
APP_BASE_NAME=${0##*/}
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD=maximum
|
||||
@ -114,7 +114,6 @@ case "$( uname )" in #(
|
||||
NONSTOP* ) nonstop=true ;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
@ -133,22 +132,29 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
MAX_FD=$( ulimit -H -n ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
case $MAX_FD in #(
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||
# shellcheck disable=SC2039,SC3045
|
||||
ulimit -n "$MAX_FD" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
esac
|
||||
@ -165,7 +171,6 @@ fi
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if "$cygwin" || "$msys" ; then
|
||||
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
||||
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
||||
|
||||
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
||||
|
||||
@ -193,18 +198,27 @@ if "$cygwin" || "$msys" ; then
|
||||
done
|
||||
fi
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
-classpath "$CLASSPATH" \
|
||||
org.gradle.wrapper.GradleWrapperMain \
|
||||
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
|
||||
"$@"
|
||||
|
||||
# Stop when "xargs" is not available.
|
||||
if ! command -v xargs >/dev/null 2>&1
|
||||
then
|
||||
die "xargs is not available"
|
||||
fi
|
||||
|
||||
# Use "xargs" to parse quoted args.
|
||||
#
|
||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||
|
||||
59
gradlew.bat
vendored
59
gradlew.bat
vendored
@ -13,19 +13,22 @@
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
@rem SPDX-License-Identifier: Apache-2.0
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@if "%DEBUG%"=="" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
@rem Set local scope for the variables, and ensure extensions are enabled
|
||||
setlocal EnableExtensions
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
if "%DIRNAME%"=="" set DIRNAME=.
|
||||
@rem This is normally unused
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@ -40,15 +43,15 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
if %ERRORLEVEL% equ 0 goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
@ -56,34 +59,24 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
echo. 1>&2
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||
echo. 1>&2
|
||||
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||
echo location of your Java installation. 1>&2
|
||||
|
||||
goto fail
|
||||
"%COMSPEC%" /c exit 1
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
|
||||
@rem which allows us to clear the local environment before executing the java command
|
||||
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
:exitWithErrorLevel
|
||||
@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts
|
||||
"%COMSPEC%" /c exit %ERRORLEVEL%
|
||||
|
||||
@ -4,23 +4,40 @@ plugins {
|
||||
}
|
||||
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
sourceCompatibility = JavaVersion.VERSION_25
|
||||
targetCompatibility = JavaVersion.VERSION_25
|
||||
|
||||
if (!JavaVersion.current().isCompatibleWith(targetCompatibility)) {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(targetCompatibility.majorVersion))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
mavenCentral()
|
||||
}
|
||||
val libsignalClientPath = project.findProperty("libsignal_client_path")?.toString()
|
||||
|
||||
dependencies {
|
||||
implementation("com.github.turasa", "signal-service-java", "2.15.3_unofficial_46")
|
||||
implementation("com.fasterxml.jackson.core", "jackson-databind", "2.13.2.2")
|
||||
implementation("com.google.protobuf", "protobuf-javalite", "3.11.4")
|
||||
implementation("org.bouncycastle", "bcprov-jdk15on", "1.70")
|
||||
implementation("org.slf4j", "slf4j-api", "1.7.36")
|
||||
implementation("org.xerial", "sqlite-jdbc", "3.36.0.3")
|
||||
implementation("com.zaxxer", "HikariCP", "5.0.1")
|
||||
if (libsignalClientPath == null) {
|
||||
implementation(libs.signalnetwork)
|
||||
} else {
|
||||
implementation(libs.signalnetwork) {
|
||||
exclude(group = "org.signal", module = "libsignal-client")
|
||||
}
|
||||
implementation(files(libsignalClientPath))
|
||||
}
|
||||
implementation(libs.jackson.databind)
|
||||
implementation(libs.bouncycastle)
|
||||
implementation(libs.slf4j.api)
|
||||
implementation(libs.sqlite)
|
||||
implementation(libs.hikari)
|
||||
|
||||
testImplementation(libs.junit.jupiter)
|
||||
testImplementation(platform(libs.junit.jupiter.bom))
|
||||
testRuntimeOnly(libs.junit.launcher)
|
||||
}
|
||||
|
||||
tasks.named<Test>("test") {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
configurations {
|
||||
|
||||
@ -1,55 +0,0 @@
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.util.IOUtils;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
public class AttachmentStore {
|
||||
|
||||
private final File attachmentsPath;
|
||||
|
||||
public AttachmentStore(final File attachmentsPath) {
|
||||
this.attachmentsPath = attachmentsPath;
|
||||
}
|
||||
|
||||
public void storeAttachmentPreview(
|
||||
final SignalServiceAttachmentRemoteId attachmentId, final AttachmentStorer storer
|
||||
) throws IOException {
|
||||
storeAttachment(getAttachmentPreviewFile(attachmentId), storer);
|
||||
}
|
||||
|
||||
public void storeAttachment(
|
||||
final SignalServiceAttachmentRemoteId attachmentId, final AttachmentStorer storer
|
||||
) throws IOException {
|
||||
storeAttachment(getAttachmentFile(attachmentId), storer);
|
||||
}
|
||||
|
||||
private void storeAttachment(final File attachmentFile, final AttachmentStorer storer) throws IOException {
|
||||
createAttachmentsDir();
|
||||
try (OutputStream output = new FileOutputStream(attachmentFile)) {
|
||||
storer.store(output);
|
||||
}
|
||||
}
|
||||
|
||||
private File getAttachmentPreviewFile(SignalServiceAttachmentRemoteId attachmentId) {
|
||||
return new File(attachmentsPath, attachmentId.toString() + ".preview");
|
||||
}
|
||||
|
||||
public File getAttachmentFile(SignalServiceAttachmentRemoteId attachmentId) {
|
||||
return new File(attachmentsPath, attachmentId.toString());
|
||||
}
|
||||
|
||||
private void createAttachmentsDir() throws IOException {
|
||||
IOUtils.createPrivateDirectories(attachmentsPath);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
public interface AttachmentStorer {
|
||||
|
||||
void store(OutputStream outputStream) throws IOException;
|
||||
}
|
||||
}
|
||||
@ -1,17 +0,0 @@
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.jobs.Job;
|
||||
|
||||
public class JobExecutor {
|
||||
|
||||
private final Context context;
|
||||
|
||||
public JobExecutor(final Context context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
public void enqueueJob(Job job) {
|
||||
job.run(context);
|
||||
}
|
||||
}
|
||||
@ -1,52 +1,92 @@
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import com.google.i18n.phonenumbers.PhoneNumberUtil;
|
||||
|
||||
import org.asamk.signal.manager.api.AlreadyReceivingException;
|
||||
import org.asamk.signal.manager.api.AttachmentInvalidException;
|
||||
import org.asamk.signal.manager.api.CallInfo;
|
||||
import org.asamk.signal.manager.api.CallOffer;
|
||||
import org.asamk.signal.manager.api.CaptchaRejectedException;
|
||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||
import org.asamk.signal.manager.api.Configuration;
|
||||
import org.asamk.signal.manager.api.Device;
|
||||
import org.asamk.signal.manager.api.DeviceLimitExceededException;
|
||||
import org.asamk.signal.manager.api.DeviceLinkUrl;
|
||||
import org.asamk.signal.manager.api.Group;
|
||||
import org.asamk.signal.manager.api.GroupId;
|
||||
import org.asamk.signal.manager.api.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.api.GroupNotFoundException;
|
||||
import org.asamk.signal.manager.api.GroupSendingNotAllowedException;
|
||||
import org.asamk.signal.manager.api.Identity;
|
||||
import org.asamk.signal.manager.api.IdentityVerificationCode;
|
||||
import org.asamk.signal.manager.api.InactiveGroupLinkException;
|
||||
import org.asamk.signal.manager.api.IncorrectPinException;
|
||||
import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||
import org.asamk.signal.manager.api.InvalidStickerException;
|
||||
import org.asamk.signal.manager.api.InvalidUsernameException;
|
||||
import org.asamk.signal.manager.api.LastGroupAdminException;
|
||||
import org.asamk.signal.manager.api.Message;
|
||||
import org.asamk.signal.manager.api.MessageEnvelope;
|
||||
import org.asamk.signal.manager.api.NotMasterDeviceException;
|
||||
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||
import org.asamk.signal.manager.api.NotAGroupMemberException;
|
||||
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||
import org.asamk.signal.manager.api.Pair;
|
||||
import org.asamk.signal.manager.api.PendingAdminApprovalException;
|
||||
import org.asamk.signal.manager.api.PinLockMissingException;
|
||||
import org.asamk.signal.manager.api.PinLockedException;
|
||||
import org.asamk.signal.manager.api.RateLimitException;
|
||||
import org.asamk.signal.manager.api.ReceiveConfig;
|
||||
import org.asamk.signal.manager.api.Recipient;
|
||||
import org.asamk.signal.manager.api.RecipientIdentifier;
|
||||
import org.asamk.signal.manager.api.SendGroupMessageResults;
|
||||
import org.asamk.signal.manager.api.SendMessageResult;
|
||||
import org.asamk.signal.manager.api.SendMessageResults;
|
||||
import org.asamk.signal.manager.api.StickerPack;
|
||||
import org.asamk.signal.manager.api.StickerPackId;
|
||||
import org.asamk.signal.manager.api.StickerPackInvalidException;
|
||||
import org.asamk.signal.manager.api.StickerPackUrl;
|
||||
import org.asamk.signal.manager.api.TurnServer;
|
||||
import org.asamk.signal.manager.api.TypingAction;
|
||||
import org.asamk.signal.manager.api.UnregisteredRecipientException;
|
||||
import org.asamk.signal.manager.api.UpdateGroup;
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupNotFoundException;
|
||||
import org.asamk.signal.manager.groups.GroupSendingNotAllowedException;
|
||||
import org.asamk.signal.manager.groups.LastGroupAdminException;
|
||||
import org.asamk.signal.manager.groups.NotAGroupMemberException;
|
||||
import org.asamk.signal.manager.storage.recipients.Contact;
|
||||
import org.asamk.signal.manager.storage.recipients.Profile;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||
import org.asamk.signal.manager.api.UpdateProfile;
|
||||
import org.asamk.signal.manager.api.UserStatus;
|
||||
import org.asamk.signal.manager.api.UsernameLinkUrl;
|
||||
import org.asamk.signal.manager.api.UsernameStatus;
|
||||
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.io.InputStream;
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface Manager extends Closeable {
|
||||
|
||||
static boolean isValidNumber(final String e164Number, final String countryCode) {
|
||||
return PhoneNumberFormatter.isValidNumber(e164Number, countryCode);
|
||||
return PhoneNumberUtil.getInstance().isPossibleNumber(e164Number, countryCode);
|
||||
}
|
||||
|
||||
static boolean isSignalClientAvailable() {
|
||||
final Logger logger = LoggerFactory.getLogger(Manager.class);
|
||||
try {
|
||||
try {
|
||||
org.signal.libsignal.internal.Native.UuidCiphertext_CheckValidContents(new byte[0]);
|
||||
} catch (Exception e) {
|
||||
logger.trace("Expected exception when checking libsignal-client: {}", e.getMessage());
|
||||
}
|
||||
return true;
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
logger.warn("Failed to call libsignal-client: {}", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
String getSelfNumber();
|
||||
@ -58,79 +98,124 @@ public interface Manager extends Closeable {
|
||||
* @return A map of numbers to canonicalized number and uuid. If a number is not registered the uuid is null.
|
||||
* @throws IOException if it's unable to get the contacts to check if they're registered
|
||||
*/
|
||||
Map<String, Pair<String, UUID>> areUsersRegistered(Set<String> numbers) throws IOException;
|
||||
Map<String, UserStatus> getUserStatus(Set<String> numbers) throws IOException, RateLimitException;
|
||||
|
||||
void updateAccountAttributes(String deviceName) throws IOException;
|
||||
Map<String, UsernameStatus> getUsernameStatus(Set<String> usernames) throws IOException;
|
||||
|
||||
void updateAccountAttributes(
|
||||
String deviceName,
|
||||
Boolean unrestrictedUnidentifiedSender,
|
||||
final Boolean discoverableByNumber,
|
||||
final Boolean numberSharing
|
||||
) throws IOException;
|
||||
|
||||
Configuration getConfiguration();
|
||||
|
||||
void updateConfiguration(Configuration configuration) throws IOException, NotMasterDeviceException;
|
||||
void updateConfiguration(Configuration configuration) throws NotPrimaryDeviceException;
|
||||
|
||||
/**
|
||||
* @param givenName if null, the previous givenName will be kept
|
||||
* @param familyName if null, the previous familyName will be kept
|
||||
* @param about if null, the previous about text will be kept
|
||||
* @param aboutEmoji if null, the previous about emoji will be kept
|
||||
* @param avatar if avatar is null the image from the local avatar store is used (if present),
|
||||
* Update the user's profile.
|
||||
* If a field is null, the previous value will be kept.
|
||||
*/
|
||||
void setProfile(
|
||||
String givenName, String familyName, String about, String aboutEmoji, Optional<File> avatar
|
||||
) throws IOException;
|
||||
void updateProfile(UpdateProfile updateProfile) throws IOException;
|
||||
|
||||
String getUsername();
|
||||
|
||||
UsernameLinkUrl getUsernameLink();
|
||||
|
||||
/**
|
||||
* Set a username for the account.
|
||||
* If the username is null, it will be deleted.
|
||||
*/
|
||||
void setUsername(String username) throws IOException, InvalidUsernameException;
|
||||
|
||||
/**
|
||||
* Set a username for the account.
|
||||
* If the username is null, it will be deleted.
|
||||
*/
|
||||
void deleteUsername() throws IOException;
|
||||
|
||||
void startChangeNumber(
|
||||
String newNumber,
|
||||
boolean voiceVerification,
|
||||
String captcha
|
||||
) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethodNotAvailableException;
|
||||
|
||||
void finishChangeNumber(
|
||||
String newNumber,
|
||||
String verificationCode,
|
||||
String pin
|
||||
) throws IncorrectPinException, PinLockedException, IOException, NotPrimaryDeviceException, PinLockMissingException;
|
||||
|
||||
void unregister() throws IOException;
|
||||
|
||||
void deleteAccount() throws IOException;
|
||||
|
||||
void submitRateLimitRecaptchaChallenge(String challenge, String captcha) throws IOException;
|
||||
void submitRateLimitRecaptchaChallenge(
|
||||
String challenge,
|
||||
String captcha
|
||||
) throws IOException, CaptchaRejectedException;
|
||||
|
||||
List<Device> getLinkedDevices() throws IOException;
|
||||
|
||||
void removeLinkedDevices(int deviceId) throws IOException;
|
||||
void updateLinkedDevice(int deviceId, String name) throws IOException, NotPrimaryDeviceException;
|
||||
|
||||
void addDeviceLink(URI linkUri) throws IOException, InvalidDeviceLinkException;
|
||||
void removeLinkedDevices(int deviceId) throws IOException, NotPrimaryDeviceException;
|
||||
|
||||
void setRegistrationLockPin(Optional<String> pin) throws IOException, NotMasterDeviceException;
|
||||
void addDeviceLink(DeviceLinkUrl linkUri) throws IOException, InvalidDeviceLinkException, NotPrimaryDeviceException, DeviceLimitExceededException;
|
||||
|
||||
Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException;
|
||||
void setRegistrationLockPin(Optional<String> pin) throws IOException, NotPrimaryDeviceException;
|
||||
|
||||
List<Group> getGroups();
|
||||
|
||||
List<Group> getGroups(Collection<GroupId> groupIds);
|
||||
|
||||
SendGroupMessageResults quitGroup(
|
||||
GroupId groupId, Set<RecipientIdentifier.Single> groupAdmins
|
||||
GroupId groupId,
|
||||
Set<RecipientIdentifier.Single> groupAdmins
|
||||
) throws GroupNotFoundException, IOException, NotAGroupMemberException, LastGroupAdminException, UnregisteredRecipientException;
|
||||
|
||||
void deleteGroup(GroupId groupId) throws IOException;
|
||||
|
||||
Pair<GroupId, SendGroupMessageResults> createGroup(
|
||||
String name, Set<RecipientIdentifier.Single> members, File avatarFile
|
||||
String name,
|
||||
Set<RecipientIdentifier.Single> members,
|
||||
String avatarFile
|
||||
) throws IOException, AttachmentInvalidException, UnregisteredRecipientException;
|
||||
|
||||
SendGroupMessageResults updateGroup(
|
||||
final GroupId groupId, final UpdateGroup updateGroup
|
||||
final GroupId groupId,
|
||||
final UpdateGroup updateGroup
|
||||
) throws IOException, GroupNotFoundException, AttachmentInvalidException, NotAGroupMemberException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
Pair<GroupId, SendGroupMessageResults> joinGroup(
|
||||
GroupInviteLinkUrl inviteLinkUrl
|
||||
) throws IOException, InactiveGroupLinkException;
|
||||
) throws IOException, InactiveGroupLinkException, PendingAdminApprovalException;
|
||||
|
||||
SendMessageResults sendTypingMessage(
|
||||
TypingAction action, Set<RecipientIdentifier> recipients
|
||||
TypingAction action,
|
||||
Set<RecipientIdentifier> recipients
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException;
|
||||
|
||||
SendMessageResults sendReadReceipt(
|
||||
RecipientIdentifier.Single sender, List<Long> messageIds
|
||||
) throws IOException;
|
||||
SendMessageResults sendReadReceipt(RecipientIdentifier.Single sender, List<Long> messageIds);
|
||||
|
||||
SendMessageResults sendViewedReceipt(
|
||||
RecipientIdentifier.Single sender, List<Long> messageIds
|
||||
) throws IOException;
|
||||
SendMessageResults sendViewedReceipt(RecipientIdentifier.Single sender, List<Long> messageIds);
|
||||
|
||||
SendMessageResults sendMessage(
|
||||
Message message, Set<RecipientIdentifier> recipients
|
||||
Message message,
|
||||
Set<RecipientIdentifier> recipients,
|
||||
boolean notifySelf
|
||||
) throws IOException, AttachmentInvalidException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException, InvalidStickerException;
|
||||
|
||||
SendMessageResults sendEditMessage(
|
||||
Message message,
|
||||
Set<RecipientIdentifier> recipients,
|
||||
long editTargetTimestamp
|
||||
) throws IOException, AttachmentInvalidException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException, InvalidStickerException;
|
||||
|
||||
SendMessageResults sendRemoteDeleteMessage(
|
||||
long targetSentTimestamp, Set<RecipientIdentifier> recipients
|
||||
long targetSentTimestamp,
|
||||
Set<RecipientIdentifier> recipients
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException;
|
||||
|
||||
SendMessageResults sendMessageReaction(
|
||||
@ -138,32 +223,103 @@ public interface Manager extends Closeable {
|
||||
boolean remove,
|
||||
RecipientIdentifier.Single targetAuthor,
|
||||
long targetSentTimestamp,
|
||||
Set<RecipientIdentifier> recipients
|
||||
Set<RecipientIdentifier> recipients,
|
||||
final boolean notifySelf,
|
||||
final boolean isStory
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException;
|
||||
SendMessageResults sendAdminDelete(
|
||||
RecipientIdentifier.Single targetAuthor,
|
||||
long targetSentTimestamp,
|
||||
Set<RecipientIdentifier.Group> recipients,
|
||||
boolean notifySelf,
|
||||
boolean isStory
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendPinMessage(
|
||||
int pinDuration,
|
||||
RecipientIdentifier.Single targetAuthor,
|
||||
long targetSentTimestamp,
|
||||
Set<RecipientIdentifier> recipients,
|
||||
boolean notifySelf,
|
||||
boolean isStory
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendUnpinMessage(
|
||||
RecipientIdentifier.Single targetAuthor,
|
||||
long targetSentTimestamp,
|
||||
Set<RecipientIdentifier> recipients,
|
||||
boolean notifySelf,
|
||||
boolean isStory
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendPaymentNotificationMessage(
|
||||
byte[] receipt,
|
||||
String note,
|
||||
RecipientIdentifier.Single recipient
|
||||
) throws IOException;
|
||||
|
||||
void sendEndSessionMessage(Set<RecipientIdentifier.Single> recipients) throws IOException;
|
||||
|
||||
SendMessageResults sendMessageRequestResponse(
|
||||
MessageEnvelope.Sync.MessageRequestResponse.Type type,
|
||||
Set<RecipientIdentifier> recipientIdentifiers
|
||||
);
|
||||
|
||||
SendMessageResults sendPollCreateMessage(
|
||||
final String question,
|
||||
final boolean allowMultiple,
|
||||
final List<String> options,
|
||||
final Set<RecipientIdentifier> recipients,
|
||||
final boolean notifySelf
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendPollVoteMessage(
|
||||
final RecipientIdentifier.Single targetAuthor,
|
||||
final long targetSentTimestamp,
|
||||
final List<Integer> optionIndexes,
|
||||
final int voteCount,
|
||||
final Set<RecipientIdentifier> recipients,
|
||||
final boolean notifySelf
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
SendMessageResults sendPollTerminateMessage(
|
||||
final long targetSentTimestamp,
|
||||
final Set<RecipientIdentifier> recipients,
|
||||
final boolean notifySelf
|
||||
) throws IOException, NotAGroupMemberException, GroupNotFoundException, GroupSendingNotAllowedException, UnregisteredRecipientException;
|
||||
|
||||
void hideRecipient(RecipientIdentifier.Single recipient);
|
||||
|
||||
void deleteRecipient(RecipientIdentifier.Single recipient);
|
||||
|
||||
void deleteContact(RecipientIdentifier.Single recipient);
|
||||
|
||||
void setContactName(
|
||||
RecipientIdentifier.Single recipient, String name
|
||||
) throws NotMasterDeviceException, IOException, UnregisteredRecipientException;
|
||||
final RecipientIdentifier.Single recipient,
|
||||
final String givenName,
|
||||
final String familyName,
|
||||
final String nickGivenName,
|
||||
final String nickFamilyName,
|
||||
final String note
|
||||
) throws UnregisteredRecipientException;
|
||||
|
||||
void setContactBlocked(
|
||||
RecipientIdentifier.Single recipient, boolean blocked
|
||||
) throws NotMasterDeviceException, IOException, UnregisteredRecipientException;
|
||||
void setContactsBlocked(
|
||||
Collection<RecipientIdentifier.Single> recipient,
|
||||
boolean blocked
|
||||
) throws NotPrimaryDeviceException, IOException, UnregisteredRecipientException;
|
||||
|
||||
void setGroupBlocked(
|
||||
GroupId groupId, boolean blocked
|
||||
) throws GroupNotFoundException, IOException, NotMasterDeviceException;
|
||||
void setGroupsBlocked(
|
||||
Collection<GroupId> groupId,
|
||||
boolean blocked
|
||||
) throws GroupNotFoundException, IOException, NotPrimaryDeviceException;
|
||||
|
||||
/**
|
||||
* Change the expiration timer for a contact
|
||||
*/
|
||||
void setExpirationTimer(
|
||||
RecipientIdentifier.Single recipient, int messageExpirationTimer
|
||||
RecipientIdentifier.Single recipient,
|
||||
int messageExpirationTimer
|
||||
) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
/**
|
||||
@ -174,6 +330,8 @@ public interface Manager extends Closeable {
|
||||
*/
|
||||
StickerPackUrl uploadStickerPack(File path) throws IOException, StickerPackInvalidException;
|
||||
|
||||
void installStickerPack(StickerPackUrl url) throws IOException;
|
||||
|
||||
List<StickerPack> getStickerPacks();
|
||||
|
||||
void requestAllSyncData() throws IOException;
|
||||
@ -199,22 +357,26 @@ public interface Manager extends Closeable {
|
||||
/**
|
||||
* Receive new messages from server, returns if no new message arrive in a timespan of timeout.
|
||||
*/
|
||||
void receiveMessages(Duration timeout, ReceiveMessageHandler handler) throws IOException;
|
||||
void receiveMessages(
|
||||
Optional<Duration> timeout,
|
||||
Optional<Integer> maxMessages,
|
||||
ReceiveMessageHandler handler
|
||||
) throws IOException, AlreadyReceivingException;
|
||||
|
||||
/**
|
||||
* Receive new messages from server, returns only if the thread is interrupted.
|
||||
*/
|
||||
void receiveMessages(ReceiveMessageHandler handler) throws IOException;
|
||||
void stopReceiveMessages();
|
||||
|
||||
void setIgnoreAttachments(boolean ignoreAttachments);
|
||||
|
||||
boolean hasCaughtUpWithOldMessages();
|
||||
void setReceiveConfig(ReceiveConfig receiveConfig);
|
||||
|
||||
boolean isContactBlocked(RecipientIdentifier.Single recipient);
|
||||
|
||||
void sendContacts() throws IOException;
|
||||
|
||||
List<Pair<RecipientAddress, Contact>> getContacts();
|
||||
List<Recipient> getRecipients(
|
||||
boolean onlyContacts,
|
||||
Optional<Boolean> blocked,
|
||||
Collection<RecipientIdentifier.Single> address,
|
||||
Optional<String> name
|
||||
);
|
||||
|
||||
String getContactOrProfileName(RecipientIdentifier.Single recipient);
|
||||
|
||||
@ -225,33 +387,13 @@ public interface Manager extends Closeable {
|
||||
List<Identity> getIdentities(RecipientIdentifier.Single recipient);
|
||||
|
||||
/**
|
||||
* Trust this the identity with this fingerprint
|
||||
* Trust this the identity with this fingerprint/safetyNumber
|
||||
*
|
||||
* @param recipient account of the identity
|
||||
* @param fingerprint Fingerprint
|
||||
* @param recipient account of the identity
|
||||
*/
|
||||
boolean trustIdentityVerified(
|
||||
RecipientIdentifier.Single recipient, byte[] fingerprint
|
||||
) throws UnregisteredRecipientException;
|
||||
|
||||
/**
|
||||
* Trust this the identity with this safety number
|
||||
*
|
||||
* @param recipient account of the identity
|
||||
* @param safetyNumber Safety number
|
||||
*/
|
||||
boolean trustIdentityVerifiedSafetyNumber(
|
||||
RecipientIdentifier.Single recipient, String safetyNumber
|
||||
) throws UnregisteredRecipientException;
|
||||
|
||||
/**
|
||||
* Trust this the identity with this scannable safety number
|
||||
*
|
||||
* @param recipient account of the identity
|
||||
* @param safetyNumber Scannable safety number
|
||||
*/
|
||||
boolean trustIdentityVerifiedSafetyNumber(
|
||||
RecipientIdentifier.Single recipient, byte[] safetyNumber
|
||||
RecipientIdentifier.Single recipient,
|
||||
IdentityVerificationCode verificationCode
|
||||
) throws UnregisteredRecipientException;
|
||||
|
||||
/**
|
||||
@ -265,8 +407,61 @@ public interface Manager extends Closeable {
|
||||
|
||||
void addClosedListener(Runnable listener);
|
||||
|
||||
InputStream retrieveAttachment(final String id) throws IOException;
|
||||
|
||||
InputStream retrieveContactAvatar(final RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
InputStream retrieveProfileAvatar(final RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
InputStream retrieveGroupAvatar(final GroupId groupId) throws IOException;
|
||||
|
||||
InputStream retrieveSticker(final StickerPackId stickerPackId, final int stickerId) throws IOException;
|
||||
|
||||
// --- Voice call methods ---
|
||||
|
||||
CallInfo startCall(RecipientIdentifier.Single recipient) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
CallInfo acceptCall(long callId) throws IOException;
|
||||
|
||||
void hangupCall(long callId) throws IOException;
|
||||
|
||||
SendMessageResult rejectCall(long callId) throws IOException;
|
||||
|
||||
List<CallInfo> listActiveCalls();
|
||||
|
||||
void sendCallOffer(
|
||||
RecipientIdentifier.Single recipient,
|
||||
CallOffer offer
|
||||
) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
void sendCallAnswer(
|
||||
RecipientIdentifier.Single recipient,
|
||||
long callId,
|
||||
byte[] answerOpaque
|
||||
) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
void sendIceUpdate(
|
||||
RecipientIdentifier.Single recipient,
|
||||
long callId,
|
||||
List<byte[]> iceCandidates
|
||||
) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
void sendHangup(
|
||||
RecipientIdentifier.Single recipient,
|
||||
long callId,
|
||||
MessageEnvelope.Call.Hangup.Type type
|
||||
) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
void sendBusy(RecipientIdentifier.Single recipient, long callId) throws IOException, UnregisteredRecipientException;
|
||||
|
||||
List<TurnServer> getTurnServerInfo() throws IOException;
|
||||
|
||||
@Override
|
||||
void close() throws IOException;
|
||||
void close();
|
||||
|
||||
void addCallEventListener(CallEventListener listener);
|
||||
|
||||
void removeCallEventListener(CallEventListener listener);
|
||||
|
||||
interface ReceiveMessageHandler {
|
||||
|
||||
@ -275,4 +470,9 @@ public interface Manager extends Closeable {
|
||||
|
||||
void handleMessage(MessageEnvelope envelope, Throwable e);
|
||||
}
|
||||
|
||||
interface CallEventListener {
|
||||
|
||||
void handleCallEvent(CallInfo callInfo, String reason);
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,12 @@
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.internal.LibSignalLogger;
|
||||
import org.asamk.signal.manager.internal.SignalLogger;
|
||||
|
||||
public class ManagerLogger {
|
||||
|
||||
public static void initLogger() {
|
||||
LibSignalLogger.initLogger();
|
||||
SignalLogger.initLogger();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,16 +2,29 @@ package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||
import org.asamk.signal.manager.api.IncorrectPinException;
|
||||
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||
import org.asamk.signal.manager.api.PinLockMissingException;
|
||||
import org.asamk.signal.manager.api.PinLockedException;
|
||||
import org.asamk.signal.manager.api.RateLimitException;
|
||||
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
public interface RegistrationManager extends Closeable {
|
||||
|
||||
void register(boolean voiceVerification, String captcha) throws IOException, CaptchaRequiredException;
|
||||
void register(
|
||||
boolean voiceVerification,
|
||||
String captcha,
|
||||
final boolean forceRegister
|
||||
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethodNotAvailableException;
|
||||
|
||||
void verifyAccount(
|
||||
String verificationCode, String pin
|
||||
) throws IOException, PinLockedException, IncorrectPinException;
|
||||
String verificationCode,
|
||||
String pin
|
||||
) throws IOException, PinLockedException, IncorrectPinException, PinLockMissingException;
|
||||
|
||||
void deleteLocalAccountData() throws IOException;
|
||||
|
||||
boolean isRegistered();
|
||||
}
|
||||
|
||||
@ -1,217 +0,0 @@
|
||||
/*
|
||||
Copyright (C) 2015-2022 AsamK and contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||
import org.asamk.signal.manager.api.IncorrectPinException;
|
||||
import org.asamk.signal.manager.api.PinLockedException;
|
||||
import org.asamk.signal.manager.config.ServiceConfig;
|
||||
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
||||
import org.asamk.signal.manager.helper.AccountFileUpdater;
|
||||
import org.asamk.signal.manager.helper.PinHelper;
|
||||
import org.asamk.signal.manager.storage.SignalAccount;
|
||||
import org.asamk.signal.manager.util.NumberVerificationUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
|
||||
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
|
||||
import org.whispersystems.signalservice.api.push.ACI;
|
||||
import org.whispersystems.signalservice.api.push.PNI;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.internal.ServiceResponse;
|
||||
import org.whispersystems.signalservice.internal.push.VerifyAccountResponse;
|
||||
import org.whispersystems.signalservice.internal.util.DynamicCredentialsProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.capabilities;
|
||||
|
||||
class RegistrationManagerImpl implements RegistrationManager {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(RegistrationManagerImpl.class);
|
||||
|
||||
private SignalAccount account;
|
||||
private final PathConfig pathConfig;
|
||||
private final ServiceEnvironmentConfig serviceEnvironmentConfig;
|
||||
private final String userAgent;
|
||||
private final Consumer<Manager> newManagerListener;
|
||||
|
||||
private final SignalServiceAccountManager accountManager;
|
||||
private final PinHelper pinHelper;
|
||||
private final AccountFileUpdater accountFileUpdater;
|
||||
|
||||
RegistrationManagerImpl(
|
||||
SignalAccount account,
|
||||
PathConfig pathConfig,
|
||||
ServiceEnvironmentConfig serviceEnvironmentConfig,
|
||||
String userAgent,
|
||||
Consumer<Manager> newManagerListener,
|
||||
AccountFileUpdater accountFileUpdater
|
||||
) {
|
||||
this.account = account;
|
||||
this.pathConfig = pathConfig;
|
||||
this.accountFileUpdater = accountFileUpdater;
|
||||
this.serviceEnvironmentConfig = serviceEnvironmentConfig;
|
||||
this.userAgent = userAgent;
|
||||
this.newManagerListener = newManagerListener;
|
||||
|
||||
GroupsV2Operations groupsV2Operations;
|
||||
try {
|
||||
groupsV2Operations = new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.getSignalServiceConfiguration()),
|
||||
ServiceConfig.GROUP_MAX_SIZE);
|
||||
} catch (Throwable ignored) {
|
||||
groupsV2Operations = null;
|
||||
}
|
||||
this.accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
new DynamicCredentialsProvider(
|
||||
// Using empty UUID, because registering doesn't work otherwise
|
||||
null, null, account.getNumber(), account.getPassword(), SignalServiceAddress.DEFAULT_DEVICE_ID),
|
||||
userAgent,
|
||||
groupsV2Operations,
|
||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY);
|
||||
final var keyBackupService = accountManager.getKeyBackupService(ServiceConfig.getIasKeyStore(),
|
||||
serviceEnvironmentConfig.getKeyBackupConfig().getEnclaveName(),
|
||||
serviceEnvironmentConfig.getKeyBackupConfig().getServiceId(),
|
||||
serviceEnvironmentConfig.getKeyBackupConfig().getMrenclave(),
|
||||
10);
|
||||
this.pinHelper = new PinHelper(keyBackupService);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register(boolean voiceVerification, String captcha) throws IOException, CaptchaRequiredException {
|
||||
if (account.getAci() != null && attemptReactivateAccount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
NumberVerificationUtils.requestVerificationCode(accountManager, captcha, voiceVerification);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void verifyAccount(
|
||||
String verificationCode, String pin
|
||||
) throws IOException, PinLockedException, IncorrectPinException {
|
||||
final var result = NumberVerificationUtils.verifyNumber(verificationCode,
|
||||
pin,
|
||||
pinHelper,
|
||||
this::verifyAccountWithCode);
|
||||
final var response = result.first();
|
||||
final var masterKey = result.second();
|
||||
if (masterKey == null) {
|
||||
pin = null;
|
||||
}
|
||||
|
||||
//accountManager.setGcmId(Optional.of(GoogleCloudMessaging.getInstance(this).register(REGISTRATION_ID)));
|
||||
final var aci = ACI.parseOrNull(response.getUuid());
|
||||
final var pni = PNI.parseOrNull(response.getPni());
|
||||
account.finishRegistration(aci, pni, masterKey, pin);
|
||||
accountFileUpdater.updateAccountIdentifiers(account.getNumber(), aci);
|
||||
|
||||
ManagerImpl m = null;
|
||||
try {
|
||||
m = new ManagerImpl(account, pathConfig, accountFileUpdater, serviceEnvironmentConfig, userAgent);
|
||||
account = null;
|
||||
|
||||
m.refreshPreKeys();
|
||||
if (response.isStorageCapable()) {
|
||||
m.retrieveRemoteStorage();
|
||||
}
|
||||
// Set an initial empty profile so user can be added to groups
|
||||
try {
|
||||
m.setProfile(null, null, null, null, null);
|
||||
} catch (NoClassDefFoundError e) {
|
||||
logger.warn("Failed to set default profile: {}", e.getMessage());
|
||||
}
|
||||
|
||||
if (newManagerListener != null) {
|
||||
newManagerListener.accept(m);
|
||||
m = null;
|
||||
}
|
||||
} finally {
|
||||
if (m != null) {
|
||||
m.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean attemptReactivateAccount() {
|
||||
try {
|
||||
final var accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
account.getCredentialsProvider(),
|
||||
userAgent,
|
||||
null,
|
||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY);
|
||||
accountManager.setAccountAttributes(null,
|
||||
account.getLocalRegistrationId(),
|
||||
true,
|
||||
null,
|
||||
account.getPinMasterKey() == null ? null : account.getPinMasterKey().deriveRegistrationLock(),
|
||||
account.getSelfUnidentifiedAccessKey(),
|
||||
account.isUnrestrictedUnidentifiedAccess(),
|
||||
capabilities,
|
||||
account.isDiscoverableByPhoneNumber(),
|
||||
account.getEncryptedDeviceName());
|
||||
account.setRegistered(true);
|
||||
logger.info("Reactivated existing account, verify is not necessary.");
|
||||
if (newManagerListener != null) {
|
||||
final var m = new ManagerImpl(account,
|
||||
pathConfig,
|
||||
accountFileUpdater,
|
||||
serviceEnvironmentConfig,
|
||||
userAgent);
|
||||
account = null;
|
||||
newManagerListener.accept(m);
|
||||
}
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
logger.debug("Failed to reactivate account");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private ServiceResponse<VerifyAccountResponse> verifyAccountWithCode(
|
||||
final String verificationCode, final String registrationLock
|
||||
) {
|
||||
if (registrationLock == null) {
|
||||
return accountManager.verifyAccount(verificationCode,
|
||||
account.getLocalRegistrationId(),
|
||||
true,
|
||||
account.getSelfUnidentifiedAccessKey(),
|
||||
account.isUnrestrictedUnidentifiedAccess(),
|
||||
ServiceConfig.capabilities,
|
||||
account.isDiscoverableByPhoneNumber());
|
||||
} else {
|
||||
return accountManager.verifyAccountWithRegistrationLockPin(verificationCode,
|
||||
account.getLocalRegistrationId(),
|
||||
true,
|
||||
registrationLock,
|
||||
account.getSelfUnidentifiedAccessKey(),
|
||||
account.isUnrestrictedUnidentifiedAccess(),
|
||||
ServiceConfig.capabilities,
|
||||
account.isDiscoverableByPhoneNumber());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (account != null) {
|
||||
account.close();
|
||||
account = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
8
lib/src/main/java/org/asamk/signal/manager/Settings.java
Normal file
8
lib/src/main/java/org/asamk/signal/manager/Settings.java
Normal file
@ -0,0 +1,8 @@
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.api.TrustNewIdentity;
|
||||
|
||||
public record Settings(TrustNewIdentity trustNewIdentity, boolean disableMessageSendLog) {
|
||||
|
||||
public static final Settings DEFAULT = new Settings(TrustNewIdentity.ON_FIRST_USE, false);
|
||||
}
|
||||
@ -2,16 +2,22 @@ package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.api.AccountCheckException;
|
||||
import org.asamk.signal.manager.api.NotRegisteredException;
|
||||
import org.asamk.signal.manager.api.Pair;
|
||||
import org.asamk.signal.manager.api.ServiceEnvironment;
|
||||
import org.asamk.signal.manager.config.ServiceConfig;
|
||||
import org.asamk.signal.manager.config.ServiceEnvironment;
|
||||
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
||||
import org.asamk.signal.manager.internal.AccountFileUpdaterImpl;
|
||||
import org.asamk.signal.manager.internal.ManagerImpl;
|
||||
import org.asamk.signal.manager.internal.MultiAccountManagerImpl;
|
||||
import org.asamk.signal.manager.internal.PathConfig;
|
||||
import org.asamk.signal.manager.internal.ProvisioningManagerImpl;
|
||||
import org.asamk.signal.manager.internal.RegistrationManagerImpl;
|
||||
import org.asamk.signal.manager.storage.SignalAccount;
|
||||
import org.asamk.signal.manager.storage.accounts.AccountsStore;
|
||||
import org.asamk.signal.manager.storage.identities.TrustNewIdentity;
|
||||
import org.asamk.signal.manager.util.KeyUtils;
|
||||
import org.signal.libsignal.protocol.util.KeyHelper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.signalservice.api.push.exceptions.DeprecatedVersionException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@ -24,38 +30,63 @@ public class SignalAccountFiles {
|
||||
private static final Logger logger = LoggerFactory.getLogger(MultiAccountManager.class);
|
||||
|
||||
private final PathConfig pathConfig;
|
||||
private final ServiceEnvironment serviceEnvironment;
|
||||
private final ServiceEnvironmentConfig serviceEnvironmentConfig;
|
||||
private final String userAgent;
|
||||
private final TrustNewIdentity trustNewIdentity;
|
||||
private final Settings settings;
|
||||
private final AccountsStore accountsStore;
|
||||
|
||||
public SignalAccountFiles(
|
||||
final File settingsPath,
|
||||
final ServiceEnvironment serviceEnvironment,
|
||||
final String userAgent,
|
||||
final TrustNewIdentity trustNewIdentity
|
||||
final Settings settings
|
||||
) throws IOException {
|
||||
this.pathConfig = PathConfig.createDefault(settingsPath);
|
||||
this.serviceEnvironmentConfig = ServiceConfig.getServiceEnvironmentConfig(serviceEnvironment, userAgent);
|
||||
this.serviceEnvironment = serviceEnvironment;
|
||||
this.serviceEnvironmentConfig = ServiceConfig.getServiceEnvironmentConfig(this.serviceEnvironment, userAgent);
|
||||
this.userAgent = userAgent;
|
||||
this.trustNewIdentity = trustNewIdentity;
|
||||
this.accountsStore = new AccountsStore(pathConfig.dataPath());
|
||||
this.settings = settings;
|
||||
this.accountsStore = new AccountsStore(pathConfig.dataPath(), serviceEnvironment, accountPath -> {
|
||||
if (accountPath == null || !SignalAccount.accountFileExists(pathConfig.dataPath(), accountPath)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
return SignalAccount.load(pathConfig.dataPath(), accountPath, false, settings);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Set<String> getAllLocalAccountNumbers() {
|
||||
public Set<String> getAllLocalAccountNumbers() throws IOException {
|
||||
return accountsStore.getAllNumbers();
|
||||
}
|
||||
|
||||
public MultiAccountManager initMultiAccountManager() {
|
||||
final var managers = accountsStore.getAllAccounts().parallelStream().map(a -> {
|
||||
public MultiAccountManager initMultiAccountManager() throws IOException {
|
||||
final var managerPairs = accountsStore.getAllAccounts().parallelStream().map(a -> {
|
||||
try {
|
||||
return initManager(a.number(), a.path());
|
||||
} catch (NotRegisteredException | IOException | AccountCheckException e) {
|
||||
return new Pair<Manager, Throwable>(initManager(a.number(), a.path()), null);
|
||||
} catch (NotRegisteredException e) {
|
||||
logger.warn("Ignoring {}: {} ({})", a.number(), e.getMessage(), e.getClass().getSimpleName());
|
||||
return null;
|
||||
} catch (AccountCheckException | IOException e) {
|
||||
logger.error("Failed to load {}: {} ({})", a.number(), e.getMessage(), e.getClass().getSimpleName());
|
||||
return new Pair<Manager, Throwable>(null, e);
|
||||
}
|
||||
}).filter(Objects::nonNull).toList();
|
||||
|
||||
for (final var pair : managerPairs) {
|
||||
if (pair.second() instanceof IOException e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
final var managers = managerPairs.stream()
|
||||
.filter(p -> p != null && p.first() != null)
|
||||
.map(Pair::first)
|
||||
.toList();
|
||||
return new MultiAccountManagerImpl(managers, this);
|
||||
}
|
||||
|
||||
@ -65,7 +96,8 @@ public class SignalAccountFiles {
|
||||
}
|
||||
|
||||
private Manager initManager(
|
||||
String number, String accountPath
|
||||
String number,
|
||||
String accountPath
|
||||
) throws IOException, NotRegisteredException, AccountCheckException {
|
||||
if (accountPath == null) {
|
||||
throw new NotRegisteredException();
|
||||
@ -74,7 +106,7 @@ public class SignalAccountFiles {
|
||||
throw new NotRegisteredException();
|
||||
}
|
||||
|
||||
var account = SignalAccount.load(pathConfig.dataPath(), accountPath, true, trustNewIdentity);
|
||||
var account = SignalAccount.load(pathConfig.dataPath(), accountPath, true, settings);
|
||||
if (!number.equals(account.getNumber())) {
|
||||
account.close();
|
||||
throw new IOException("Number in account file doesn't match expected number: " + account.getNumber());
|
||||
@ -85,21 +117,33 @@ public class SignalAccountFiles {
|
||||
throw new NotRegisteredException();
|
||||
}
|
||||
|
||||
if (account.getServiceEnvironment() != null && account.getServiceEnvironment() != serviceEnvironment) {
|
||||
throw new IOException("Account is registered in another environment: " + account.getServiceEnvironment());
|
||||
}
|
||||
|
||||
account.initDatabase();
|
||||
|
||||
final var manager = new ManagerImpl(account,
|
||||
pathConfig,
|
||||
(newNumber, newAci) -> accountsStore.updateAccount(accountPath, newNumber, newAci),
|
||||
new AccountFileUpdaterImpl(accountsStore, accountPath),
|
||||
serviceEnvironmentConfig,
|
||||
userAgent);
|
||||
|
||||
try {
|
||||
manager.checkAccountState();
|
||||
} catch (DeprecatedVersionException e) {
|
||||
manager.close();
|
||||
throw new IOException("signal-cli version is too old for the Signal-Server, please update.");
|
||||
} catch (IOException e) {
|
||||
manager.close();
|
||||
throw new AccountCheckException("Error while checking account " + number + ": " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
if (account.getServiceEnvironment() == null) {
|
||||
account.setServiceEnvironment(serviceEnvironment);
|
||||
accountsStore.updateAccount(accountPath, account.getNumber(), account.getAci());
|
||||
}
|
||||
|
||||
return manager;
|
||||
}
|
||||
|
||||
@ -120,44 +164,46 @@ public class SignalAccountFiles {
|
||||
}
|
||||
|
||||
public RegistrationManager initRegistrationManager(
|
||||
String number, Consumer<Manager> newManagerListener
|
||||
String number,
|
||||
Consumer<Manager> newManagerListener
|
||||
) throws IOException {
|
||||
final var accountPath = accountsStore.getPathByNumber(number);
|
||||
if (accountPath == null || !SignalAccount.accountFileExists(pathConfig.dataPath(), accountPath)) {
|
||||
final var newAccountPath = accountPath == null ? accountsStore.addAccount(number, null) : accountPath;
|
||||
var aciIdentityKey = KeyUtils.generateIdentityKeyPair();
|
||||
var pniIdentityKey = KeyUtils.generateIdentityKeyPair();
|
||||
var registrationId = KeyHelper.generateRegistrationId(false);
|
||||
|
||||
var profileKey = KeyUtils.createProfileKey();
|
||||
var account = SignalAccount.create(pathConfig.dataPath(),
|
||||
newAccountPath,
|
||||
number,
|
||||
serviceEnvironment,
|
||||
aciIdentityKey,
|
||||
pniIdentityKey,
|
||||
registrationId,
|
||||
profileKey,
|
||||
trustNewIdentity);
|
||||
settings);
|
||||
account.initDatabase();
|
||||
|
||||
return new RegistrationManagerImpl(account,
|
||||
pathConfig,
|
||||
serviceEnvironmentConfig,
|
||||
userAgent,
|
||||
newManagerListener,
|
||||
(newNumber, newAci) -> accountsStore.updateAccount(newAccountPath, newNumber, newAci));
|
||||
new AccountFileUpdaterImpl(accountsStore, newAccountPath));
|
||||
}
|
||||
|
||||
var account = SignalAccount.load(pathConfig.dataPath(), accountPath, true, trustNewIdentity);
|
||||
var account = SignalAccount.load(pathConfig.dataPath(), accountPath, true, settings);
|
||||
if (!number.equals(account.getNumber())) {
|
||||
account.close();
|
||||
throw new IOException("Number in account file doesn't match expected number: " + account.getNumber());
|
||||
}
|
||||
account.initDatabase();
|
||||
|
||||
return new RegistrationManagerImpl(account,
|
||||
pathConfig,
|
||||
serviceEnvironmentConfig,
|
||||
userAgent,
|
||||
newManagerListener,
|
||||
(newNumber, newAci) -> accountsStore.updateAccount(accountPath, newNumber, newAci));
|
||||
new AccountFileUpdaterImpl(accountsStore, accountPath));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,222 +0,0 @@
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import org.asamk.signal.manager.config.ServiceConfig;
|
||||
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
||||
import org.signal.libsignal.metadata.certificate.CertificateValidator;
|
||||
import org.signal.libsignal.zkgroup.profiles.ClientZkProfileOperations;
|
||||
import org.whispersystems.signalservice.api.KeyBackupService;
|
||||
import org.whispersystems.signalservice.api.SignalServiceAccountManager;
|
||||
import org.whispersystems.signalservice.api.SignalServiceDataStore;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageReceiver;
|
||||
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
|
||||
import org.whispersystems.signalservice.api.SignalSessionLock;
|
||||
import org.whispersystems.signalservice.api.SignalWebSocket;
|
||||
import org.whispersystems.signalservice.api.crypto.SignalServiceCipher;
|
||||
import org.whispersystems.signalservice.api.groupsv2.ClientZkOperations;
|
||||
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Api;
|
||||
import org.whispersystems.signalservice.api.groupsv2.GroupsV2Operations;
|
||||
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
|
||||
import org.whispersystems.signalservice.api.services.ProfileService;
|
||||
import org.whispersystems.signalservice.api.util.CredentialsProvider;
|
||||
import org.whispersystems.signalservice.api.util.UptimeSleepTimer;
|
||||
import org.whispersystems.signalservice.api.websocket.WebSocketFactory;
|
||||
import org.whispersystems.signalservice.internal.websocket.WebSocketConnection;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import static org.asamk.signal.manager.config.ServiceConfig.capabilities;
|
||||
|
||||
public class SignalDependencies {
|
||||
|
||||
private final Object LOCK = new Object();
|
||||
|
||||
private final ServiceEnvironmentConfig serviceEnvironmentConfig;
|
||||
private final String userAgent;
|
||||
private final CredentialsProvider credentialsProvider;
|
||||
private final SignalServiceDataStore dataStore;
|
||||
private final ExecutorService executor;
|
||||
private final SignalSessionLock sessionLock;
|
||||
|
||||
private SignalServiceAccountManager accountManager;
|
||||
private GroupsV2Api groupsV2Api;
|
||||
private GroupsV2Operations groupsV2Operations;
|
||||
private ClientZkOperations clientZkOperations;
|
||||
|
||||
private SignalWebSocket signalWebSocket;
|
||||
private SignalServiceMessageReceiver messageReceiver;
|
||||
private SignalServiceMessageSender messageSender;
|
||||
|
||||
private KeyBackupService keyBackupService;
|
||||
private ProfileService profileService;
|
||||
private SignalServiceCipher cipher;
|
||||
|
||||
SignalDependencies(
|
||||
final ServiceEnvironmentConfig serviceEnvironmentConfig,
|
||||
final String userAgent,
|
||||
final CredentialsProvider credentialsProvider,
|
||||
final SignalServiceDataStore dataStore,
|
||||
final ExecutorService executor,
|
||||
final SignalSessionLock sessionLock
|
||||
) {
|
||||
this.serviceEnvironmentConfig = serviceEnvironmentConfig;
|
||||
this.userAgent = userAgent;
|
||||
this.credentialsProvider = credentialsProvider;
|
||||
this.dataStore = dataStore;
|
||||
this.executor = executor;
|
||||
this.sessionLock = sessionLock;
|
||||
}
|
||||
|
||||
public void resetAfterAddressChange() {
|
||||
this.messageSender = null;
|
||||
this.cipher = null;
|
||||
}
|
||||
|
||||
public ServiceEnvironmentConfig getServiceEnvironmentConfig() {
|
||||
return serviceEnvironmentConfig;
|
||||
}
|
||||
|
||||
public SignalServiceAccountManager getAccountManager() {
|
||||
return getOrCreate(() -> accountManager,
|
||||
() -> accountManager = new SignalServiceAccountManager(serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
credentialsProvider,
|
||||
userAgent,
|
||||
getGroupsV2Operations(),
|
||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY));
|
||||
}
|
||||
|
||||
public SignalServiceAccountManager createUnauthenticatedAccountManager(String number, String password) {
|
||||
return new SignalServiceAccountManager(getServiceEnvironmentConfig().getSignalServiceConfiguration(),
|
||||
null,
|
||||
null,
|
||||
number,
|
||||
SignalServiceAddress.DEFAULT_DEVICE_ID,
|
||||
password,
|
||||
userAgent,
|
||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY,
|
||||
ServiceConfig.GROUP_MAX_SIZE);
|
||||
}
|
||||
|
||||
public GroupsV2Api getGroupsV2Api() {
|
||||
return getOrCreate(() -> groupsV2Api, () -> groupsV2Api = getAccountManager().getGroupsV2Api());
|
||||
}
|
||||
|
||||
public GroupsV2Operations getGroupsV2Operations() {
|
||||
return getOrCreate(() -> groupsV2Operations,
|
||||
() -> groupsV2Operations = capabilities.isGv2()
|
||||
? new GroupsV2Operations(ClientZkOperations.create(serviceEnvironmentConfig.getSignalServiceConfiguration()),
|
||||
ServiceConfig.GROUP_MAX_SIZE)
|
||||
: null);
|
||||
}
|
||||
|
||||
private ClientZkOperations getClientZkOperations() {
|
||||
return getOrCreate(() -> clientZkOperations,
|
||||
() -> clientZkOperations = capabilities.isGv2()
|
||||
? ClientZkOperations.create(serviceEnvironmentConfig.getSignalServiceConfiguration())
|
||||
: null);
|
||||
}
|
||||
|
||||
private ClientZkProfileOperations getClientZkProfileOperations() {
|
||||
final var clientZkOperations = getClientZkOperations();
|
||||
return clientZkOperations == null ? null : clientZkOperations.getProfileOperations();
|
||||
}
|
||||
|
||||
public SignalWebSocket getSignalWebSocket() {
|
||||
return getOrCreate(() -> signalWebSocket, () -> {
|
||||
final var timer = new UptimeSleepTimer();
|
||||
final var healthMonitor = new SignalWebSocketHealthMonitor(timer);
|
||||
final var webSocketFactory = new WebSocketFactory() {
|
||||
@Override
|
||||
public WebSocketConnection createWebSocket() {
|
||||
return new WebSocketConnection("normal",
|
||||
serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
Optional.of(credentialsProvider),
|
||||
userAgent,
|
||||
healthMonitor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public WebSocketConnection createUnidentifiedWebSocket() {
|
||||
return new WebSocketConnection("unidentified",
|
||||
serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
Optional.empty(),
|
||||
userAgent,
|
||||
healthMonitor);
|
||||
}
|
||||
};
|
||||
signalWebSocket = new SignalWebSocket(webSocketFactory);
|
||||
healthMonitor.monitor(signalWebSocket);
|
||||
});
|
||||
}
|
||||
|
||||
public SignalServiceMessageReceiver getMessageReceiver() {
|
||||
return getOrCreate(() -> messageReceiver,
|
||||
() -> messageReceiver = new SignalServiceMessageReceiver(serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
credentialsProvider,
|
||||
userAgent,
|
||||
getClientZkProfileOperations(),
|
||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY));
|
||||
}
|
||||
|
||||
public SignalServiceMessageSender getMessageSender() {
|
||||
return getOrCreate(() -> messageSender,
|
||||
() -> messageSender = new SignalServiceMessageSender(serviceEnvironmentConfig.getSignalServiceConfiguration(),
|
||||
credentialsProvider,
|
||||
dataStore,
|
||||
sessionLock,
|
||||
userAgent,
|
||||
getSignalWebSocket(),
|
||||
Optional.empty(),
|
||||
getClientZkProfileOperations(),
|
||||
executor,
|
||||
ServiceConfig.MAX_ENVELOPE_SIZE,
|
||||
ServiceConfig.AUTOMATIC_NETWORK_RETRY));
|
||||
}
|
||||
|
||||
public KeyBackupService getKeyBackupService() {
|
||||
return getOrCreate(() -> keyBackupService,
|
||||
() -> keyBackupService = getAccountManager().getKeyBackupService(ServiceConfig.getIasKeyStore(),
|
||||
serviceEnvironmentConfig.getKeyBackupConfig().getEnclaveName(),
|
||||
serviceEnvironmentConfig.getKeyBackupConfig().getServiceId(),
|
||||
serviceEnvironmentConfig.getKeyBackupConfig().getMrenclave(),
|
||||
10));
|
||||
}
|
||||
|
||||
public ProfileService getProfileService() {
|
||||
return getOrCreate(() -> profileService,
|
||||
() -> profileService = new ProfileService(getClientZkProfileOperations(),
|
||||
getMessageReceiver(),
|
||||
getSignalWebSocket()));
|
||||
}
|
||||
|
||||
public SignalServiceCipher getCipher() {
|
||||
return getOrCreate(() -> cipher, () -> {
|
||||
final var certificateValidator = new CertificateValidator(serviceEnvironmentConfig.getUnidentifiedSenderTrustRoot());
|
||||
final var address = new SignalServiceAddress(credentialsProvider.getAci(), credentialsProvider.getE164());
|
||||
final var deviceId = credentialsProvider.getDeviceId();
|
||||
cipher = new SignalServiceCipher(address, deviceId, dataStore.aci(), sessionLock, certificateValidator);
|
||||
});
|
||||
}
|
||||
|
||||
private <T> T getOrCreate(Supplier<T> supplier, Callable creator) {
|
||||
var value = supplier.get();
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
|
||||
synchronized (LOCK) {
|
||||
value = supplier.get();
|
||||
if (value != null) {
|
||||
return value;
|
||||
}
|
||||
creator.call();
|
||||
return supplier.get();
|
||||
}
|
||||
}
|
||||
|
||||
private interface Callable {
|
||||
|
||||
void call();
|
||||
}
|
||||
}
|
||||
@ -1,196 +0,0 @@
|
||||
package org.asamk.signal.manager;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.signalservice.api.SignalWebSocket;
|
||||
import org.whispersystems.signalservice.api.util.Preconditions;
|
||||
import org.whispersystems.signalservice.api.util.SleepTimer;
|
||||
import org.whispersystems.signalservice.api.websocket.HealthMonitor;
|
||||
import org.whispersystems.signalservice.api.websocket.WebSocketConnectionState;
|
||||
import org.whispersystems.signalservice.internal.websocket.WebSocketConnection;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
|
||||
/**
|
||||
* Monitors the health of the identified and unidentified WebSockets. If either one appears to be
|
||||
* unhealthy, will trigger restarting both.
|
||||
* <p>
|
||||
* The monitor is also responsible for sending heartbeats/keep-alive messages to prevent
|
||||
* timeouts.
|
||||
*/
|
||||
final class SignalWebSocketHealthMonitor implements HealthMonitor {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(SignalWebSocketHealthMonitor.class);
|
||||
|
||||
private static final long KEEP_ALIVE_SEND_CADENCE = TimeUnit.SECONDS.toMillis(WebSocketConnection.KEEPALIVE_TIMEOUT_SECONDS);
|
||||
private static final long MAX_TIME_SINCE_SUCCESSFUL_KEEP_ALIVE = KEEP_ALIVE_SEND_CADENCE * 3;
|
||||
|
||||
private SignalWebSocket signalWebSocket;
|
||||
private final SleepTimer sleepTimer;
|
||||
|
||||
private volatile KeepAliveSender keepAliveSender;
|
||||
|
||||
private final HealthState identified = new HealthState();
|
||||
private final HealthState unidentified = new HealthState();
|
||||
|
||||
public SignalWebSocketHealthMonitor(SleepTimer sleepTimer) {
|
||||
this.sleepTimer = sleepTimer;
|
||||
}
|
||||
|
||||
public void monitor(SignalWebSocket signalWebSocket) {
|
||||
Preconditions.checkNotNull(signalWebSocket);
|
||||
Preconditions.checkArgument(this.signalWebSocket == null, "monitor can only be called once");
|
||||
|
||||
this.signalWebSocket = signalWebSocket;
|
||||
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
signalWebSocket.getWebSocketState()
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(Schedulers.computation())
|
||||
.distinctUntilChanged()
|
||||
.subscribe(s -> onStateChange(s, identified));
|
||||
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
signalWebSocket.getUnidentifiedWebSocketState()
|
||||
.subscribeOn(Schedulers.computation())
|
||||
.observeOn(Schedulers.computation())
|
||||
.distinctUntilChanged()
|
||||
.subscribe(s -> onStateChange(s, unidentified));
|
||||
}
|
||||
|
||||
private synchronized void onStateChange(WebSocketConnectionState connectionState, HealthState healthState) {
|
||||
switch (connectionState) {
|
||||
case CONNECTED -> logger.debug("WebSocket is now connected");
|
||||
case AUTHENTICATION_FAILED -> logger.debug("WebSocket authentication failed");
|
||||
case FAILED -> logger.debug("WebSocket connection failed");
|
||||
}
|
||||
|
||||
healthState.needsKeepAlive = connectionState == WebSocketConnectionState.CONNECTED;
|
||||
|
||||
if (keepAliveSender == null && isKeepAliveNecessary()) {
|
||||
keepAliveSender = new KeepAliveSender();
|
||||
keepAliveSender.start();
|
||||
} else if (keepAliveSender != null && !isKeepAliveNecessary()) {
|
||||
keepAliveSender.shutdown();
|
||||
keepAliveSender = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeepAliveResponse(long sentTimestamp, boolean isIdentifiedWebSocket) {
|
||||
if (isIdentifiedWebSocket) {
|
||||
identified.lastKeepAliveReceived = System.currentTimeMillis();
|
||||
} else {
|
||||
unidentified.lastKeepAliveReceived = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageError(int status, boolean isIdentifiedWebSocket) {
|
||||
if (status == 409) {
|
||||
HealthState healthState = (isIdentifiedWebSocket ? identified : unidentified);
|
||||
if (healthState.mismatchErrorTracker.addSample(System.currentTimeMillis())) {
|
||||
logger.warn("Received too many mismatch device errors, forcing new websockets.");
|
||||
signalWebSocket.forceNewWebSockets();
|
||||
signalWebSocket.connect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isKeepAliveNecessary() {
|
||||
return identified.needsKeepAlive || unidentified.needsKeepAlive;
|
||||
}
|
||||
|
||||
private static class HealthState {
|
||||
|
||||
private final HttpErrorTracker mismatchErrorTracker = new HttpErrorTracker(5, TimeUnit.MINUTES.toMillis(1));
|
||||
|
||||
private volatile boolean needsKeepAlive;
|
||||
private volatile long lastKeepAliveReceived;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends periodic heartbeats/keep-alives over both WebSockets to prevent connection timeouts. If
|
||||
* either WebSocket fails 3 times to get a return heartbeat both are forced to be recreated.
|
||||
*/
|
||||
private class KeepAliveSender extends Thread {
|
||||
|
||||
private volatile boolean shouldKeepRunning = true;
|
||||
|
||||
public void run() {
|
||||
identified.lastKeepAliveReceived = System.currentTimeMillis();
|
||||
unidentified.lastKeepAliveReceived = System.currentTimeMillis();
|
||||
|
||||
while (shouldKeepRunning && isKeepAliveNecessary()) {
|
||||
try {
|
||||
sleepTimer.sleep(KEEP_ALIVE_SEND_CADENCE);
|
||||
|
||||
if (shouldKeepRunning && isKeepAliveNecessary()) {
|
||||
long keepAliveRequiredSinceTime = System.currentTimeMillis()
|
||||
- MAX_TIME_SINCE_SUCCESSFUL_KEEP_ALIVE;
|
||||
|
||||
if (identified.lastKeepAliveReceived < keepAliveRequiredSinceTime
|
||||
|| unidentified.lastKeepAliveReceived < keepAliveRequiredSinceTime) {
|
||||
logger.warn("Missed keep alives, identified last: "
|
||||
+ identified.lastKeepAliveReceived
|
||||
+ " unidentified last: "
|
||||
+ unidentified.lastKeepAliveReceived
|
||||
+ " needed by: "
|
||||
+ keepAliveRequiredSinceTime);
|
||||
signalWebSocket.forceNewWebSockets();
|
||||
signalWebSocket.connect();
|
||||
} else {
|
||||
signalWebSocket.sendKeepAlive();
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
logger.warn("Error occured in KeepAliveSender, ignoring ...", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shutdown() {
|
||||
shouldKeepRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
private final static class HttpErrorTracker {
|
||||
|
||||
private final long[] timestamps;
|
||||
private final long errorTimeRange;
|
||||
|
||||
public HttpErrorTracker(int samples, long errorTimeRange) {
|
||||
this.timestamps = new long[samples];
|
||||
this.errorTimeRange = errorTimeRange;
|
||||
}
|
||||
|
||||
public synchronized boolean addSample(long now) {
|
||||
long errorsMustBeAfter = now - errorTimeRange;
|
||||
int count = 1;
|
||||
int minIndex = 0;
|
||||
|
||||
for (int i = 0; i < timestamps.length; i++) {
|
||||
if (timestamps[i] < errorsMustBeAfter) {
|
||||
timestamps[i] = 0;
|
||||
} else if (timestamps[i] != 0) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (timestamps[i] < timestamps[minIndex]) {
|
||||
minIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
timestamps[minIndex] = now;
|
||||
|
||||
if (count >= timestamps.length) {
|
||||
Arrays.fill(timestamps, 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,21 +2,24 @@ package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
import org.signal.core.models.ServiceId;
|
||||
|
||||
public class RenewSessionAction implements HandleAction {
|
||||
|
||||
private final RecipientId recipientId;
|
||||
private final ServiceId serviceId;
|
||||
private final ServiceId accountId;
|
||||
|
||||
public RenewSessionAction(final RecipientId recipientId) {
|
||||
public RenewSessionAction(final RecipientId recipientId, final ServiceId serviceId, final ServiceId accountId) {
|
||||
this.recipientId = recipientId;
|
||||
this.serviceId = serviceId;
|
||||
this.accountId = accountId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getAccount().getSessionStore().archiveSessions(recipientId);
|
||||
if (!recipientId.equals(context.getAccount().getSelfRecipientId())) {
|
||||
context.getSendHelper().sendNullMessage(recipientId);
|
||||
}
|
||||
context.getAccount().getAccountData(accountId).getSessionStore().archiveSessions(serviceId);
|
||||
context.getSendHelper().sendNullMessage(recipientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -13,7 +13,9 @@ public class ResendMessageAction implements HandleAction {
|
||||
private final MessageSendLogEntry messageSendLogEntry;
|
||||
|
||||
public ResendMessageAction(
|
||||
final RecipientId recipientId, final long timestamp, final MessageSendLogEntry messageSendLogEntry
|
||||
final RecipientId recipientId,
|
||||
final long timestamp,
|
||||
final MessageSendLogEntry messageSendLogEntry
|
||||
) {
|
||||
this.recipientId = recipientId;
|
||||
this.timestamp = timestamp;
|
||||
|
||||
@ -0,0 +1,20 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
|
||||
public class RetrieveDeviceNameAction implements HandleAction {
|
||||
|
||||
private static final RetrieveDeviceNameAction INSTANCE = new RetrieveDeviceNameAction();
|
||||
|
||||
public static RetrieveDeviceNameAction create() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
private RetrieveDeviceNameAction() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getAccountHelper().refreshDeviceName();
|
||||
}
|
||||
}
|
||||
@ -1,24 +0,0 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
|
||||
public class RetrieveStorageDataAction implements HandleAction {
|
||||
|
||||
private static final RetrieveStorageDataAction INSTANCE = new RetrieveStorageDataAction();
|
||||
|
||||
private RetrieveStorageDataAction() {
|
||||
}
|
||||
|
||||
public static RetrieveStorageDataAction create() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
if (context.getAccount().getStorageKey() != null) {
|
||||
context.getStorageHelper().readDataFromStorage();
|
||||
} else if (!context.getAccount().isMasterDevice()) {
|
||||
context.getSyncHelper().requestSyncKeys();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupIdV1;
|
||||
import org.asamk.signal.manager.api.GroupIdV1;
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupIdV1;
|
||||
import org.asamk.signal.manager.api.GroupIdV1;
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
|
||||
public class SendPniIdentityKeyAction implements HandleAction {
|
||||
|
||||
private static final SendPniIdentityKeyAction INSTANCE = new SendPniIdentityKeyAction();
|
||||
|
||||
private SendPniIdentityKeyAction() {
|
||||
}
|
||||
|
||||
public static SendPniIdentityKeyAction create() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getSyncHelper().sendPniIdentity();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class SendProfileKeyAction implements HandleAction {
|
||||
|
||||
private final RecipientId recipientId;
|
||||
|
||||
public SendProfileKeyAction(final RecipientId recipientId) {
|
||||
this.recipientId = recipientId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getSendHelper().sendProfileKey(recipientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
final SendProfileKeyAction that = (SendProfileKeyAction) o;
|
||||
return recipientId.equals(that.recipientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(recipientId);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -10,16 +11,24 @@ import java.util.Objects;
|
||||
public class SendReceiptAction implements HandleAction {
|
||||
|
||||
private final RecipientId recipientId;
|
||||
private final SignalServiceReceiptMessage.Type type;
|
||||
private final List<Long> timestamps = new ArrayList<>();
|
||||
|
||||
public SendReceiptAction(final RecipientId recipientId, final long timestamp) {
|
||||
public SendReceiptAction(
|
||||
final RecipientId recipientId,
|
||||
final SignalServiceReceiptMessage.Type type,
|
||||
final long timestamp
|
||||
) {
|
||||
this.recipientId = recipientId;
|
||||
this.type = type;
|
||||
this.timestamps.add(timestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getSendHelper().sendDeliveryReceipt(recipientId, timestamps);
|
||||
final var receiptMessage = new SignalServiceReceiptMessage(type, timestamps, System.currentTimeMillis());
|
||||
|
||||
context.getSendHelper().sendReceiptMessage(receiptMessage, recipientId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,13 +43,13 @@ public class SendReceiptAction implements HandleAction {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
final SendReceiptAction that = (SendReceiptAction) o;
|
||||
// Using only recipientId here on purpose
|
||||
return recipientId.equals(that.recipientId);
|
||||
// Using only recipientId and type here on purpose
|
||||
return recipientId.equals(that.recipientId) && type == that.type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
// Using only recipientId here on purpose
|
||||
return Objects.hash(recipientId);
|
||||
// Using only recipientId and type here on purpose
|
||||
return Objects.hash(recipientId, type);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.api.GroupId;
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
import org.signal.libsignal.metadata.ProtocolException;
|
||||
import org.signal.libsignal.protocol.message.CiphertextMessage;
|
||||
import org.signal.libsignal.protocol.message.DecryptionErrorMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.internal.push.SignalServiceProtos;
|
||||
import org.whispersystems.signalservice.internal.push.Envelope;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
@ -29,8 +29,6 @@ public class SendRetryMessageRequestAction implements HandleAction {
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getAccount().getSessionStore().archiveSessions(recipientId);
|
||||
|
||||
int senderDevice = protocolException.getSenderDevice();
|
||||
Optional<GroupId> groupId = protocolException.getGroupId().isPresent() ? Optional.of(GroupId.unknownVersion(
|
||||
protocolException.getGroupId().get())) : Optional.empty();
|
||||
@ -43,7 +41,9 @@ public class SendRetryMessageRequestAction implements HandleAction {
|
||||
envelopeType = messageContent.getType();
|
||||
} else {
|
||||
originalContent = envelope.getContent();
|
||||
envelopeType = envelopeTypeToCiphertextMessageType(envelope.getType());
|
||||
envelopeType = envelope.getType() == null
|
||||
? CiphertextMessage.WHISPER_TYPE
|
||||
: envelopeTypeToCiphertextMessageType(envelope.getType());
|
||||
}
|
||||
|
||||
DecryptionErrorMessage decryptionErrorMessage = DecryptionErrorMessage.forOriginalMessage(originalContent,
|
||||
@ -55,10 +55,14 @@ public class SendRetryMessageRequestAction implements HandleAction {
|
||||
}
|
||||
|
||||
private static int envelopeTypeToCiphertextMessageType(int envelopeType) {
|
||||
return switch (envelopeType) {
|
||||
case SignalServiceProtos.Envelope.Type.PREKEY_BUNDLE_VALUE -> CiphertextMessage.PREKEY_TYPE;
|
||||
case SignalServiceProtos.Envelope.Type.UNIDENTIFIED_SENDER_VALUE -> CiphertextMessage.SENDERKEY_TYPE;
|
||||
case SignalServiceProtos.Envelope.Type.PLAINTEXT_CONTENT_VALUE -> CiphertextMessage.PLAINTEXT_CONTENT_TYPE;
|
||||
final var type = Envelope.Type.fromValue(envelopeType);
|
||||
if (type == null) {
|
||||
return CiphertextMessage.WHISPER_TYPE;
|
||||
}
|
||||
return switch (type) {
|
||||
case PREKEY_MESSAGE -> CiphertextMessage.PREKEY_TYPE;
|
||||
case UNIDENTIFIED_SENDER -> CiphertextMessage.SENDERKEY_TYPE;
|
||||
case PLAINTEXT_CONTENT -> CiphertextMessage.PLAINTEXT_CONTENT_TYPE;
|
||||
default -> CiphertextMessage.WHISPER_TYPE;
|
||||
};
|
||||
}
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
import org.asamk.signal.manager.jobs.SyncStorageJob;
|
||||
|
||||
public class SyncStorageDataAction implements HandleAction {
|
||||
|
||||
private static final SyncStorageDataAction INSTANCE = new SyncStorageDataAction();
|
||||
|
||||
private SyncStorageDataAction() {
|
||||
}
|
||||
|
||||
public static SyncStorageDataAction create() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getJobExecutor().enqueueJob(new SyncStorageJob());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package org.asamk.signal.manager.actions;
|
||||
|
||||
import org.asamk.signal.manager.helper.Context;
|
||||
|
||||
public class UpdateAccountAttributesAction implements HandleAction {
|
||||
|
||||
private static final UpdateAccountAttributesAction INSTANCE = new UpdateAccountAttributesAction();
|
||||
|
||||
private UpdateAccountAttributesAction() {
|
||||
}
|
||||
|
||||
public static UpdateAccountAttributesAction create() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Context context) throws Throwable {
|
||||
context.getAccountHelper().updateAccountAttributes();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class AlreadyReceivingException extends Exception {
|
||||
|
||||
public AlreadyReceivingException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AlreadyReceivingException(String message, Exception e) {
|
||||
super(message, e);
|
||||
}
|
||||
}
|
||||
21
lib/src/main/java/org/asamk/signal/manager/api/CallInfo.java
Normal file
21
lib/src/main/java/org/asamk/signal/manager/api/CallInfo.java
Normal file
@ -0,0 +1,21 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public record CallInfo(
|
||||
long callId,
|
||||
State state,
|
||||
RecipientAddress recipient,
|
||||
String inputDeviceName,
|
||||
String outputDeviceName,
|
||||
boolean isOutgoing
|
||||
) {
|
||||
|
||||
public enum State {
|
||||
IDLE,
|
||||
RINGING_INCOMING,
|
||||
RINGING_OUTGOING,
|
||||
CONNECTING,
|
||||
CONNECTED,
|
||||
RECONNECTING,
|
||||
ENDED
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public record CallOffer(
|
||||
long callId, Type type, byte[] opaque
|
||||
) {
|
||||
|
||||
public enum Type {
|
||||
AUDIO,
|
||||
VIDEO
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class CaptchaRejectedException extends Exception {
|
||||
|
||||
public CaptchaRejectedException() {
|
||||
super("Captcha rejected");
|
||||
}
|
||||
|
||||
public CaptchaRejectedException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public CaptchaRejectedException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,13 @@ package org.asamk.signal.manager.api;
|
||||
|
||||
public class CaptchaRequiredException extends Exception {
|
||||
|
||||
private long nextVerificationAttemptMilliseconds;
|
||||
|
||||
public CaptchaRequiredException(final long nextVerificationAttemptMilliseconds) {
|
||||
super("Captcha required");
|
||||
this.nextVerificationAttemptMilliseconds = nextVerificationAttemptMilliseconds;
|
||||
}
|
||||
|
||||
public CaptchaRequiredException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
@ -9,4 +16,8 @@ public class CaptchaRequiredException extends Exception {
|
||||
public CaptchaRequiredException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public long getNextVerificationAttemptMilliseconds() {
|
||||
return nextVerificationAttemptMilliseconds;
|
||||
}
|
||||
}
|
||||
|
||||
24
lib/src/main/java/org/asamk/signal/manager/api/Color.java
Normal file
24
lib/src/main/java/org/asamk/signal/manager/api/Color.java
Normal file
@ -0,0 +1,24 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public record Color(int color) {
|
||||
|
||||
public int alpha() {
|
||||
return color >>> 24;
|
||||
}
|
||||
|
||||
public int red() {
|
||||
return (color >> 16) & 0xFF;
|
||||
}
|
||||
|
||||
public int green() {
|
||||
return (color >> 8) & 0xFF;
|
||||
}
|
||||
|
||||
public int blue() {
|
||||
return color & 0xFF;
|
||||
}
|
||||
|
||||
public String toHexColor() {
|
||||
return String.format("#%08x", color);
|
||||
}
|
||||
}
|
||||
193
lib/src/main/java/org/asamk/signal/manager/api/Contact.java
Normal file
193
lib/src/main/java/org/asamk/signal/manager/api/Contact.java
Normal file
@ -0,0 +1,193 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.whispersystems.signalservice.internal.util.Util;
|
||||
|
||||
public record Contact(
|
||||
String givenName,
|
||||
String familyName,
|
||||
String nickName,
|
||||
String nickNameGivenName,
|
||||
String nickNameFamilyName,
|
||||
String note,
|
||||
String color,
|
||||
int messageExpirationTime,
|
||||
int messageExpirationTimeVersion,
|
||||
long muteUntil,
|
||||
boolean hideStory,
|
||||
boolean isBlocked,
|
||||
boolean isArchived,
|
||||
boolean isProfileSharingEnabled,
|
||||
boolean isHidden,
|
||||
Long unregisteredTimestamp
|
||||
) {
|
||||
|
||||
private Contact(final Builder builder) {
|
||||
this(builder.givenName,
|
||||
builder.familyName,
|
||||
builder.nickName,
|
||||
builder.nickNameGivenName,
|
||||
builder.nickNameFamilyName,
|
||||
builder.note,
|
||||
builder.color,
|
||||
builder.messageExpirationTime,
|
||||
builder.messageExpirationTimeVersion,
|
||||
builder.muteUntil,
|
||||
builder.hideStory,
|
||||
builder.isBlocked,
|
||||
builder.isArchived,
|
||||
builder.isProfileSharingEnabled,
|
||||
builder.isHidden,
|
||||
builder.unregisteredTimestamp);
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static Builder newBuilder(final Contact copy) {
|
||||
Builder builder = new Builder();
|
||||
builder.givenName = copy.givenName();
|
||||
builder.familyName = copy.familyName();
|
||||
builder.nickName = copy.nickName();
|
||||
builder.nickNameGivenName = copy.nickNameGivenName();
|
||||
builder.nickNameFamilyName = copy.nickNameFamilyName();
|
||||
builder.note = copy.note();
|
||||
builder.color = copy.color();
|
||||
builder.messageExpirationTime = copy.messageExpirationTime();
|
||||
builder.messageExpirationTimeVersion = copy.messageExpirationTimeVersion();
|
||||
builder.muteUntil = copy.muteUntil();
|
||||
builder.hideStory = copy.hideStory();
|
||||
builder.isBlocked = copy.isBlocked();
|
||||
builder.isArchived = copy.isArchived();
|
||||
builder.isProfileSharingEnabled = copy.isProfileSharingEnabled();
|
||||
builder.isHidden = copy.isHidden();
|
||||
builder.unregisteredTimestamp = copy.unregisteredTimestamp();
|
||||
return builder;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
final var noGivenName = Util.isEmpty(givenName);
|
||||
final var noFamilyName = Util.isEmpty(familyName);
|
||||
|
||||
if (noGivenName && noFamilyName) {
|
||||
return "";
|
||||
} else if (noGivenName) {
|
||||
return familyName;
|
||||
} else if (noFamilyName) {
|
||||
return givenName;
|
||||
}
|
||||
|
||||
return givenName + " " + familyName;
|
||||
}
|
||||
|
||||
public static final class Builder {
|
||||
|
||||
private String givenName;
|
||||
private String familyName;
|
||||
private String nickName;
|
||||
private String nickNameGivenName;
|
||||
private String nickNameFamilyName;
|
||||
private String note;
|
||||
private String color;
|
||||
private int messageExpirationTime;
|
||||
private int messageExpirationTimeVersion = 1;
|
||||
private long muteUntil;
|
||||
private boolean hideStory;
|
||||
private boolean isBlocked;
|
||||
private boolean isArchived;
|
||||
private boolean isProfileSharingEnabled;
|
||||
private boolean isHidden;
|
||||
private Long unregisteredTimestamp;
|
||||
|
||||
private Builder() {
|
||||
}
|
||||
|
||||
public static Builder newBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder withGivenName(final String val) {
|
||||
givenName = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withFamilyName(final String val) {
|
||||
familyName = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withNickName(final String val) {
|
||||
nickName = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withNickNameGivenName(final String val) {
|
||||
nickNameGivenName = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withNickNameFamilyName(final String val) {
|
||||
nickNameFamilyName = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withNote(final String val) {
|
||||
note = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withColor(final String val) {
|
||||
color = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withMessageExpirationTime(final int val) {
|
||||
messageExpirationTime = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withMessageExpirationTimeVersion(final int val) {
|
||||
messageExpirationTimeVersion = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withMuteUntil(final long val) {
|
||||
muteUntil = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withHideStory(final boolean val) {
|
||||
hideStory = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withIsBlocked(final boolean val) {
|
||||
isBlocked = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withIsArchived(final boolean val) {
|
||||
isArchived = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withIsProfileSharingEnabled(final boolean val) {
|
||||
isProfileSharingEnabled = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withIsHidden(final boolean val) {
|
||||
isHidden = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder withUnregisteredTimestamp(final Long val) {
|
||||
unregisteredTimestamp = val;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Contact build() {
|
||||
return new Contact(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class DeviceLimitExceededException extends Exception {
|
||||
|
||||
public DeviceLimitExceededException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public DeviceLimitExceededException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@ -1,9 +1,7 @@
|
||||
package org.asamk.signal.manager;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||
import org.asamk.signal.manager.util.Utils;
|
||||
import org.signal.libsignal.protocol.InvalidKeyException;
|
||||
import org.signal.libsignal.protocol.ecc.Curve;
|
||||
import org.signal.libsignal.protocol.ecc.ECPublicKey;
|
||||
|
||||
import java.net.URI;
|
||||
@ -14,9 +12,9 @@ import java.util.Base64;
|
||||
|
||||
import static org.whispersystems.signalservice.internal.util.Util.isEmpty;
|
||||
|
||||
public record DeviceLinkInfo(String deviceIdentifier, ECPublicKey deviceKey) {
|
||||
public record DeviceLinkUrl(String deviceIdentifier, ECPublicKey deviceKey) {
|
||||
|
||||
public static DeviceLinkInfo parseDeviceLinkUri(URI linkUri) throws InvalidDeviceLinkException {
|
||||
public static DeviceLinkUrl parseDeviceLinkUri(URI linkUri) throws InvalidDeviceLinkException {
|
||||
final var rawQuery = linkUri.getRawQuery();
|
||||
if (isEmpty(rawQuery)) {
|
||||
throw new RuntimeException("Invalid device link uri");
|
||||
@ -38,12 +36,12 @@ public record DeviceLinkInfo(String deviceIdentifier, ECPublicKey deviceKey) {
|
||||
}
|
||||
ECPublicKey deviceKey;
|
||||
try {
|
||||
deviceKey = Curve.decodePoint(publicKeyBytes, 0);
|
||||
deviceKey = new ECPublicKey(publicKeyBytes);
|
||||
} catch (InvalidKeyException e) {
|
||||
throw new InvalidDeviceLinkException("Invalid device link", e);
|
||||
}
|
||||
|
||||
return new DeviceLinkInfo(deviceIdentifier, deviceKey);
|
||||
return new DeviceLinkUrl(deviceIdentifier, deviceKey);
|
||||
}
|
||||
|
||||
public URI createDeviceLinkUri() {
|
||||
@ -1,11 +1,7 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
|
||||
import org.asamk.signal.manager.groups.GroupPermission;
|
||||
import org.asamk.signal.manager.helper.RecipientAddressResolver;
|
||||
import org.asamk.signal.manager.storage.groups.GroupInfo;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientId;
|
||||
|
||||
import java.util.Set;
|
||||
@ -16,10 +12,9 @@ public record Group(
|
||||
String title,
|
||||
String description,
|
||||
GroupInviteLinkUrl groupInviteLinkUrl,
|
||||
Set<RecipientAddress> members,
|
||||
Set<GroupMember> members,
|
||||
Set<RecipientAddress> pendingMembers,
|
||||
Set<RecipientAddress> requestingMembers,
|
||||
Set<RecipientAddress> adminMembers,
|
||||
Set<RecipientAddress> bannedMembers,
|
||||
boolean isBlocked,
|
||||
int messageExpirationTimer,
|
||||
@ -31,7 +26,9 @@ public record Group(
|
||||
) {
|
||||
|
||||
public static Group from(
|
||||
final GroupInfo groupInfo, final RecipientAddressResolver recipientStore, final RecipientId selfRecipientId
|
||||
final GroupInfo groupInfo,
|
||||
final RecipientAddressResolver recipientStore,
|
||||
final RecipientId selfRecipientId
|
||||
) {
|
||||
return new Group(groupInfo.getGroupId(),
|
||||
groupInfo.getTitle(),
|
||||
@ -39,23 +36,22 @@ public record Group(
|
||||
groupInfo.getGroupInviteLink(),
|
||||
groupInfo.getMembers()
|
||||
.stream()
|
||||
.map(recipientStore::resolveRecipientAddress)
|
||||
.map(m -> org.asamk.signal.manager.api.GroupMember.from(m, recipientStore))
|
||||
.collect(Collectors.toSet()),
|
||||
groupInfo.getPendingMembers()
|
||||
.stream()
|
||||
.map(recipientStore::resolveRecipientAddress)
|
||||
.map(org.asamk.signal.manager.storage.recipients.RecipientAddress::toApiRecipientAddress)
|
||||
.collect(Collectors.toSet()),
|
||||
groupInfo.getRequestingMembers()
|
||||
.stream()
|
||||
.map(recipientStore::resolveRecipientAddress)
|
||||
.collect(Collectors.toSet()),
|
||||
groupInfo.getAdminMembers()
|
||||
.stream()
|
||||
.map(recipientStore::resolveRecipientAddress)
|
||||
.map(org.asamk.signal.manager.storage.recipients.RecipientAddress::toApiRecipientAddress)
|
||||
.collect(Collectors.toSet()),
|
||||
groupInfo.getBannedMembers()
|
||||
.stream()
|
||||
.map(recipientStore::resolveRecipientAddress)
|
||||
.map(org.asamk.signal.manager.storage.recipients.RecipientAddress::toApiRecipientAddress)
|
||||
.collect(Collectors.toSet()),
|
||||
groupInfo.isBlocked(),
|
||||
groupInfo.getMessageExpirationTimer(),
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Base64;
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class GroupIdFormatException extends Exception {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
@ -1,17 +1,18 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupLinkPassword;
|
||||
import org.signal.core.util.Base64;
|
||||
import org.signal.libsignal.zkgroup.InvalidInputException;
|
||||
import org.signal.libsignal.zkgroup.groups.GroupMasterKey;
|
||||
import org.signal.storageservice.protos.groups.GroupInviteLink;
|
||||
import org.signal.storageservice.protos.groups.local.DecryptedGroup;
|
||||
import org.whispersystems.util.Base64UrlSafe;
|
||||
import org.signal.storageservice.storage.protos.groups.GroupInviteLink;
|
||||
import org.signal.storageservice.storage.protos.groups.local.DecryptedGroup;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
|
||||
import okio.ByteString;
|
||||
|
||||
public final class GroupInviteLinkUrl {
|
||||
|
||||
private static final String GROUP_URL_HOST = "signal.group";
|
||||
@ -23,7 +24,7 @@ public final class GroupInviteLinkUrl {
|
||||
|
||||
public static GroupInviteLinkUrl forGroup(GroupMasterKey groupMasterKey, DecryptedGroup group) {
|
||||
return new GroupInviteLinkUrl(groupMasterKey,
|
||||
GroupLinkPassword.fromBytes(group.getInviteLinkPassword().toByteArray()));
|
||||
GroupLinkPassword.fromBytes(group.inviteLinkPassword.toByteArray()));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -38,30 +39,27 @@ public final class GroupInviteLinkUrl {
|
||||
}
|
||||
|
||||
try {
|
||||
if (!"/".equals(uri.getPath()) && uri.getPath().length() > 0) {
|
||||
if (!"/".equals(uri.getPath()) && !uri.getPath().isEmpty()) {
|
||||
throw new InvalidGroupLinkException("No path was expected in uri");
|
||||
}
|
||||
|
||||
var encoding = uri.getFragment();
|
||||
|
||||
if (encoding == null || encoding.length() == 0) {
|
||||
if (encoding == null || encoding.isEmpty()) {
|
||||
throw new InvalidGroupLinkException("No reference was in the uri");
|
||||
}
|
||||
|
||||
var bytes = Base64UrlSafe.decodePaddingAgnostic(encoding);
|
||||
var groupInviteLink = GroupInviteLink.parseFrom(bytes);
|
||||
var bytes = Base64.decode(encoding);
|
||||
GroupInviteLink groupInviteLink = GroupInviteLink.ADAPTER.decode(bytes);
|
||||
|
||||
switch (groupInviteLink.getContentsCase()) {
|
||||
case V1CONTENTS -> {
|
||||
var groupInviteLinkContentsV1 = groupInviteLink.getV1Contents();
|
||||
var groupMasterKey = new GroupMasterKey(groupInviteLinkContentsV1.getGroupMasterKey()
|
||||
.toByteArray());
|
||||
var password = GroupLinkPassword.fromBytes(groupInviteLinkContentsV1.getInviteLinkPassword()
|
||||
.toByteArray());
|
||||
if (groupInviteLink.contentsV1 != null) {
|
||||
var groupInviteLinkContentsV1 = groupInviteLink.contentsV1;
|
||||
var groupMasterKey = new GroupMasterKey(groupInviteLinkContentsV1.groupMasterKey.toByteArray());
|
||||
var password = GroupLinkPassword.fromBytes(groupInviteLinkContentsV1.inviteLinkPassword.toByteArray());
|
||||
|
||||
return new GroupInviteLinkUrl(groupMasterKey, password);
|
||||
}
|
||||
default -> throw new UnknownGroupLinkVersionException("Url contains no known group link content");
|
||||
return new GroupInviteLinkUrl(groupMasterKey, password);
|
||||
} else {
|
||||
throw new UnknownGroupLinkVersionException("Url contains no known group link content");
|
||||
}
|
||||
} catch (InvalidInputException | IOException e) {
|
||||
throw new InvalidGroupLinkException(e);
|
||||
@ -92,13 +90,12 @@ public final class GroupInviteLinkUrl {
|
||||
}
|
||||
|
||||
private static String createUrl(GroupMasterKey groupMasterKey, GroupLinkPassword password) {
|
||||
var groupInviteLink = GroupInviteLink.newBuilder()
|
||||
.setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder()
|
||||
.setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize()))
|
||||
.setInviteLinkPassword(ByteString.copyFrom(password.serialize())))
|
||||
.build();
|
||||
var groupInviteLink = new GroupInviteLink.Builder().contentsV1(new GroupInviteLink.GroupInviteLinkContentsV1.Builder().groupMasterKey(
|
||||
ByteString.of(groupMasterKey.serialize()))
|
||||
.inviteLinkPassword(ByteString.of(password.serialize()))
|
||||
.build()).build();
|
||||
|
||||
var encoding = Base64UrlSafe.encodeBytesWithoutPadding(groupInviteLink.toByteArray());
|
||||
var encoding = Base64.encodeUrlSafeWithoutPadding(groupInviteLink.encode());
|
||||
|
||||
return GROUP_URL_PREFIX + encoding;
|
||||
}
|
||||
@ -115,7 +112,7 @@ public final class GroupInviteLinkUrl {
|
||||
return password;
|
||||
}
|
||||
|
||||
public final static class InvalidGroupLinkException extends Exception {
|
||||
public static final class InvalidGroupLinkException extends Exception {
|
||||
|
||||
public InvalidGroupLinkException(String message) {
|
||||
super(message);
|
||||
@ -126,7 +123,7 @@ public final class GroupInviteLinkUrl {
|
||||
}
|
||||
}
|
||||
|
||||
public final static class UnknownGroupLinkVersionException extends Exception {
|
||||
public static final class UnknownGroupLinkVersionException extends Exception {
|
||||
|
||||
public UnknownGroupLinkVersionException(String message) {
|
||||
super(message);
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public enum GroupLinkState {
|
||||
ENABLED,
|
||||
@ -0,0 +1,14 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.asamk.signal.manager.helper.RecipientAddressResolver;
|
||||
import org.asamk.signal.manager.storage.groups.GroupMemberInfo;
|
||||
|
||||
public record GroupMember(
|
||||
RecipientAddress recipientAddress, boolean isAdmin, String labelEmoji, String label
|
||||
) {
|
||||
|
||||
public static GroupMember from(final GroupMemberInfo memberInfo, final RecipientAddressResolver recipientStore) {
|
||||
return new GroupMember(recipientStore.resolveRecipientAddress(memberInfo.getRecipientId())
|
||||
.toApiRecipientAddress(), memberInfo.isAdmin(), memberInfo.labelEmoji(), memberInfo.labelString());
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class GroupNotFoundException extends Exception {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public enum GroupPermission {
|
||||
EVERY_MEMBER,
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class GroupSendingNotAllowedException extends Exception {
|
||||
|
||||
@ -1,20 +1,10 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
import org.signal.libsignal.protocol.IdentityKey;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public record Identity(
|
||||
RecipientAddress recipient,
|
||||
IdentityKey identityKey,
|
||||
byte[] fingerprint,
|
||||
String safetyNumber,
|
||||
byte[] scannableSafetyNumber,
|
||||
TrustLevel trustLevel,
|
||||
Date dateAdded
|
||||
) {
|
||||
|
||||
public byte[] getFingerprint() {
|
||||
return identityKey.getPublicKey().serialize();
|
||||
}
|
||||
}
|
||||
long dateAddedTimestamp
|
||||
) {}
|
||||
|
||||
@ -0,0 +1,28 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.signal.libsignal.protocol.util.Hex;
|
||||
|
||||
import java.util.Base64;
|
||||
import java.util.Locale;
|
||||
|
||||
public sealed interface IdentityVerificationCode {
|
||||
|
||||
record Fingerprint(byte[] fingerprint) implements IdentityVerificationCode {}
|
||||
|
||||
record SafetyNumber(String safetyNumber) implements IdentityVerificationCode {}
|
||||
|
||||
record ScannableSafetyNumber(byte[] safetyNumber) implements IdentityVerificationCode {}
|
||||
|
||||
static IdentityVerificationCode parse(String code) throws Exception {
|
||||
code = code.replaceAll(" ", "");
|
||||
if (code.length() == 66) {
|
||||
final var fingerprintBytes = Hex.fromStringCondensed(code.toLowerCase(Locale.ROOT));
|
||||
return new Fingerprint(fingerprintBytes);
|
||||
} else if (code.length() == 60) {
|
||||
return new SafetyNumber(code);
|
||||
} else {
|
||||
final var scannableSafetyNumber = Base64.getDecoder().decode(code);
|
||||
return new ScannableSafetyNumber(scannableSafetyNumber);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,10 @@ package org.asamk.signal.manager.api;
|
||||
|
||||
public class InvalidNumberException extends Exception {
|
||||
|
||||
public InvalidNumberException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
InvalidNumberException(String message, Throwable e) {
|
||||
super(message, e);
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class InvalidUsernameException extends Exception {
|
||||
|
||||
public InvalidUsernameException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public InvalidUsernameException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class LastGroupAdminException extends Exception {
|
||||
|
||||
@ -6,14 +6,34 @@ import java.util.Optional;
|
||||
public record Message(
|
||||
String messageText,
|
||||
List<String> attachments,
|
||||
boolean viewOnce,
|
||||
boolean voiceNote,
|
||||
List<Mention> mentions,
|
||||
Optional<Quote> quote,
|
||||
Optional<Sticker> sticker
|
||||
Optional<Sticker> sticker,
|
||||
List<Preview> previews,
|
||||
Optional<StoryReply> storyReply,
|
||||
List<TextStyle> textStyles,
|
||||
boolean urgent
|
||||
) {
|
||||
|
||||
public record Mention(RecipientIdentifier.Single recipient, int start, int length) {}
|
||||
|
||||
public record Quote(long timestamp, RecipientIdentifier.Single author, String message, List<Mention> mentions) {}
|
||||
public record Quote(
|
||||
long timestamp,
|
||||
RecipientIdentifier.Single author,
|
||||
String message,
|
||||
List<Mention> mentions,
|
||||
List<TextStyle> textStyles,
|
||||
List<Attachment> attachments
|
||||
) {
|
||||
|
||||
public record Attachment(String contentType, String filename, String preview) {}
|
||||
}
|
||||
|
||||
public record Sticker(byte[] packId, int stickerId) {}
|
||||
|
||||
public record Preview(String url, String title, String description, Optional<String> image) {}
|
||||
|
||||
public record StoryReply(long timestamp, RecipientIdentifier.Single author) {}
|
||||
}
|
||||
|
||||
@ -1,20 +1,22 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
import org.asamk.signal.manager.groups.GroupId;
|
||||
import org.asamk.signal.manager.groups.GroupUtils;
|
||||
import org.asamk.signal.manager.helper.RecipientAddressResolver;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientAddress;
|
||||
import org.asamk.signal.manager.storage.recipients.RecipientResolver;
|
||||
import org.asamk.signal.manager.util.MimeUtils;
|
||||
import org.signal.libsignal.metadata.ProtocolException;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceContent;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEditMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceEnvelope;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceGroupContext;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServicePreview;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceReceiptMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceStoryMessage;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceTextAttachment;
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceTypingMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.AnswerMessage;
|
||||
import org.whispersystems.signalservice.api.messages.calls.BusyMessage;
|
||||
@ -33,7 +35,9 @@ import org.whispersystems.signalservice.api.messages.multidevice.ViewOnceOpenMes
|
||||
import org.whispersystems.signalservice.api.messages.multidevice.ViewedMessage;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
@ -48,8 +52,10 @@ public record MessageEnvelope(
|
||||
Optional<Receipt> receipt,
|
||||
Optional<Typing> typing,
|
||||
Optional<Data> data,
|
||||
Optional<Edit> edit,
|
||||
Optional<Sync> sync,
|
||||
Optional<Call> call
|
||||
Optional<Call> call,
|
||||
Optional<Story> story
|
||||
) {
|
||||
|
||||
public record Receipt(long when, Type type, List<Long> timestamps) {
|
||||
@ -94,12 +100,14 @@ public record MessageEnvelope(
|
||||
public record Data(
|
||||
long timestamp,
|
||||
Optional<GroupContext> groupContext,
|
||||
Optional<StoryContext> storyContext,
|
||||
Optional<GroupCallUpdate> groupCallUpdate,
|
||||
Optional<String> body,
|
||||
int expiresInSeconds,
|
||||
boolean isExpirationUpdate,
|
||||
boolean isViewOnce,
|
||||
boolean isEndSession,
|
||||
boolean isProfileKeyUpdate,
|
||||
boolean hasProfileKey,
|
||||
Optional<Reaction> reaction,
|
||||
Optional<Quote> quote,
|
||||
@ -108,27 +116,53 @@ public record MessageEnvelope(
|
||||
Optional<Long> remoteDeleteId,
|
||||
Optional<Sticker> sticker,
|
||||
List<SharedContact> sharedContacts,
|
||||
Optional<PollCreate> pollCreate,
|
||||
Optional<PollVote> pollVote,
|
||||
Optional<PollTerminate> pollTerminate,
|
||||
List<Mention> mentions,
|
||||
List<Preview> previews
|
||||
List<Preview> previews,
|
||||
List<TextStyle> textStyles,
|
||||
Optional<PinMessage> pinMessage,
|
||||
Optional<UnpinMessage> unpinMessage,
|
||||
Optional<AdminDelete> adminDelete
|
||||
) {
|
||||
|
||||
static Data from(
|
||||
final SignalServiceDataMessage dataMessage,
|
||||
Map<String, String> longTexts,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver,
|
||||
final AttachmentFileProvider fileProvider
|
||||
) {
|
||||
var body = dataMessage.getBody();
|
||||
if (dataMessage.getAttachments().isPresent()) {
|
||||
for (final var attachment : dataMessage.getAttachments().get()) {
|
||||
if (MimeUtils.LONG_TEXT.equals(attachment.getContentType()) && attachment.isPointer()) {
|
||||
final var longBody = longTexts.get(attachment.asPointer().getRemoteId().toString());
|
||||
if (longBody != null) {
|
||||
body = Optional.of(longBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return new Data(dataMessage.getTimestamp(),
|
||||
dataMessage.getGroupContext().map(GroupContext::from),
|
||||
dataMessage.getStoryContext()
|
||||
.map((SignalServiceDataMessage.StoryContext storyContext) -> StoryContext.from(storyContext,
|
||||
recipientResolver,
|
||||
addressResolver)),
|
||||
dataMessage.getGroupCallUpdate().map(GroupCallUpdate::from),
|
||||
dataMessage.getBody(),
|
||||
body,
|
||||
dataMessage.getExpiresInSeconds(),
|
||||
dataMessage.isExpirationUpdate(),
|
||||
dataMessage.isViewOnce(),
|
||||
dataMessage.isEndSession(),
|
||||
false,
|
||||
dataMessage.isProfileKeyUpdate(),
|
||||
dataMessage.getProfileKey().isPresent(),
|
||||
dataMessage.getReaction().map(r -> Reaction.from(r, recipientResolver, addressResolver)),
|
||||
dataMessage.getQuote().map(q -> Quote.from(q, recipientResolver, addressResolver, fileProvider)),
|
||||
dataMessage.getQuote()
|
||||
.filter(q -> q.getAuthor() != null && q.getAuthor().isValid())
|
||||
.map(q -> Quote.from(q, recipientResolver, addressResolver, fileProvider)),
|
||||
dataMessage.getPayment().map(p -> p.getPaymentNotification().isPresent() ? Payment.from(p) : null),
|
||||
dataMessage.getAttachments()
|
||||
.map(a -> a.stream().map(as -> Attachment.from(as, fileProvider)).toList())
|
||||
@ -140,12 +174,21 @@ public record MessageEnvelope(
|
||||
.map(sharedContact -> SharedContact.from(sharedContact, fileProvider))
|
||||
.toList())
|
||||
.orElse(List.of()),
|
||||
dataMessage.getPollCreate().map(PollCreate::from),
|
||||
dataMessage.getPollVote().map(p -> PollVote.from(p, recipientResolver, addressResolver)),
|
||||
dataMessage.getPollTerminate().map(PollTerminate::from),
|
||||
dataMessage.getMentions()
|
||||
.map(a -> a.stream().map(m -> Mention.from(m, recipientResolver, addressResolver)).toList())
|
||||
.orElse(List.of()),
|
||||
dataMessage.getPreviews()
|
||||
.map(a -> a.stream().map(preview -> Preview.from(preview, fileProvider)).toList())
|
||||
.orElse(List.of()));
|
||||
.orElse(List.of()),
|
||||
dataMessage.getBodyRanges()
|
||||
.map(a -> a.stream().filter(r -> r.style != null).map(TextStyle::from).toList())
|
||||
.orElse(List.of()),
|
||||
dataMessage.getPinnedMessage().map(p -> PinMessage.from(p, recipientResolver, addressResolver)),
|
||||
dataMessage.getUnpinnedMessage().map(p -> UnpinMessage.from(p, recipientResolver, addressResolver)),
|
||||
dataMessage.getAdminDelete().map(p -> AdminDelete.from(p, recipientResolver, addressResolver)));
|
||||
}
|
||||
|
||||
public record GroupContext(GroupId groupId, boolean isGroupUpdate, int revision) {
|
||||
@ -166,6 +209,18 @@ public record MessageEnvelope(
|
||||
}
|
||||
}
|
||||
|
||||
public record StoryContext(RecipientAddress author, long sentTimestamp) {
|
||||
|
||||
static StoryContext from(
|
||||
SignalServiceDataMessage.StoryContext storyContext,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new StoryContext(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(
|
||||
storyContext.getAuthorServiceId())).toApiRecipientAddress(), storyContext.getSentTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
public record GroupCallUpdate(String eraId) {
|
||||
|
||||
static GroupCallUpdate from(SignalServiceDataMessage.GroupCallUpdate groupCallUpdate) {
|
||||
@ -183,7 +238,8 @@ public record MessageEnvelope(
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new Reaction(reaction.getTargetSentTimestamp(),
|
||||
addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(reaction.getTargetAuthor())),
|
||||
addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(reaction.getTargetAuthor()))
|
||||
.toApiRecipientAddress(),
|
||||
reaction.getEmoji(),
|
||||
reaction.isRemove());
|
||||
}
|
||||
@ -194,7 +250,8 @@ public record MessageEnvelope(
|
||||
RecipientAddress author,
|
||||
Optional<String> text,
|
||||
List<Mention> mentions,
|
||||
List<Attachment> attachments
|
||||
List<Attachment> attachments,
|
||||
List<TextStyle> textStyles
|
||||
) {
|
||||
|
||||
static Quote from(
|
||||
@ -204,17 +261,25 @@ public record MessageEnvelope(
|
||||
final AttachmentFileProvider fileProvider
|
||||
) {
|
||||
return new Quote(quote.getId(),
|
||||
addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(quote.getAuthor())),
|
||||
Optional.ofNullable(quote.getText()),
|
||||
addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(quote.getAuthor()))
|
||||
.toApiRecipientAddress(),
|
||||
Optional.of(quote.getText()),
|
||||
quote.getMentions() == null
|
||||
? List.of()
|
||||
: quote.getMentions()
|
||||
.stream()
|
||||
.map(m -> Mention.from(m, recipientResolver, addressResolver))
|
||||
.toList(),
|
||||
.stream()
|
||||
.map(m -> Mention.from(m, recipientResolver, addressResolver))
|
||||
.toList(),
|
||||
quote.getAttachments() == null
|
||||
? List.of()
|
||||
: quote.getAttachments().stream().map(a -> Attachment.from(a, fileProvider)).toList());
|
||||
: quote.getAttachments().stream().map(a -> Attachment.from(a, fileProvider)).toList(),
|
||||
quote.getBodyRanges() == null
|
||||
? List.of()
|
||||
: quote.getBodyRanges()
|
||||
.stream()
|
||||
.filter(r -> r.style != null)
|
||||
.map(TextStyle::from)
|
||||
.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@ -233,9 +298,8 @@ public record MessageEnvelope(
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new Mention(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(mention.getServiceId())),
|
||||
mention.getStart(),
|
||||
mention.getLength());
|
||||
return new Mention(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(mention.getServiceId()))
|
||||
.toApiRecipientAddress(), mention.getStart(), mention.getLength());
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,44 +320,51 @@ public record MessageEnvelope(
|
||||
boolean isBorderless
|
||||
) {
|
||||
|
||||
static Attachment from(SignalServiceAttachment attachment, AttachmentFileProvider fileProvider) {
|
||||
if (attachment.isPointer()) {
|
||||
final var a = attachment.asPointer();
|
||||
return new Attachment(Optional.of(a.getRemoteId().toString()),
|
||||
Optional.of(fileProvider.getFile(a.getRemoteId())),
|
||||
static Attachment from(SignalServiceAttachment signalAttachment, AttachmentFileProvider fileProvider) {
|
||||
if (signalAttachment.isPointer()) {
|
||||
final var a = signalAttachment.asPointer();
|
||||
final var attachmentFile = fileProvider.getFile(a);
|
||||
return new Attachment(Optional.of(attachmentFile.getName()),
|
||||
Optional.of(attachmentFile),
|
||||
a.getFileName(),
|
||||
a.getContentType(),
|
||||
a.getUploadTimestamp() == 0 ? Optional.empty() : Optional.of(a.getUploadTimestamp()),
|
||||
a.getSize().map(Integer::longValue),
|
||||
a.getPreview(),
|
||||
Optional.empty(),
|
||||
a.getCaption(),
|
||||
a.getCaption().map(c -> c.isEmpty() ? null : c),
|
||||
a.getWidth() == 0 ? Optional.empty() : Optional.of(a.getWidth()),
|
||||
a.getHeight() == 0 ? Optional.empty() : Optional.of(a.getHeight()),
|
||||
a.getVoiceNote(),
|
||||
a.isGif(),
|
||||
a.isBorderless());
|
||||
} else {
|
||||
final var a = attachment.asStream();
|
||||
return new Attachment(Optional.empty(),
|
||||
Optional.empty(),
|
||||
a.getFileName(),
|
||||
a.getContentType(),
|
||||
a.getUploadTimestamp() == 0 ? Optional.empty() : Optional.of(a.getUploadTimestamp()),
|
||||
Optional.of(a.getLength()),
|
||||
a.getPreview(),
|
||||
Optional.empty(),
|
||||
a.getCaption(),
|
||||
a.getWidth() == 0 ? Optional.empty() : Optional.of(a.getWidth()),
|
||||
a.getHeight() == 0 ? Optional.empty() : Optional.of(a.getHeight()),
|
||||
a.getVoiceNote(),
|
||||
a.isGif(),
|
||||
a.isBorderless());
|
||||
Attachment attachment = null;
|
||||
try (final var a = signalAttachment.asStream()) {
|
||||
attachment = new Attachment(Optional.empty(),
|
||||
Optional.empty(),
|
||||
a.getFileName(),
|
||||
a.getContentType(),
|
||||
a.getUploadTimestamp() == 0 ? Optional.empty() : Optional.of(a.getUploadTimestamp()),
|
||||
Optional.of(a.getLength()),
|
||||
a.getPreview(),
|
||||
Optional.empty(),
|
||||
a.getCaption(),
|
||||
a.getWidth() == 0 ? Optional.empty() : Optional.of(a.getWidth()),
|
||||
a.getHeight() == 0 ? Optional.empty() : Optional.of(a.getHeight()),
|
||||
a.getVoiceNote(),
|
||||
a.isGif(),
|
||||
a.isBorderless());
|
||||
return attachment;
|
||||
} catch (IOException e) {
|
||||
return attachment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static Attachment from(
|
||||
SignalServiceDataMessage.Quote.QuotedAttachment a, final AttachmentFileProvider fileProvider
|
||||
SignalServiceDataMessage.Quote.QuotedAttachment a,
|
||||
final AttachmentFileProvider fileProvider
|
||||
) {
|
||||
return new Attachment(Optional.empty(),
|
||||
Optional.empty(),
|
||||
@ -345,7 +416,7 @@ public record MessageEnvelope(
|
||||
}
|
||||
|
||||
public record Name(
|
||||
Optional<String> display,
|
||||
Optional<String> nickname,
|
||||
Optional<String> given,
|
||||
Optional<String> family,
|
||||
Optional<String> prefix,
|
||||
@ -354,7 +425,7 @@ public record MessageEnvelope(
|
||||
) {
|
||||
|
||||
static Name from(org.whispersystems.signalservice.api.messages.shared.SharedContact.Name name) {
|
||||
return new Name(name.getDisplay(),
|
||||
return new Name(name.getNickname(),
|
||||
name.getGiven(),
|
||||
name.getFamily(),
|
||||
name.getPrefix(),
|
||||
@ -436,15 +507,15 @@ public record MessageEnvelope(
|
||||
) {
|
||||
|
||||
static Address from(org.whispersystems.signalservice.api.messages.shared.SharedContact.PostalAddress address) {
|
||||
return new Address(Address.Type.from(address.getType()),
|
||||
return new Address(Type.from(address.getType()),
|
||||
address.getLabel(),
|
||||
address.getLabel(),
|
||||
address.getLabel(),
|
||||
address.getLabel(),
|
||||
address.getLabel(),
|
||||
address.getLabel(),
|
||||
address.getLabel(),
|
||||
address.getLabel());
|
||||
address.getStreet(),
|
||||
address.getPobox(),
|
||||
address.getNeighborhood(),
|
||||
address.getCity(),
|
||||
address.getRegion(),
|
||||
address.getPostcode(),
|
||||
address.getCountry());
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
@ -463,11 +534,47 @@ public record MessageEnvelope(
|
||||
}
|
||||
}
|
||||
|
||||
public record PollCreate(
|
||||
String question, boolean allowMultiple, List<String> options
|
||||
) {
|
||||
|
||||
static PollCreate from(
|
||||
SignalServiceDataMessage.PollCreate pollCreate
|
||||
) {
|
||||
return new PollCreate(pollCreate.getQuestion(), pollCreate.getAllowMultiple(), pollCreate.getOptions());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public record PollVote(
|
||||
RecipientAddress targetAuthor, long targetSentTimestamp, List<Integer> optionIndexes, int voteCount
|
||||
) {
|
||||
|
||||
static PollVote from(
|
||||
SignalServiceDataMessage.PollVote pollVote,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new PollVote(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(pollVote.getTargetAuthor()))
|
||||
.toApiRecipientAddress(),
|
||||
pollVote.getTargetSentTimestamp(),
|
||||
pollVote.getOptionIndexes(),
|
||||
pollVote.getVoteCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public record PollTerminate(long targetSentTimestamp) {
|
||||
|
||||
static PollTerminate from(SignalServiceDataMessage.PollTerminate pollTerminate) {
|
||||
return new PollTerminate(pollTerminate.getTargetSentTimestamp());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public record Preview(String title, String description, long date, String url, Optional<Attachment> image) {
|
||||
|
||||
static Preview from(
|
||||
SignalServicePreview preview, final AttachmentFileProvider fileProvider
|
||||
) {
|
||||
static Preview from(SignalServicePreview preview, final AttachmentFileProvider fileProvider) {
|
||||
return new Preview(preview.getTitle(),
|
||||
preview.getDescription(),
|
||||
preview.getDate(),
|
||||
@ -475,6 +582,70 @@ public record MessageEnvelope(
|
||||
preview.getImage().map(as -> Attachment.from(as, fileProvider)));
|
||||
}
|
||||
}
|
||||
|
||||
public record PinMessage(
|
||||
RecipientAddress targetAuthor, long targetSentTimestamp, long pinDurationSeconds
|
||||
) {
|
||||
|
||||
static PinMessage from(
|
||||
SignalServiceDataMessage.PinnedMessage pinnedMessage,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new PinMessage(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(
|
||||
pinnedMessage.getTargetAuthor())).toApiRecipientAddress(),
|
||||
pinnedMessage.getTargetSentTimestamp(),
|
||||
Boolean.TRUE.equals(pinnedMessage.getForever())
|
||||
? -1
|
||||
: pinnedMessage.getPinDurationInSeconds() == null
|
||||
? 0
|
||||
: pinnedMessage.getPinDurationInSeconds());
|
||||
}
|
||||
}
|
||||
|
||||
public record UnpinMessage(RecipientAddress targetAuthor, long targetSentTimestamp) {
|
||||
|
||||
static UnpinMessage from(
|
||||
SignalServiceDataMessage.UnpinnedMessage unpinnedMessage,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new UnpinMessage(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(
|
||||
unpinnedMessage.getTargetAuthor())).toApiRecipientAddress(),
|
||||
unpinnedMessage.getTargetSentTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
public record AdminDelete(RecipientAddress targetAuthor, long targetSentTimestamp) {
|
||||
|
||||
static AdminDelete from(
|
||||
SignalServiceDataMessage.AdminDelete adminDelete,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new AdminDelete(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(
|
||||
adminDelete.getTargetAuthor())).toApiRecipientAddress(), adminDelete.getTargetSentTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public record Edit(long targetSentTimestamp, Data dataMessage) {
|
||||
|
||||
public static Edit from(
|
||||
final SignalServiceEditMessage editMessage,
|
||||
Map<String, String> longTexts,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver,
|
||||
final AttachmentFileProvider fileProvider
|
||||
) {
|
||||
return new Edit(editMessage.getTargetSentTimestamp(),
|
||||
Data.from(editMessage.getDataMessage(),
|
||||
longTexts,
|
||||
recipientResolver,
|
||||
addressResolver,
|
||||
fileProvider));
|
||||
}
|
||||
}
|
||||
|
||||
public record Sync(
|
||||
@ -490,12 +661,13 @@ public record MessageEnvelope(
|
||||
|
||||
public static Sync from(
|
||||
final SignalServiceSyncMessage syncMessage,
|
||||
Map<String, String> longTexts,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver,
|
||||
final AttachmentFileProvider fileProvider
|
||||
) {
|
||||
return new Sync(syncMessage.getSent()
|
||||
.map(s -> Sent.from(s, recipientResolver, addressResolver, fileProvider)),
|
||||
.map(s -> Sent.from(s, longTexts, recipientResolver, addressResolver, fileProvider)),
|
||||
syncMessage.getBlockedList().map(b -> Blocked.from(b, recipientResolver, addressResolver)),
|
||||
syncMessage.getRead()
|
||||
.map(r -> r.stream().map(rm -> Read.from(rm, recipientResolver, addressResolver)).toList())
|
||||
@ -517,11 +689,14 @@ public record MessageEnvelope(
|
||||
long expirationStartTimestamp,
|
||||
Optional<RecipientAddress> destination,
|
||||
Set<RecipientAddress> recipients,
|
||||
Data message
|
||||
Optional<Data> message,
|
||||
Optional<Edit> editMessage,
|
||||
Optional<Story> story
|
||||
) {
|
||||
|
||||
static Sent from(
|
||||
SentTranscriptMessage sentMessage,
|
||||
Map<String, String> longTexts,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver,
|
||||
final AttachmentFileProvider fileProvider
|
||||
@ -529,12 +704,26 @@ public record MessageEnvelope(
|
||||
return new Sent(sentMessage.getTimestamp(),
|
||||
sentMessage.getExpirationStartTimestamp(),
|
||||
sentMessage.getDestination()
|
||||
.map(d -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(d))),
|
||||
.map(d -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(d))
|
||||
.toApiRecipientAddress()),
|
||||
sentMessage.getRecipients()
|
||||
.stream()
|
||||
.map(d -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(d)))
|
||||
.map(d -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(d))
|
||||
.toApiRecipientAddress())
|
||||
.collect(Collectors.toSet()),
|
||||
Data.from(sentMessage.getMessage(), recipientResolver, addressResolver, fileProvider));
|
||||
sentMessage.getDataMessage()
|
||||
.map(message -> Data.from(message,
|
||||
longTexts,
|
||||
recipientResolver,
|
||||
addressResolver,
|
||||
fileProvider)),
|
||||
sentMessage.getEditMessage()
|
||||
.map(message -> Edit.from(message,
|
||||
longTexts,
|
||||
recipientResolver,
|
||||
addressResolver,
|
||||
fileProvider)),
|
||||
sentMessage.getStoryMessage().map(s -> Story.from(s, fileProvider)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -545,10 +734,12 @@ public record MessageEnvelope(
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new Blocked(blockedListMessage.getAddresses()
|
||||
.stream()
|
||||
.map(d -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(d)))
|
||||
.toList(), blockedListMessage.getGroupIds().stream().map(GroupId::unknownVersion).toList());
|
||||
return new Blocked(blockedListMessage.individuals.stream()
|
||||
.map(d -> new RecipientAddress(d.getAci() == null ? null : d.getAci().toString(),
|
||||
null,
|
||||
d.getE164(),
|
||||
null))
|
||||
.toList(), blockedListMessage.groupIds.stream().map(GroupId::unknownVersion).toList());
|
||||
}
|
||||
}
|
||||
|
||||
@ -559,8 +750,8 @@ public record MessageEnvelope(
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new Read(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(readMessage.getSender())),
|
||||
readMessage.getTimestamp());
|
||||
return new Read(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(readMessage.getSenderAci()))
|
||||
.toApiRecipientAddress(), readMessage.getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
@ -571,8 +762,8 @@ public record MessageEnvelope(
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new Viewed(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(readMessage.getSender())),
|
||||
readMessage.getTimestamp());
|
||||
return new Viewed(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(readMessage.getSender()))
|
||||
.toApiRecipientAddress(), readMessage.getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
@ -584,7 +775,7 @@ public record MessageEnvelope(
|
||||
RecipientAddressResolver addressResolver
|
||||
) {
|
||||
return new ViewOnceOpen(addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(
|
||||
readMessage.getSender())), readMessage.getTimestamp());
|
||||
readMessage.getSender())).toApiRecipientAddress(), readMessage.getTimestamp());
|
||||
}
|
||||
}
|
||||
|
||||
@ -612,7 +803,8 @@ public record MessageEnvelope(
|
||||
return new MessageRequestResponse(Type.from(messageRequestResponse.getType()),
|
||||
messageRequestResponse.getGroupId().map(GroupId::unknownVersion),
|
||||
messageRequestResponse.getPerson()
|
||||
.map(p -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(p))));
|
||||
.map(p -> addressResolver.resolveRecipientAddress(recipientResolver.resolveRecipient(p))
|
||||
.toApiRecipientAddress()));
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
@ -621,7 +813,9 @@ public record MessageEnvelope(
|
||||
DELETE,
|
||||
BLOCK,
|
||||
BLOCK_AND_DELETE,
|
||||
UNBLOCK_AND_ACCEPT;
|
||||
UNBLOCK_AND_ACCEPT,
|
||||
SPAM,
|
||||
BLOCK_AND_SPAM;
|
||||
|
||||
static Type from(MessageRequestResponseMessage.Type type) {
|
||||
return switch (type) {
|
||||
@ -631,6 +825,8 @@ public record MessageEnvelope(
|
||||
case BLOCK -> BLOCK;
|
||||
case BLOCK_AND_DELETE -> BLOCK_AND_DELETE;
|
||||
case UNBLOCK_AND_ACCEPT -> UNBLOCK_AND_ACCEPT;
|
||||
case SPAM -> SPAM;
|
||||
case BLOCK_AND_SPAM -> BLOCK_AND_SPAM;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -646,7 +842,8 @@ public record MessageEnvelope(
|
||||
Optional<Hangup> hangup,
|
||||
Optional<Busy> busy,
|
||||
List<IceUpdate> iceUpdate,
|
||||
Optional<Opaque> opaque
|
||||
Optional<Opaque> opaque,
|
||||
boolean isUrgent
|
||||
) {
|
||||
|
||||
public static Call from(final SignalServiceCallMessage callMessage) {
|
||||
@ -660,16 +857,14 @@ public record MessageEnvelope(
|
||||
callMessage.getIceUpdateMessages()
|
||||
.map(m -> m.stream().map(IceUpdate::from).toList())
|
||||
.orElse(List.of()),
|
||||
callMessage.getOpaqueMessage().map(Opaque::from));
|
||||
callMessage.getOpaqueMessage().map(Opaque::from),
|
||||
callMessage.isUrgent());
|
||||
}
|
||||
|
||||
public record Offer(long id, String sdp, Type type, byte[] opaque) {
|
||||
public record Offer(long id, Type type, byte[] opaque) {
|
||||
|
||||
static Offer from(OfferMessage offerMessage) {
|
||||
return new Offer(offerMessage.getId(),
|
||||
offerMessage.getSdp(),
|
||||
Type.from(offerMessage.getType()),
|
||||
offerMessage.getOpaque());
|
||||
return new Offer(offerMessage.getId(), Type.from(offerMessage.getType()), offerMessage.getOpaque());
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
@ -685,10 +880,10 @@ public record MessageEnvelope(
|
||||
}
|
||||
}
|
||||
|
||||
public record Answer(long id, String sdp, byte[] opaque) {
|
||||
public record Answer(long id, byte[] opaque) {
|
||||
|
||||
static Answer from(AnswerMessage answerMessage) {
|
||||
return new Answer(answerMessage.getId(), answerMessage.getSdp(), answerMessage.getOpaque());
|
||||
return new Answer(answerMessage.getId(), answerMessage.getOpaque());
|
||||
}
|
||||
}
|
||||
|
||||
@ -699,13 +894,12 @@ public record MessageEnvelope(
|
||||
}
|
||||
}
|
||||
|
||||
public record Hangup(long id, Type type, int deviceId, boolean isLegacy) {
|
||||
public record Hangup(long id, Type type, int deviceId) {
|
||||
|
||||
static Hangup from(HangupMessage hangupMessage) {
|
||||
return new Hangup(hangupMessage.getId(),
|
||||
Type.from(hangupMessage.getType()),
|
||||
hangupMessage.getDeviceId(),
|
||||
hangupMessage.isLegacy());
|
||||
hangupMessage.getDeviceId());
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
@ -727,10 +921,10 @@ public record MessageEnvelope(
|
||||
}
|
||||
}
|
||||
|
||||
public record IceUpdate(long id, String sdp, byte[] opaque) {
|
||||
public record IceUpdate(long id, byte[] opaque) {
|
||||
|
||||
static IceUpdate from(IceUpdateMessage iceUpdateMessage) {
|
||||
return new IceUpdate(iceUpdateMessage.getId(), iceUpdateMessage.getSdp(), iceUpdateMessage.getOpaque());
|
||||
return new IceUpdate(iceUpdateMessage.getId(), iceUpdateMessage.getOpaque());
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,52 +948,136 @@ public record MessageEnvelope(
|
||||
}
|
||||
}
|
||||
|
||||
public record Story(
|
||||
boolean allowsReplies,
|
||||
Optional<GroupId> groupId,
|
||||
Optional<Data.Attachment> fileAttachment,
|
||||
Optional<TextAttachment> textAttachment
|
||||
) {
|
||||
|
||||
public static Story from(SignalServiceStoryMessage storyMessage, final AttachmentFileProvider fileProvider) {
|
||||
return new Story(storyMessage.getAllowsReplies().orElse(false),
|
||||
storyMessage.getGroupContext().map(c -> GroupUtils.getGroupIdV2(c.getMasterKey())),
|
||||
storyMessage.getFileAttachment().map(f -> Data.Attachment.from(f, fileProvider)),
|
||||
storyMessage.getTextAttachment().map(t -> TextAttachment.from(t, fileProvider)));
|
||||
}
|
||||
|
||||
public record TextAttachment(
|
||||
Optional<String> text,
|
||||
Optional<Style> style,
|
||||
Optional<Color> textForegroundColor,
|
||||
Optional<Color> textBackgroundColor,
|
||||
Optional<Data.Preview> preview,
|
||||
Optional<Gradient> backgroundGradient,
|
||||
Optional<Color> backgroundColor
|
||||
) {
|
||||
|
||||
static TextAttachment from(
|
||||
SignalServiceTextAttachment textAttachment,
|
||||
final AttachmentFileProvider fileProvider
|
||||
) {
|
||||
return new TextAttachment(textAttachment.getText(),
|
||||
textAttachment.getStyle().map(Style::from),
|
||||
textAttachment.getTextForegroundColor().map(Color::new),
|
||||
textAttachment.getTextBackgroundColor().map(Color::new),
|
||||
textAttachment.getPreview().map(p -> Data.Preview.from(p, fileProvider)),
|
||||
textAttachment.getBackgroundGradient().map(Gradient::from),
|
||||
textAttachment.getBackgroundColor().map(Color::new));
|
||||
}
|
||||
|
||||
public enum Style {
|
||||
DEFAULT,
|
||||
REGULAR,
|
||||
BOLD,
|
||||
SERIF,
|
||||
SCRIPT,
|
||||
CONDENSED;
|
||||
|
||||
static Style from(SignalServiceTextAttachment.Style style) {
|
||||
return switch (style) {
|
||||
case DEFAULT -> DEFAULT;
|
||||
case REGULAR -> REGULAR;
|
||||
case BOLD -> BOLD;
|
||||
case SERIF -> SERIF;
|
||||
case SCRIPT -> SCRIPT;
|
||||
case CONDENSED -> CONDENSED;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public record Gradient(
|
||||
List<Color> colors, List<Float> positions, Optional<Integer> angle
|
||||
) {
|
||||
|
||||
static Gradient from(SignalServiceTextAttachment.Gradient gradient) {
|
||||
return new Gradient(gradient.getColors().stream().map(Color::new).toList(),
|
||||
gradient.getPositions(),
|
||||
gradient.getAngle());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static MessageEnvelope from(
|
||||
SignalServiceEnvelope envelope,
|
||||
SignalServiceContent content,
|
||||
Map<String, String> longTexts,
|
||||
RecipientResolver recipientResolver,
|
||||
RecipientAddressResolver addressResolver,
|
||||
final AttachmentFileProvider fileProvider,
|
||||
Exception exception
|
||||
) {
|
||||
final var source = !envelope.isUnidentifiedSender() && envelope.hasSourceUuid()
|
||||
? recipientResolver.resolveRecipient(envelope.getSourceAddress())
|
||||
final var serviceId = envelope.getSourceServiceId();
|
||||
final var source = !envelope.isUnidentifiedSender() && serviceId != null
|
||||
? recipientResolver.resolveRecipient(serviceId)
|
||||
: envelope.isUnidentifiedSender() && content != null
|
||||
? recipientResolver.resolveRecipient(content.getSender())
|
||||
? recipientResolver.resolveRecipient(content.getSender())
|
||||
: exception instanceof ProtocolException e
|
||||
? recipientResolver.resolveRecipient(e.getSender())
|
||||
? recipientResolver.resolveRecipient(e.getSender())
|
||||
: null;
|
||||
final var sourceDevice = envelope.hasSourceDevice()
|
||||
? envelope.getSourceDevice()
|
||||
: content != null
|
||||
? content.getSenderDevice()
|
||||
? content.getSenderDevice()
|
||||
: exception instanceof ProtocolException e ? e.getSenderDevice() : 0;
|
||||
|
||||
Optional<Receipt> receipt;
|
||||
Optional<Typing> typing;
|
||||
Optional<Data> data;
|
||||
Optional<Edit> edit;
|
||||
Optional<Sync> sync;
|
||||
Optional<Call> call;
|
||||
Optional<Story> story;
|
||||
if (content != null) {
|
||||
receipt = content.getReceiptMessage().map(Receipt::from);
|
||||
typing = content.getTypingMessage().map(Typing::from);
|
||||
data = content.getDataMessage()
|
||||
.map(dataMessage -> Data.from(dataMessage, recipientResolver, addressResolver, fileProvider));
|
||||
sync = content.getSyncMessage().map(s -> Sync.from(s, recipientResolver, addressResolver, fileProvider));
|
||||
.map(dataMessage -> Data.from(dataMessage,
|
||||
longTexts,
|
||||
recipientResolver,
|
||||
addressResolver,
|
||||
fileProvider));
|
||||
edit = content.getEditMessage()
|
||||
.map(s -> Edit.from(s, longTexts, recipientResolver, addressResolver, fileProvider));
|
||||
sync = content.getSyncMessage()
|
||||
.map(s -> Sync.from(s, longTexts, recipientResolver, addressResolver, fileProvider));
|
||||
call = content.getCallMessage().map(Call::from);
|
||||
story = content.getStoryMessage().map(s -> Story.from(s, fileProvider));
|
||||
} else {
|
||||
receipt = envelope.isReceipt() ? Optional.of(new Receipt(envelope.getServerReceivedTimestamp(),
|
||||
Receipt.Type.DELIVERY,
|
||||
List.of(envelope.getTimestamp()))) : Optional.empty();
|
||||
typing = Optional.empty();
|
||||
data = Optional.empty();
|
||||
edit = Optional.empty();
|
||||
sync = Optional.empty();
|
||||
call = Optional.empty();
|
||||
story = Optional.empty();
|
||||
}
|
||||
|
||||
return new MessageEnvelope(source == null
|
||||
? Optional.empty()
|
||||
: Optional.of(addressResolver.resolveRecipientAddress(source)),
|
||||
: Optional.of(addressResolver.resolveRecipientAddress(source).toApiRecipientAddress()),
|
||||
sourceDevice,
|
||||
envelope.getTimestamp(),
|
||||
envelope.getServerReceivedTimestamp(),
|
||||
@ -808,12 +1086,14 @@ public record MessageEnvelope(
|
||||
receipt,
|
||||
typing,
|
||||
data,
|
||||
edit,
|
||||
sync,
|
||||
call);
|
||||
call,
|
||||
story);
|
||||
}
|
||||
|
||||
public interface AttachmentFileProvider {
|
||||
|
||||
File getFile(SignalServiceAttachmentRemoteId attachmentRemoteId);
|
||||
File getFile(SignalServiceAttachmentPointer pointer);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,12 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class NonNormalizedPhoneNumberException extends Exception {
|
||||
|
||||
public NonNormalizedPhoneNumberException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public NonNormalizedPhoneNumberException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
package org.asamk.signal.manager.groups;
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class NotAGroupMemberException extends Exception {
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class NotMasterDeviceException extends Exception {
|
||||
public class NotPrimaryDeviceException extends Exception {
|
||||
|
||||
public NotMasterDeviceException() {
|
||||
public NotPrimaryDeviceException() {
|
||||
super("This function is not supported for linked devices.");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package org.asamk.signal.manager.api;
|
||||
|
||||
public class PendingAdminApprovalException extends Exception {
|
||||
|
||||
public PendingAdminApprovalException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public PendingAdminApprovalException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
@ -3,5 +3,16 @@ package org.asamk.signal.manager.api;
|
||||
public enum PhoneNumberSharingMode {
|
||||
EVERYBODY,
|
||||
CONTACTS,
|
||||
NOBODY,
|
||||
NOBODY;
|
||||
|
||||
public static PhoneNumberSharingMode valueOfOrNull(String value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return valueOf(value);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user