0
0
mirror of https://github.com/signalapp/libsignal.git synced 2024-09-20 12:02:18 +02:00
Commit Graph

82 Commits

Author SHA1 Message Date
Jordan Rose
70a9662acd usernames: Expose Username.fromParts to app languages 2024-01-10 12:26:19 -08:00
Jordan Rose
0ef2c7cc54 usernames: Split up BadDiscriminator error into more specific errors
Rust: UsernameError now has more cases. ProofVerificationFailure is
also split off into its own error type, separate from structural
username errors.

Java: Subclasses of BadDiscriminatorException have been added.

Swift: Some error codes have been renamed and others have been added.

TypeScript: Some error codes have been renamed and others have been
added. Discriminator errors are now proper LibSignalErrors.
2024-01-10 12:26:19 -08:00
Jordan Rose
0d09a8352c
Add GroupSendCredential
This credential is issued by the group server and presented to the
chat server to prove that the holder is a member of *some* group with
a known list of people. This can be used to replace the access key
requirement for multi-recipient sealed sender sends.
2023-12-11 13:45:12 -08:00
Jordan Rose
16653ffea1 SSv2: Add send support for excluded recipients 2023-12-11 12:36:54 -08:00
Jordan Rose
6a2ebfdabf java: Fix SenderKeyDistributionMessage.getDistributionId()
...which was using the wrong untyped Native function!
2023-12-08 12:11:25 -08:00
Alex Konradi
1f2d761889
Allow returning handle types from Swift invokeAsyncFunction
Implement the Completable protocol for OpaquePointer and add a test that runs
futures that return handle types to prove that it works.
2023-12-04 16:39:32 -05:00
Alex Konradi
f06faef7a4
Split CDSI lookup to allow token retrieval
Split the libsignal-net implementation of CDSI lookup into two parts: one that
does the initial handshake and token acquisition, and the other to acknowledge
the token and then parse results. Expose the token in Java via the same Consumer
type used in the Android codebase.
2023-12-01 16:05:10 -05:00
Alex Konradi
2c985f3d84
Add CompletableFuture.thenCompose
This is needed for splitting up the CDSI lookup function. The signature mirrors
the Java standard library version.
2023-11-30 16:13:05 -05:00
Alex Konradi
1c6e8e512d
Fix CompletableFuture error handling
Fix the behavior of CompletableFuture.thenApply so that if the applied function
throws an exception, the pending future receives the exception (instead of never
completing). Add tests.
2023-11-30 15:38:22 -05:00
Alex Konradi
4c78373114
Expose libsignal-net function for CDSI via JNI
Expose the existing CDSI lookup async function to Java clients. Provide a small
library that can be easily integrated into the existing codebase.
2023-11-15 10:00:46 -05:00
akonradi-signal
3d8933ec96
Add CompletableFuture.thenApply method
Add the ability to chain futures by applying arbitrary functions. Mirrors
CompletableFuture.thenApply in the Java standard library.
2023-11-13 15:06:40 -05:00
Jordan Rose
64d5996825 Expose SSv2 message parsing in libsignal-server 2023-11-07 12:19:14 -08:00
Jordan Rose
90e23336e0 java: Improve Pair's equals, hashCode, and toString 2023-11-06 12:19:56 -08:00
Jordan Rose
d768f47020 usernames: Allow generating a new link buffer with existing entropy
This allows updating the encrypted username associated with a link
without rotating the link itself.
2023-11-02 15:02:36 -07:00
Jessa
7af14c6b06
Add WebP sanitizer
This adds integration bits for the new webpsan, a WebP image sanitizer -- which
currently simply checks the validity of a WebP file input, so that passing a
malformed file to an unsafe parser can be avoided. The integration pretty much
just leverages the integration work that was already done for mp4san.
2023-10-26 15:16:59 -04:00
ravi-signal
9c79bc97cb
zkgroup: move java BackupAuthTest to server lib
This test does base64 decoding which differs between android 21 and
non-android platforms.
2023-10-26 13:15:25 -05:00
ravi-signal
790db2383e
zkgroup: add backup auth credential
Allows a client to request a credential for a backup-id without
revealing the backup-id to the issuing server. Later, the client may use
this to make requests for the backup-id without identifying themselves
to the server.
2023-10-25 17:26:58 -05:00
Jordan Rose
55a1958a15 Test various error and panic scenarios for bridge_fn and bridge_io 2023-10-12 12:23:22 -07:00
Jordan Rose
63efc8bf4d bridge_io: Add an explicit parameter for the async runtime
This will let us (a) avoid hardcoding any particular async runtime in
the libsignal-bridge macros, and (b) separate the platform-specific
stuff from the async runtime. libsignal_bridge now has an AsyncRuntime
trait whose only requirement is "run a self-contained Future".
2023-10-05 09:37:55 -07:00
Jordan Rose
ae47f039fa bridge: Add a bridge_io macro that expects a runtime
For now, the "runtime" is spawning a thread that then uses
now_or_never, but eventually this will be a persistent tokio runtime
of some kind.

