Handle the case where the CDS server rejects the HTTP UPGRADE request with a
429 status and includes a Retry-After header by mapping it to the same
RateLimited error variant. Test that and the existing
websocket-close-message-based functionality.
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.
Use AsType<X, String> to convert HTTP method, and header names and values in
the bridging preamble so they can be used infallibly within the function
bodies. Keep the Result<> output for HttpRequest_new so that it can return an
InvalidUri error which, when bridged in Java, will produce a checked exception.
Some lines just have "src/foo.rs" in their debug info, for unclear
reasons. We could collect them into an "unknown crates" bucket, but
that isn't very useful either. This tweak just prevents them from
being collected into a line with no label.
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.
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).
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.
Move the implementation of the CDSI service into its own module to provide
better scoping. Move the CdsiError that is used only for bridging out of
libsignal-net and into the bridging crate.
Benchmarks should normally be run in the release configuration, but CI
just wants to make sure they still work by running them with a debug
libsignal_ffi.a. Instead of making that a fallback, make it
configuration-dependent, so you can't ever accidentally test the wrong
thing.
This saves work for callers that need both, which includes
GroupSendEndorsement: after receiving and validating the endorsements,
they need to get serialized and sent back up to the app layer to put
in its database (compressed), but we also generate an extra
"everyone-but-me" endorsement from the results (decompressed).
This saves quite a bit of time in the app-layer benchmarks, since they
include the cost of serialization.
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.
...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.)
Not actually distinct from Vec<Vec<u8>>, but works better with the
jni_result_type and ffi_result_type macros because `[Vec<u8>]` is a
single grouped token tree. Generalizes the string array helpers to
support bytestrings too.
And while here, simplify the implementation to a form that lends
itself to being a rayon IntoParallelIterator as well (next commit).
(I've named the module `sequences` because I think we might want to
generalize this in the future, but I didn't end up using that in this
series.)