Commit Graph

286 Commits

Author SHA1 Message Date
Jordan Rose
c905320dea bridge: Add IllegalArgumentError
...mostly so we can stop using SignalProtocolError::InvalidArgument
for functions that wouldn't otherwise traffic in SignalProtocolErrors.
2025-08-18 10:47:34 -07:00
Jordan Rose
6cfdd92d93 java: Fix order of arguments to assertEquals in assertLookupErrorIs 2025-08-18 10:00:42 -07:00
Jordan Rose
549d91aba3 net: Fold cdsi::LookupError::Parse into CdsiProtocol
Both of these indicate the server sending something unexpected, and
all clients already treat them the same at the app level anyway.
2025-08-18 10:00:42 -07:00
Jordan Rose
ddb8f340ca Remove unused cdsi::LookupError::InvalidResponse 2025-08-18 10:00:42 -07:00
Jordan Rose
9e2bcb2a74 SVRB: Distinguish "automatic retry" from "manual retry" errors
- Java: This distinction is already made, just reworded

- Node: We include "protocol errors" in IoError here, where retrying
  probably won't help, but it won't really be harmful either.

- Swift: Automatically retryable errors are now enumerated; other
  errors are still described as "manually retryable". (Also, fixed a
  redundant error message format call.)
2025-08-14 16:14:12 -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
7bae76f25e java: Use the slightly-nicer StderrLogger in TestLogger 2025-08-13 11:43:12 -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
Alex Bakon
1f923dcd88 Remove unused TransportConnectError::DnsError 2025-08-11 09:45:02 -04:00
Jordan Rose
fd8322b53e SVRB: Clarify what "chain" refers to in the doc comments 2025-08-07 17:28:02 -07:00
Jordan Rose
aee436a43c java: Update Spotless to 7.2.1 2025-08-07 13:46:28 -07:00
Jordan Rose
d3112cc349 java: Provide (and document) more specific exceptions for SVR-B 2025-08-06 17:18:31 -07:00
Jordan Rose
3b91a5d708 net: Parse RetryLater info for SVR-B
Essentially, promotes "decide whether an HTTP status is interesting"
up to the generic "enclave" handling instead of being CDS-specific,
and then propagates the new case all the way out to apps.
2025-08-06 16:05:28 -07:00
Jordan Rose
9feb3de9d2 net: SvrError::ConnectionTimeout -> AllConnectionAttemptsFailed
The same error is being used both for timeouts and for "all attempts
failed"; if we're going to coalesce them (reasonable, given that the
only option in either case is "retry" or "don't"), "all attempts
failed" is a less misleading choice.

