Commit Graph

315 Commits

Author SHA1 Message Date
marc-signal
6dd67d52e8 Remove ordered public key comparison 2026-02-02 13:37:11 -05:00
Jordan Rose
6a9f73b998 bridge: Use bridge_callbacks for PreKeyStore (Java bridge)
Adds support for callbacks with results to the JNI bridge, similar to
what f2eafbe6f8 did for the C bridge.

This does require introducing an "internal" version of PreKeyStore
that has simpler signatures for its callbacks; previously, the Java
objects for bridge_handle types were constructed on the Rust side of
the bridge, but that's not how bridge_fn works, and so it's not how
bridge_callbacks works. The additional overhead should not be
prohibitive.
2026-01-29 15:50:16 -08:00
marc-signal
53380fca8e Add accountExists typed API 2026-01-26 15:56:52 -05:00
Jordan Rose
37dda46866 bridge_callbacks: Add JNI support
This required some changes to jni::ResultTypeInfo, because we no
longer have tokens available for the JNI types of a bridged function
to use with the jni_args! macro. Instead, we record signatures for
each type that might appear as a callback argument and use
const_str::concat to put them together.

This does not currently attempt to autogenerate the Java interface on
the other side of the bridge; given the way gen_java_decl builds on
top of cbindgen, this is likely tricky but not impossible. Something
to possibly add later.
2026-01-07 13:02:45 -08:00
Jordan Rose
40940e4c31 java: Expose Network.connectProvisioning and ProvisioningConnection 2025-12-15 16:17:43 -08:00
Jordan Rose
7475974889 ProGuard: keep kotlin.Pair's constructor 2025-11-06 17:17:49 -08:00
Jordan Rose
776cf0601e Remove deprecated overloads of KyberPreKeyStore.markKyberPreKeyUsed 2025-11-06 16:10:09 -08:00
moiseev-signal
177a495eba java: Use kotlin.Pair 2025-11-06 15:37:29 -08:00
Jordan Rose
82d72ab7a2 jni: Preserve Pair element types in Native.kt 2025-10-21 15:01:45 -07:00
Jordan Rose
b6a05a4a7e java: Expose UnauthUsernamesService.lookUpUsernameLink 2025-10-17 13:13:30 -07:00
Jordan Rose
baec47e62e bridge: Add UnauthenticatedChatConnection_look_up_username_link 2025-10-17 12:14:40 -07:00
Jordan Rose
db27d57d0c java: Relax bridging test added in 417673dab 2025-10-16 11:01:42 -07:00
Jordan Rose
417673dab8 jni: When exception conversion fails, make an AssertionError instead
This can fail too, but we should at least try.
2025-10-15 17:46:44 -07:00
Jordan Rose
2b6c801fb6 bridge: Expose sendMultiRecipientMessage in UnauthMessagesService 2025-10-14 18:17:25 -07:00
Jordan Rose
279390b4f2 Incremental MAC: Check digest length when initializing ValidatingMac 2025-10-14 16:30:10 -07:00
Jordan Rose
388e294acf bridge: Eliminate FakeChatSentRequest in favor of pairs 2025-10-10 16:56:15 -07:00
Jordan Rose
4503a19190 Unify IdentityKeyPair_Deserialize implementations
...in the process revealing that the Java declaration had a missing
exception spec.
2025-10-09 11:31:20 -07:00
Jordan Rose
fb570d7c99 bridge: Add support for returning pairs from bridge_fns 2025-10-09 11:31:20 -07:00
gram-signal
533d11dd7c Remove usePqRatchet from client-facing code, defaulting to always use. 2025-10-02 11:32:36 -07:00
andrew-signal
2bc167b5a2 Add BuildVariant parsing/overload support to libsignal's Remote Config 2025-09-30 22:35:21 -04:00
moiseev-signal
c81ec0df62 keytrans: Retry chat connection attempts in Java integration tests 2025-09-22 11:45:47 -07:00
andrew-signal
1adf63e4a8 Make CompletableFuture cancelation members volatile to conform with JMM 2025-09-22 11:39:31 -07:00
Jordan Rose
51b11ca1c6 java: Add missing @CalledFromNative to ECPublicKey(long) 2025-09-16 16:55:35 -07:00
Jordan Rose
15af92c93d protocol: Record signed prekey and base key used with a Kyber prekey 2025-09-16 15:33:59 -07:00
Jordan Rose
94f91c5b19 protocol: Add support for sealed sender server certificate references
Rather than embedding a server certificate inside every sender
certificate, future sender certificates will be able to reference
their server certificate by ID as long as all receivers have a version
of libsignal containing that certificate.

