Commit Graph

461 Commits

Author SHA1 Message Date
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
d9f6c0ee3c Bump to version v0.42.0 2024-03-19 16:47:08 -07: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
fca9196201 GroupSendEndorsements: don't fall over in the face of 1-person groups
Previously we'd attempt to create a combination of zero endorsements
for the everybody-but-me credential, and panic (throw an error). Now
we correctly create an endorsement that represents zero people, which
is better than returning some dummy value because it behaves
reasonably if endorsements from multiple groups are combined wholesale
(not something we plan to do, but something that shouldn't have weird
edge cases if we end up needing to).
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
Alex Konradi
6b253b5ddb Continue the size check if GH response is invalid
Continue the rest of the check_code_size.py script if the GH tool invoked by the
script fails or produces unexpected results.
2024-03-13 12:52:42 -04: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
Jordan Rose
17d8737fac Java: Regression test a 1000-person GroupSendEndorsementsResponse 2024-03-12 14:54:04 -07:00
Jordan Rose
93237adc56 Android: Add benchmarks for GroupSendEndorsement
These show quite a bit of overhead over running the Rust benchmarks
directly. Something to look into!
2024-03-12 14:54:04 -07:00
Jordan Rose
54727562fc Android: mark benchmark tests as profilable 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
Alex Konradi
f4f478fd06 Add authentication credential implemented with zkc
Add a new version of the existing auth credential used for groups, but 
implemented with the zkcredential crate instead of hand-written proofs. Expose 
issuance point for the server, and extend existing client methods to support it 
and the existing formats transparently.
2024-03-08 15:38:23 -05:00
Jordan Rose
f896129db9 Java: Update to Gradle 8.4, Android Gradle Plugin 8.3, SDK 34, Java 17
Each of these updates is required for the following update, and the
final one allows us to use 'record'.