This changes the particular enum case in Swift from connectionTimedOut
to connectionFailed. Java continues to use NetworkException and
TypeScript the IoError code.
2025-08-01 14:02:54 -07:00
Jordan Rose
be9e9a3ab6 Expose SvrB.createNewBackupChain(), make secret data non-optional 2025-07-31 12:37:02 -07:00
andrew-signal
4cff0b3911 Remove the timeout from testToResultFutureCancellationPropagation so it flakes less. 2025-07-31 15:33:15 -04: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
andrew-signal
f9ca652baf Extend testToResultFutureCancellationPropagation baseFuture.await() timeout 2025-07-29 19:05:23 -04:00
Alex Bakon
bb05cc016e Streamline bridging of SVR-B function arguments 2025-07-29 14:18:16 -04:00
andrew-signal
d70f913780 Skip non-hermetic SVR-B tests if username or password is not set 2025-07-28 18:51:30 -04:00
andrew-signal
3055e8e2b3 Bridge SVR-B to Kotlin 2025-07-28 18:05:13 -04:00
Jordan Rose
9e9c375db9 Expose BackupForwardSecrecyToken-aware MessageBackupKey derivation 2025-07-28 13:53:19 -07:00
andrew-signal
5bdc3e54f2 Expect correct kind of exception in testConnectCancellationUnauth 2025-07-25 19:31:43 -04:00
andrew-signal
47a4eeabb5 Bridge BackupForwardSecrecyToken to Swift/Kotlin/TypeScript 2025-07-23 19:57:16 -04:00
Alex Bakon
7aef688310 Split Base64 utility to reduce reflection 2025-07-22 15:33:22 -04:00
Jordan Rose
04e9d83995 MessageBackupValidationTest.java: "expected, actual" in assertEquals 2025-07-17 10:57:29 -07:00
Jordan Rose
0dc81d3131 backup: Replace bespoke TooShort with io::ErrorKind::UnexpectedEof 2025-07-17 10:57:29 -07:00
moiseev-signal
ca28564e0b java: Address deprecation warning in Curve25519Test 2025-07-16 11:26:31 -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
a323900858 Refactor so tests generate legacy key format encrypted file; client tests can use that. 2025-07-15 13:16:06 -04:00
andrew-signal
36797e6eca Update MessageBackupKey derivation logic to use nonce if provided 2025-07-09 13:57:09 -04:00
moiseev-signal
4d187d2452 ci: Run proxy tests in Slow Tests workflow 2025-07-02 13:25:57 -07:00
Alex Bakon
a7f823771f Combine CreateSession push_token, push_token_type
These fields should always be present or absent together.
2025-06-26 17:19:05 -07:00
moiseev-signal
f395e1cb7d java: Make CertificateValidator inheritable for tests 2025-06-25 15:19:36 -07:00
Jordan Rose
8070d6a4e6 Send Accept-Language when connecting a chat socket 2025-06-25 13:16:37 -07:00
Jordan Rose
9a468837b8 java: Clean up javadoc issues 2025-06-24 09:56:18 -07:00
Jordan Rose
841f57c30f Move (RegistrationSessionState)RequestedInformation -> ChallengeOption 2025-06-23 10:37:55 -07:00
Alex Bakon
56c63a4838 Refactor registration errors on existing types 2025-06-20 17:14:52 -04:00
Jordan Rose
b2c2537277 java: Switch from javadoc to Dokka to include our Kotlin sources
The Maven publication will still contain a -javadoc jar for
consistency, but the -dokka jar is likely to have superior rendering
in practice, particularly for Kotlin-only APIs!
2025-06-18 10:57:50 -07:00
Jordan Rose
2879220e93 Require Kyber keys/ciphertexts throughout all XDH APIs 2025-06-13 16:06:07 -07:00
Alex Bakon
02b786b07e Limit device ID to the range 1-127
This is already required for sealed sender messages and enforced by the server.
2025-06-13 14:18:16 -04:00
Jordan Rose
5001df1ee4 Kotlin: use explicitApi() mode 2025-06-13 10:27:37 -07:00
Alex Bakon
881b3a4c8e Port some Java classes to Kotlin 2025-06-12 18:24:15 -04:00
Alex Bakon
a32aca9bce Remove Java Curve class 2025-06-12 17:24:31 -04:00
Alex Bakon
3c89a5fa07 Colocate Kotlin sources with Java 2025-06-12 16:00:05 -04:00
moiseev-signal
beebd1cd20 keytrans: Add example usage for Java bridge 2025-06-11 16:35:42 -07:00
Jordan Rose
a280bc6555 Resolve an age-old X3DH test inconsistency
This known-answer test was originally ported over from
libsignal-protocol-java, but did not produce the same results. Why?
Because one of the private keys chosen by libsignal-protocol-java for
its test was unclamped, while libsignal-the-Rust-implementation always
clamps private keys as part of deserialization, not just generation.
Consequently, the public key didn't actually correspond to the private
key according to our modern libsignal.

Rather than try to line up exactly with what libsignal-protocol-java
was coincidentally doing, this commit clamps the private key, computes
the resulting public key, and verifies a new
consistent-between-both-sides outcome.
2025-06-10 16:20:08 -07:00
Jordan Rose
f40d20a72f Add CompletableFuture.await() helper for Kotlin clients
Test it by porting several tests from FutureTest.java to Kotlin and
using Kotlin idioms for awaiting and cancellation.
2025-06-05 12:34:15 -07:00
gram-signal
b7b8040e3a Integrate post-quantum ratchet SPQR.
This PR integrates a post-quantum ratchet (SPQR) into libsignal, using an API that maintains its own internal chain and provides per-message keys.  In doing so, it also aims to be fully backwards-compatible with current clients and stored session state.

## Backwards compatibility with current clients

Remote clients that connect to us or that we connect to may not have this integration.  If they don't, their SignalMessage wire format should still deserialize, and in doing so we'll receive an empty pq_ratchet field.  SQPR handles this internally, by downgrading the protocol version to "version 0" or "don't do anything".  Note that should we eventually want to disallow this, we can do so via increasing the `min_version` field passed into the SQPR init functions to V1.  This is also the method by which we would upgrade SQPR from v1 to a future v2, etc.

## Opt-in

The publicly facing API calls for this now expose an explicit opt-in via a passed-in `use_pq_ratchet` bool (and associated enums in language-specific APIs).  If false, they default to SQPR `v0`, IE: none.  If true, they try to set up SPQR on new sessions, but will downgrade if the remote party cannot or will not do the same.
2025-06-04 11:18:12 -07:00
Alex Bakon
d0c911c397 Remove proguard usage golden test 2025-06-03 15:10:05 -04:00