Also for now, this is only implemented for Java. Swift and Node
support coming soon.
2023-10-02 14:08:10 -07:00
Jordan Rose
a15fffd058 Java: Teach gen_java_decl about Futures for type-safety. 2023-09-27 06:48:21 -07:00
Jordan Rose
2c295f68c9 Java: Implement completing Java Futures from Rust 2023-09-27 06:48:21 -07:00
Jordan Rose
a563c9b93d Java: Add a bare-bones Future implementation for upcoming async APIs 2023-09-27 06:48:21 -07:00
moiseev-signal
36363750a2
Reimplement IncrementalMacInputStream backed by directly allocated ByteBuffer 2023-09-15 11:00:50 -07:00
moiseev-signal
9d1ab7811e
java: Do not close the inner stream in IncrementalMacOutputStream 2023-09-01 13:02:17 -07:00
moiseev-signal
e26381aa3c
java: Implement readBuffer missing from older Androids 2023-08-31 17:34:44 -07:00
moiseev-signal
6abe26a0c1
Improve incremental MAC API 2023-08-31 15:28:39 -07:00
Jordan Rose
024c618f20 protocol: Throw SessionNotFound for an expired unacknowledged session
For the most part this should happen transparently without any
explicit adoption, like the previous change, but for Java code the
NoSessionException is now properly declared on SessionCipher.encrypt.
(This was always technically possible, but clients were expected to
have previously checked for session validity before using
SessionCipher; now that there's an expiration involved, that's not
strictly possible.)
2023-08-22 17:00:35 -07:00
Jordan Rose
a04c4f27a6 protocol: Check expiration in hasSenderChain/hasCurrentState
And consolidate the implementations of these two separate checks; now
they both check for a valid session by looking for a sender chain
instead of just *some* current session, in addition to the new check
for an expired unacknowledged session. At the Rust level, this is now
one check named has_usable_sender_chain; at the app levels, the old
names of hasSenderChain (Java) and hasCurrentState (Swift, TypeScript)
have been preserved.