The target SDK version is set to 33, matching the Android app.
2024-03-08 10:34:18 -08:00
Sergey Skrobotov
dffb203cbe Bump to version v0.41.1 2024-03-07 14:29:14 -08:00
Jordan Rose
c80ceda985 Java: Allow limiting which archs are built for Android
And use this to cut down CI testing time: only build armv7 and aarch64
slices of the real library, and x86_64 for the testing library (which
we don't even run in the every-commit CI, but we want to make sure we
haven't broken something in that configuration).
2024-03-07 10:15:57 -08:00
Jordan Rose
635051bf63 Fix most recent tag in code_size.json 2024-03-05 10:07:07 -08:00
Sergey Skrobotov
ce37388552 Bump to version v0.41.0 2024-03-01 14:49:33 -08:00
Jon Chambers
1d2d9d9254 Retire old SVR2 enclaves
Co-authored-by: Alex Konradi <akonradi@signal.org>
2024-03-01 15:05:07 -05:00
Alex Konradi
274b680ef4 Expose message backup purpose as an argument
Add a flag to the CLI validation tool and an argument to the bridged validation 
functions so users can specify whether a provided message backup should be 
validated according to the rules for device-to-device transfers or backups 
intended for remote storage.
2024-03-01 09:53:00 -05:00
moiseev-signal
d7d2576ae6 SVR3: FFI bridge 2024-02-29 18:22:59 -08:00
Sergey Skrobotov
ec49a9774b libsignal-net: ChatService node bridge 2024-02-27 11:07:57 -08:00
Jordan Rose
4f4d21a8ca java: Mark all bridge_fns that return Result as throws Exception
Then, use FilterExceptions to filter out any exceptions that aren't
declared in the calling method's exception spec. Note that this isn't
perfect: Java's checks for typed exceptions prevents an *extra*
exception from being thrown this way, but it's still possible to
forget to *allow* an exception using FilterExceptions.

This is 99% a mechanical change; the interesting bit is in
gen_java_decl.py and one unusual pattern in NativeErrorsTest.java. No
exception specs were changed here.
2024-02-22 13:34:57 -08:00
Jordan Rose
8cd6f8c68c java: Add the FilterExceptions helper
These methods wrap any unexpected checked exceptions in AssertionError
after logging them. The next commit will use this to enforce our
exception specifications for methods that wrap JNI calls.
2024-02-22 13:34:57 -08:00
Jordan Rose
77606128c2 Use the default SecureRandom generator for registration IDs
SHA1PRNG may have been more reliable in earlier versions of Android,
but that shouldn't be true anymore.
2024-02-22 12:26:51 -08:00
moiseev-signal
6f783269db SVR3: JNI bridge 2024-02-22 12:22:10 -08:00
Alex Konradi
f980fccd8a Bump to version v0.40.1 2024-02-20 09:48:25 -05:00
Alex Konradi
1359b67486 Cache classes during initial Java library load
Use the class loader from the main thread to cache java.lang.Class
instances for some libsignal classes.

This enables constructing instances of libsignal classes on threads
where the classes aren't accessible via the default class loader. This
can occur on Android, where threads spawned via the native API only get
access to the system class loader, not the application loader that has
access to the application's class files. Since Tokio worker threads are
spawned via the native API, and the completion process for async tasks
converts results to Java objects, application class instances can't be
used there unless they are preloaded.

Since classes used in client code are only included in the client .jar
file, failure to load classes is a normal occurrence. If there are ever
separate builds for server and client .so library files, this could be
changed to a fatal error.
2024-02-16 10:38:12 -05:00
Alex Konradi
8959e64ed1 Build TESTING_ functions for Android test
Run tests that call native TESTING_ functions on Android. This requires 
building a separate version of libsignal_jni.so with the testing functions 
included. The test code is still omitted from the published artifacts.
2024-02-15 16:53:05 -05:00
Max Moiseev
7ef4efdb85 Bump to version 0.40.0 2024-02-12 12:03:40 -08:00
Alex Konradi
100ce19945 Fix Java error handling for CDSI lookup
CDSI error handling code would attempt to instantiate a nonexistent Java class. 
Add the missing class and split up the handling for CDSI lookup errors to reuse 
existing error types.
2024-02-09 15:31:35 -05:00
Jordan Rose
1827eb7780 java: DecryptionErrorMessage deserialization can InvalidKeyException 2024-02-08 15:43:35 -08:00
Jordan Rose
09abe004cc java: HsmEnclaveClient can fail at any point during the protocol 2024-02-08 15:43:35 -08:00
Jordan Rose
204ce07c21 java: Aes256GcmSiv.encrypt can't fail
More specifically, it can't throw an InvalidMessageException, and
IllegalArgumentException is a RuntimeException already.
2024-02-08 15:43:35 -08:00
Alex Konradi
483d220aba Expose CDSI debugPermitsUsed in app libs 2024-02-08 15:25:33 -05:00
Alex Konradi
d08adf19bb Return username candidates as string array
Use the string bridging code introduced previously to provide string arrays to 
client directly instead of joining and splitting. This eliminates the use of a 
magic ',' character as a delimiter.
2024-02-06 09:46:06 -05:00
Alex Konradi
580913d225 Re-throw input stream errors in Swift and Java
Re-raise errors produced by an input stream after bubbling them through Rust 
code. This makes the interface less magic and avoids unnecessary 
stringification of error values.
2024-02-02 15:14:27 -05:00
Alex Konradi
e95f00d849 Print size difference of a PR versus main
Use the GitHub CLI utility, if present, to fetch the size from the logs of the 
"Build and Test" workflow run for the merge-base of the current branch and 
upstream main. This represents the true "delta" attributable to the current 
branch, as opposed to the integral of changes since the last release.
2024-02-01 16:30:42 -05:00
Alex Konradi
c70b66dc8c Bridge message backup validator to Java
Provide a simple API for validating message backups read from InputStream 
instances.
2024-01-26 13:33:36 -05:00
Jordan Rose
b92da3a15c Bump to version v0.39.3 2024-01-24 11:13:13 -08:00
Jordan Rose
1f8701213b zkgroup: Add GroupSendCredentialResponse::receive_with_ciphertexts
If a client already has the members of a group as ciphertexts, it's
more efficient to receive a GroupSendCredential that way, because then
they get to skip the conversion from ServiceId to UidStruct. If they
don't, however, the existing entry point is going to be both more
convenient and faster.

For Swift and Java, this is an overload of the existing receive()
method; for TypeScript, it's receiveWithCiphertexts.
2024-01-22 12:34:34 -08:00
Jordan Rose
fa364bc625 Java: Expose sealed sender certificate classes to the server too 2024-01-22 09:57:38 -08:00
Jordan Rose
a028068efd Java: Expose ServerCertificate and SenderCertificate creation
These are already exposed for testing in TypeScript and Swift.
2024-01-22 09:57:38 -08:00
Jordan Rose
5436160313 Bump to version v0.39.2 2024-01-18 16:04:39 -08:00
Jordan Rose
b31ca0781c Remove length parameter for webpsan
The way images are displayed on Android makes it annoying to provide,
and the implementation of webpsan doesn't actually need it.
2024-01-18 12:36:31 -08:00