Commit Graph

148 Commits

Author SHA1 Message Date
Jonathan Klabunde Tomer
0453438d98 Prepare libsignal-server Java build for arm64 2024-07-30 13:37:55 -07:00
Sergey Skrobotov
d694cff1a1 net: adding a parameter to opt in/out of receiving stories 2024-07-25 14:55:23 -07:00
Alex Konradi
66cd3f0133 backup: bridge canonical serialization as ComparableBackup 2024-07-16 14:20:31 -04:00
moiseev-signal
f794998389 SVR3: implement migrate API 2024-07-10 11:40:56 -07:00
Alex Konradi
0e4d420f69 Add libsignal-jni-testing crate with test-only functions for Java
This parallels the exiting libsignal-jni crate but exports functions from 
libsignal-bridge-testing instead of libsignal-bridge. The crate is compiled as 
a separate shared object that is included in the published libsignal package, 
but which can be excluded at Android packaging time.
2024-07-09 13:07:36 -04:00
Alex Konradi
c6857dd58e Don't assume EOF on 0-length read for Node
Remove the special handling code that detects EOF now that the upstream crate 
has fixed the bug that was being worked around. This also fixes a bug where EOF 
was being incorrectly detected when the provided buffer was empty. Add a test 
case to prevent regression in the future.
2024-07-09 11:58:43 -04:00
Chris Eager
2b5b51c7b3 Fix error string whitespace 2024-06-21 16:34:27 -07:00
Jordan Rose
4e2a7de574 Expose the 'Stopped' event to Swift and Node
Swift: ChatListener.chatServiceConnectionWasInterrupted(_:)
Node: ChatServiceListener.onConnectionInterrupted()
2024-06-13 15:54:21 -07:00
Jordan Rose
4791773954 java: Add -P debugLevelLogs as a Gradle build option
Similar to the previous commits, but for Java/Android. If invoking
build_jni.sh directly, use `--debug-level-logs` like build_ffi.sh.

As a consequence, LOGGING IS NO LONGER AUTOMATICALLY ENABLED FOR
JAVA/ANDROID. Clients must call SignalProtocolLoggerProvider.
initializeLogging() in addition to setting a provider.
2024-06-13 12:08:31 -07:00
Jordan Rose
44b6057bce java (mostly): audit for checked AttestationFailedException
The "mostly" is because there was one place in the Rust layer where
establishing attestation could *additionally* generate a Noise error
(theoretically, not in practice), which gets turned into an
SgxCommunicationFailureException (suboptimally named now that we have
non-SGX enclaves, but oh well). Change that to treat that as an
AttestationData error as well, since it *is* about the data that comes
from the attestation blob rather than the actual Noise handshake.
2024-06-05 15:59:21 -07:00
Jordan Rose
9a8429da46 net: Add AppExpired and DeviceDeregistered errors for ChatService
And check bridging for every high-level ChatServiceError like we do
with CdsiLookupErrors.
2024-05-23 10:27:28 -07:00
Jordan Rose
a5fa231a1c bridge: Expose ChatService_InjectRawServerRequest for testing 2024-05-21 13:04:18 -07:00
Jordan Rose
a513d61a09 bridge: Expose ChatListener to Swift
(and lay groundwork for the other bridges)
2024-05-21 13:04:18 -07:00
moiseev-signal
70ba17491c SVR3: Implement remove API 2024-05-21 10:33:33 -07:00
Jon Chambers
59addf10ec Make ECPrivateKey#<init>(byte[]) public 2024-05-20 18:09:50 -04:00
Jordan Rose
b9e021659b java: Check for invalid key sizes more thoroughly in ECPublicKey 2024-05-20 10:41:55 -07:00
Jordan Rose
7dc63b99af ffi: Expose cancellation to Swift 2024-05-17 11:30:24 -07:00
Jordan Rose
99e337f552 bridge: Expose authenticated sends on ChatService 2024-05-15 15:48:47 -07:00
Jordan Rose
a09eb567f0 net: "Poison" the TCP connector if an invalid proxy is set
This ensures that if there's an error setting a proxy, the previous
settings won't continue to be used for new connections.

This only applies to the Java, Swift, and TypeScript layers; the Rust
layer's set_proxy isn't a fallible API in the first place today. The
Java API now explicitly throws a checked IOException instead of
IllegalArgumentException.
2024-05-08 16:18:03 -07:00
Sergey Skrobotov
ab733bf00a libsignal-net: support for User-Agent header 2024-05-01 20:02:08 -07:00
Alex Konradi
32dc8c27d8 Revert "Remove ProfileKeyCredentialPresentationV1" 2024-05-01 17:12:48 -04:00
Jordan Rose
cc12c6f3c8 Make ServiceId Ord/Comparable
ACIs are sorted before PNIs, then the UUIDs are sorted by their
(unsigned) bytes. This provides a total order, if a relatively
arbitrary one.
2024-05-01 10:34:21 -07:00
Alex Konradi
53699f11db java: save the class loader on initialization
Instead of using a hardcoded list of class definitions to attempt to preload, 
save the ClassLoader instance when libsignal is loaded and use that to do class 
lookups by name.
2024-04-30 13:04:49 -04:00
Alex Konradi
6edd0540fb java: add async class load method
Add a method to allow Java code to attempt to load a class on a Tokio worker 
thread like libsignal does internally. This will be used for testing both in 
libsignal and in dependents.