Tests to come in the next commit.
2023-08-22 17:00:35 -07:00
Jordan Rose
9ca91fe2c0 protocol: Record the timestamp when a pre-key bundle is processed 2023-08-22 17:00:35 -07:00
Jordan Rose
02e1c45fed protocol: Remove SessionRecord.fromSingleSessionState
This was only used to migrate from an old Android session format
(pre-2018)...and it's been broken for years on the Android side. Just
remove it.
2023-08-22 10:26:46 -07:00
moiseev-signal
f9471c9c68
Set up and apply code formatting for Java 2023-08-22 09:15:23 -07:00
moiseev-signal
62853d7d99
Address javadoc warnings 2023-08-10 15:13:32 -07:00
Jordan Rose
45fb135880 Add {Aci,Pni}.parseFromServiceId{String,Binary}
These work the same as the equivalent factory methods on ServiceId,
but throw if the resulting parsed ServiceId doesn't match the specific
type you were trying to parse.
2023-08-02 17:51:23 -07:00
moiseev-signal
2938b65ffa java: Prefer checked exceptions for ServiceId parsing methods 2023-07-27 15:40:44 -07:00
Jordan Rose
008fad966e protocol: Rip "Context" out of the Rust layer
Only the iOS client ever used this extra parameter, and it's one
that's easily stored alongside the reference to a store. This is
massively simpler than having it threaded down to the Rust
libsignal_protocol and back up through the bridging layer.
2023-07-27 15:40:44 -07:00
Jordan Rose
231aa16510 Give AuthCredentialWithPni "PniAsServiceId" and "PniAsAci" variants
The former is what we want going forward; the latter is equivalent to
the old format for compatibility with previous client builds.
2023-07-20 12:28:19 -07:00
Jordan Rose
6a547bf3f2 zkgroup: Use ServiceId and Aci in public APIs instead of UidBytes
Some of these APIs have to match up with UuidCiphertexts, and so we
convert them all for consistency.
2023-07-20 12:26:46 -07:00
Jordan Rose
af34c38c03 zkgroup: Convert UuidCiphertext operations to use ServiceId
Eventually all of zkgroup will use ServiceId, but this part will
actually behave differently.
2023-07-20 12:23:10 -07:00
Jordan Rose
88a2d5c740 Add convenience APIs to ProtocolAddress for using ServiceIds
In a future release ProtocolAddresses will *only* support ServiceIds,
so these APIs are designed to be the nullable version of the signature
they'll eventually have. Since ProtocolAddresses are created by the
client app in nearly all cases, they should be able to ignore the null
case if they only use ServiceIds in their input.
2023-07-19 14:12:05 -07:00
Jordan Rose
e32cd70358 java: Override 'hashCode' in ServiceId to go with 'equals' 2023-07-14 13:36:25 -07:00
Jordan Rose
6800244a53
protocol: Add the ServiceId, Aci, and Pni types
Co-authored-by: Max Moiseev <moiseev@signal.org>
2023-07-13 13:54:53 -07:00
Sergey Skrobotov
ca262db5ec bridge for username links 2023-07-06 15:51:52 -07:00
moiseev-signal
19d9e9f0f4
node: Add PQXDH support 2023-06-02 10:42:39 -07:00
Jordan Rose
d61cc8f13e java: Include a ProtocolAddress in NoSessionException
This is a minimal change to not lose information that we already have
in Rust; there may be further changes in the future (such as avoiding
the redundancy now in ProtocolNoSessionException, or splitting out
missing Sender Key sessions, which don't have an address, from missing
Double Ratchet sessions).
2023-05-31 10:34:55 -07:00
ravi-signal
803e7fe752
pin: move svr2 pin hash out of Svr2Client
- moves svr2 pin hashing to a standalone function
- take string instead of utf-8 encoded bytes where possible
2023-05-30 11:24:54 -05:00
Jonathan Klabunde Tomer
c0a8e34aef add missing throws declarations on KEM*Key constructors 2023-05-23 17:25:18 -07:00
Rolfe Schmidt
ff09619432 Add Kyber KEM and implement PQXDH protocol
Co-authored-by: Jordan Rose <jrose@signal.org>
Co-authored-by: Max Moiseev <moiseev@signal.org>
2023-05-09 16:44:40 -07:00
moiseev-signal
2b46ae1e85
Implement incremental MAC 2023-05-09 12:29:25 -07:00
Jordan Rose
0e74a41eb9 bridge: Put signal-media behind a feature flag, off for iOS by default
The JNI tests have also been conditionalized in case we want to take
this out for Android as well. (Node still unconditionally depends on
it being present.) I've given it a separate feature flag from just
ffi/jni/node so that we can preserve the tests Jessa wrote for each
platform.
2023-05-09 11:02:31 -07:00