This change also handles the sender ACI being represented as bytes
instead of a string.
2025-09-09 14:13:23 -07:00
andrew-signal
bc0227873e Bridge look_up_username_hash to app languages
Co-authored-by: Jordan Rose <jrose@signal.org>
2025-09-02 15:59:27 -07:00
andrew-signal
01d3d4ed30 Future-proof sealed sender trust root handling.
Co-authored-by: Jordan Rose <jrose@signal.org>
2025-08-27 12:03:28 -04:00
Jordan Rose
8fdb2778bc protocol: Split FingerprintError out from SignalProtocolError
The "fingerprint" / safety number operations *are* tied to the
"protocol" in that they provide a way to verify identity keys, but
they are also completely distinct from the message handling that the
rest of SignalProtocolError is used for.
2025-08-15 12:21:25 -07:00
Jordan Rose
54e81cda4f java: System.runFinalization() in GC cleanup testing
This makes this particular test more reliable even though no
'finalize' methods are involved in this one.
2025-08-13 13:31:23 -07:00
Jordan Rose
b4cd040474 Add SvrB.remove(), use it for app-level integration tests 2025-08-13 12:35:52 -07:00
Jordan Rose
374301ab46 java: Include a timestamp in the testing StderrLogger
Before
> I libsignal: rust/bridge/shared/types/src/net.rs:132: Initializing connection manager for Staging...

After
> [11:03:32.956965 libsignal] I rust/bridge/shared/types/src/net.rs:132: Initializing connection manager for Staging...
2025-08-13 11:43:12 -07:00
Jordan Rose
7bae76f25e java: Use the slightly-nicer StderrLogger in TestLogger 2025-08-13 11:43:12 -07:00
Jordan Rose
996f6bb250 jni: explicitly clean up local refs on background threads
- Use a local frame for bridge_io when completing futures
- Use a local frame for ChatListener callbacks
- Use AutoLocal for exception formatting callbacks
2025-08-12 10:49:30 -07:00
moiseev-signal
b53ed51263 keytrans: Stop falling back to search if _self_ monitor detects a new version 2025-08-11 15:34:01 -07:00
Jordan Rose
ea343a89ab jni: Native.java -> Native.kt
Improvements included in this first iteration:
- Nullable/non-nullable!
- ObjectHandle typealias for Long
- Fixed handling for CompletableFuture<Void> (previously translated
  without generics at all in some cases)

Co-authored-by: Alex Bakon <akonradi@signal.org>
2025-08-08 14:41:22 -07:00
Jordan Rose
36916db152 Gradle: Make Spotless a top-level task, be precise about inputs
Previously, we used a per-project directory glob for Kotlin and Java
sources, which (1) was overly general, (2) ran afoul of Gradle's rules
about "if you look in a directory you must depend on it", and (3)
required us to make a fake subproject in the shared/ folder because
Spotless doesn't like sources outside the project directory.

Now, we delay complete evaluation of the root project until
subprojects are complete, and then add a single Spotless operation at
the top level that uses the subprojects' compile tasks to find exactly
the files to format.
2025-08-08 13:08:31 -07:00
Jordan Rose
aee436a43c java: Update Spotless to 7.2.1 2025-08-07 13:46:28 -07:00
Jordan Rose
be9e9a3ab6 Expose SvrB.createNewBackupChain(), make secret data non-optional 2025-07-31 12:37:02 -07:00
gram-signal
72935510d4 Immediately after a restore, use the same enc_salt/pw_salt for the next backup.
Co-authored-by: Jordan Rose <jrose@signal.org>
2025-07-30 20:14:26 -07:00
Alex Bakon
bb05cc016e Streamline bridging of SVR-B function arguments 2025-07-29 14:18:16 -04:00
Jordan Rose
9e9c375db9 Expose BackupForwardSecrecyToken-aware MessageBackupKey derivation 2025-07-28 13:53:19 -07:00
Alex Bakon
303b6313bd Expose SVR-B logic from Rust 2025-07-25 17:36:12 -04:00
Jordan Rose
d225a1008d Add CompletableFuture.handle
Co-authored-by: Andrew <andrew@signal.org>
2025-07-25 14:09:07 -07:00
Jordan Rose
a881fcf0f3 java: Align CompletableFuture cancellation behavior with OpenJDK's 2025-07-25 13:24:29 -07:00
gram-signal
3ae977841f Modify backup forward-secrecy-token storage to be more resilient to SVRB communication failures.
Co-authored-by: Alex Bakon <akonradi@signal.org>
2025-07-25 12:35:01 -07:00
andrew-signal
ec3c273219 Expose Rust API for SVR-B 2025-07-23 18:59:54 -04:00
Jordan Rose
821dee54e5 java: Add CompletableFuture.completedFuture()
Matches java.util.concurrent.CompletableFuture's method.
2025-07-17 18:27:39 -07:00
Jordan Rose
a410849578 crypto: Add a stripped-down HPKE API for our Curve25519 keys 2025-07-15 16:17:23 -07:00
andrew-signal
7167436147 Expand InvalidSessionException to take a cause 2025-07-02 04:55:16 -04:00
moiseev-signal
71c44d47e1 java: Fix incremental mac finalization. Again. 2025-06-30 18:54:21 -07:00