Fix a bug where exceptions raised during conversion from Rust result values to 
Java values weren't being correctly propagated to the Java Future that would 
report the result.
2024-04-29 13:08:10 -04:00
Jordan Rose
9d622d9bcb android: Add rustls-platform-verifier support 2024-04-24 14:13:30 -07:00
Jordan Rose
9f53f3d1e7 BackupAuthCredential: verify the redemption time on receive
This is passed both within the credential response and outside it, so
it's important to make sure the two times match.
2024-04-19 13:41:59 -07:00
ravi-signal
9204831745 Use an enum for BackupAuthCredential's level 2024-04-19 11:46:49 -07:00
Jordan Rose
3d2471cc8b Make LIBSIGNAL_TESTING_ env vars available to Android and iOS tests
And adjust the existing ENCLAVE_SECRET tests and examples to use this
(including Rust and Node's).

This also requires adding an AndroidManifest.xml that notes the tests
might use the network.
2024-04-17 16:06:46 -07:00
Max Moiseev
aeb15fffae jni: Implement CompletableFuture.whenComplete 2024-04-16 11:55:46 -07:00
Alex Konradi
f72f33d3ee Remove code that handles auth cred with ACI as PNI
These functions are unused in client and server code.
2024-04-11 17:08:18 -04:00
Alex Konradi
06c1780a14 Hold server zkparams as pointers 2024-04-09 16:13:22 -04:00
Alex Konradi
79bab1ce78 Expose TLS proxy in app libraries
Co-authored-by: Sergey Skrobotov <sergey@signal.org>
2024-04-02 16:22:18 -04:00
Alex Konradi
10a6d8b744 Remove enclave operation timeout arguments
The enclave interactions have internal progress monitoring in the form of 
websocket PING/PONG frames, so the timeout parameters aren't necessary for 
broken connection detection.
2024-03-29 18:13:40 -04:00
Sergey Skrobotov
8c1eadc0e7 libsignal-net: refining ServiceWithReconnect activity states logic 2024-03-29 13:33:19 -07:00
Sergey Skrobotov
aca995d745 libsignal-net: additional API and debug info 2024-03-27 12:39:24 -07:00
Jordan Rose
5d95051dcc java: Accept Collection instead of List if order doesn't matter
This only affects GroupSendEndorsement APIs at this time; everywhere
else List is used, order is significant (or at least must be stable),
or the type is part of an interface or return value.
2024-03-26 10:35:29 -07:00
Alex Konradi
ed19489470 Improve CDSI errors
Add bridging tests for all the CDSI error types, and diversify the types of 
exceptions that can be thrown from Java code.
2024-03-25 13:39:06 -04:00
Sergey Skrobotov
d7a4b8c817 libsignal-net: ChatService jni bridge 2024-03-21 13:19:27 -07:00
Alex Konradi
23764a50e8 Use @CalledFromNative to prevent stripping
Add an annotation, CalledFromNative, and directives in the proguard file that 
recognize it and prevent items it's attached to from being stripped during code 
minification. Use it in place of some existing rules, and add it to methods 
that were already being called from native code.
2024-03-21 14:10:23 -04:00
Alex Konradi
41897ff45e Remove ProfileKeyCredentialPresentationV1
This is no longer constructed in clients, and the last usage of the "structurally
valid" entry points was recently removed.
2024-03-20 17:32:00 -04:00
Jordan Rose
5a05c936a7 GroupSendEndorsementsResponse: Weaken performance claims in docs
Right now the benefits of receiving GroupSendEndorsementsResponse
using member ciphertexts are balanced by the increased cost of
deserializing the full ciphertexts instead of just the part we need.
We can improve things here if needed, but for now let's just not claim
that the ciphertext approach is "significantly" better than the
alternative.
2024-03-18 09:59:16 -07:00
Jordan Rose
37e68943d6 Add GroupSendEndorsement.toFullToken(...) convenience method
If apps want to cache these tokens, they should prefer to cache the
non-"full" version because it won't redundantly contain the
expiration, but if they don't, dealing with two token types is
unnecessary complexity.
2024-03-18 09:59:16 -07:00
Jordan Rose
8ed2dc1195 Remove GroupSendCredential
Long live GroupSendEndorsements!
2024-03-14 12:31:30 -07:00
Jordan Rose
0c940626fb Java: Use strong types for array-of-bytestrings
The choice between byte[] and ByteBuffer is non-obvious, so it's worth
generating Native.java with a little more fidelity.
2024-03-13 12:22:46 -07:00
Jordan Rose
256f4742c7 bridge: Add tests for bridging arrays of bytestrings 2024-03-13 12:22:46 -07:00
Jordan Rose
8fb6cc31cf bridge: Make a combined endorsement for GroupSendEndorsementsResponse
Specifically, make this on the Rust side bridge layer, and tack it on
to the end of per-member endorsements for the app side to peel off
later, rather than the app layer calling back down to Rust to compute
it. This saves a fair amount of marshalling work.
2024-03-12 14:54:04 -07:00
Jordan Rose
bd23dfe195 Java: Add an UNCHECKED_AND_UNCLONED mode for GroupSendEndorsements
...since we sometimes create them in bulk from data coming right out
of libsignal_jni, and for a large enough group the cost of that can be
significant. If data coming from libsignal_jni is wrong, we have
bigger problems! (And we'll also get AssertionErrors when the bad
endorsements used, saying they should have been validated ahead of
time. So it won't go completely unnoticed.)
2024-03-12 14:54:04 -07:00
Alex Konradi
60f066dbac Remove AuthCredential
This hasn't been used in client code for some time.
2024-03-11 16:43:23 -04:00
Jordan Rose
2aa3c34088 java: Implement GroupEndorsement APIs 2024-03-11 13:41:48 -07:00
Jordan Rose
cdef8228a2 bridge: Expose GroupSendEndorsement APIs 2024-03-11 13:41:48 -07:00