Commit Graph

25 Commits

Author SHA1 Message Date
Jordan Rose
512d0226bc Reject SenderCertificates without UUIDs
Additionally, never look up a session by e164 when decrypting
sealed-sender messages.

This is an API-breaking change for both Java and Swift clients;
certain fields and arguments are no longer Optional. On top of that,
some tests may need to be updated to provide UUIDs instead of just
phone numbers.
2021-02-04 11:25:33 -08:00
Jack Lloyd
d77fa218a2 Map errors through the bridge more carefully
Remove several errors that were very once-off.

In Java avoid throwing RuntimeException unless it's an internal error
that we really should crash on.
2021-01-28 14:26:17 -05:00
Jack Lloyd
6c030d56a5 Drop down to 25k 2021-01-16 15:07:42 -05:00
Jack Lloyd
6c4cd62d1d Many encryptings 2021-01-16 14:32:22 -05:00
Jordan Rose
8fa2f4a73f JNI: Rethrow callback exceptions instead of wrapping them 2021-01-12 11:54:19 -08:00
Jordan Rose
049300d9d4 JNI: Report callback exceptions as the "cause" of a callback failing 2021-01-12 11:54:19 -08:00
Jack Lloyd
ba91fe441e Merge pull request #135 from signalapp/jack/fix-decrypt-logic
Fix handling when attempting to decrypt with a session that isn't found
2021-01-07 16:47:51 -05:00
Jack Lloyd
0184984db5 Add a test that decryption works after you archive a session state 2021-01-07 15:24:44 -05:00
Jack Lloyd
564a1b7d54 Resolve difference in behavior between Java and Rust SessionRecord
In libsignal-protocol-java, SessionRecord holds a SesssionState struct which is
the "active" session plus a list of old states. If the record is freshly
created, there is still a SessionState, but it is an uninitialized/new protobuf
structure which causes all fields to be empty/zero/false.

So in the original Java logic you can call for example hasSenderChain, and on
an empty/fresh record it will return false. However in Rust, in this case the
Option is empty and we return an error instead.

For hasSenderChain, it seems reasonable to return false if there is no active
session, since if there is no session there is certainly no chain.

Android also expects the session version to be == 0 on such sessions, but this
makes less sense, so have this logic only in the Java binding and not in the
Rust library proper.
2021-01-07 13:15:25 -05:00
Jack Lloyd
4131f8075c Merge pull request #105 from signalapp/jack/no-more-java-protobuf
Remove protobuf from Java binding
2020-12-10 10:24:14 -05:00
Jack Lloyd
4b4b7e3df6 Make some changes on the road to removing SessionState from Java 2020-12-09 13:48:14 -05:00
Jack Lloyd
612ef9f44c Remove protobuf from Java 2020-12-09 13:01:31 -05:00
Jack Lloyd
a32efa2d24 Remove some Java API surface no longer needed
Some cruft still remains for the tests which is hard to avoid, eg getAliceBaseKey
2020-12-08 18:13:06 -05:00
Jack Lloyd
9f11b256a8 Expose AES-GCM-SIV to Java and Swift 2020-12-04 18:13:16 -05:00
Jordan Rose
d1df148cc8 Java: Escape some non-ASCII characters in a test case 2020-12-01 16:54:35 -08:00
Jack Lloyd
643a637b34 Merge pull request #77 from signalapp/jack/sealed-sender
Sealed Sender
2020-12-01 17:43:30 -05:00
Jordan Rose
e64fa771e5 JNI: Handle InvalidKeyIdException in (Signed)PreKeyStore
And test that the exception is handled and not propagated.
2020-11-23 13:20:23 -08:00
Jack Lloyd
153fe71238 Remove Java-side protobufs for Sealed Sender
They were still being used in the tests
2020-11-21 04:58:57 -05:00
Jack Lloyd
3cb8e46ba1 Remove some unused util functions from Java library
The only function Android imports from KeyHelper is generateRegistrationId
2020-11-18 15:42:29 -05:00
Jack Lloyd
61057fe71b Import the libsignal-metadata-java tests
Accidentally omitted from import in #21
2020-11-13 13:45:24 -05:00
Jack Lloyd
2a2a8a70a8 Fix method signature 2020-11-06 16:40:54 -05:00
Jack Lloyd
5416ef2c5b Remove debug code 2020-11-05 17:59:09 -05:00
Jack Lloyd
b5e410b0f2 Avoid UTF-8 in java test files
If LANG is not set to a UTF-8 encoding the build will fail.
2020-11-05 17:59:09 -05:00
Jack Lloyd
0fbd07ca81 Modify libsignal-protocol-java to use Rust via JNI
Removes device consistency code (unused)
Removes decryption callbacks (unused)
2020-11-05 17:59:09 -05:00
Jack Lloyd
69a4b40423 Import v2.8.1 of libsignal-protocol-java
No changes vs that version in this commit
2020-11-05 17:59:09 -05:00