Commit Graph

7 Commits

Author SHA1 Message Date
Jack Lloyd
e8b4474cb9 Fix handling when attempting to decrypt with a session that isn't found
There were two discrepancies between the logic here and the original
logic of libsignal-protocol-java.

First, if the session record had an uninitialized active session, in
Java this would still attempt decryption with the old session states,
but Rust would stop immediately without trying the old states. [I am
not sure if this ever happens but it could possibly occur due to use
of archiveCurrentState]

Secondly, we returned the wrong error condition. We treated lack of a
sender chain as an invalid state (effectively an internal error) but
Java treats it as an invalid message, which makes sense in so far as
it is a message which we are unable to process with the information we
have available. This wrong error type led to an unexpected exception
being thrown in Android.
2021-01-07 14:17:17 -05:00
Jack Lloyd
93b74eb56d Remove remote_registration_id and session_version from Rust
These are here just to copy the Java SessionCipher API but if you
need this just load the session record from your store.

[The Java library does exactly this, without bothering to call the
Rust version]
2020-12-10 13:11:42 -05:00
Jack Lloyd
f87c41b0d1 Avoid returning SessionState from the ratchet initializer functions
These still need to be exposed for the Java tests but they only
need to see the SessionRecord not the SessionState.

The internal functions still need to return a SessionState due to how
these functions are used within the crate.
2020-12-10 08:32:47 -05:00
Jordan Rose
33b8c6ad8d Run cargo fmt after async changes 2020-11-03 14:35:38 -08:00
Jordan Rose
90a9f76dc6 Thread 'async' through any protocol APIs that take Stores
In preparation for Desktop, which must asynchronously access its
database (rather than putting the entire operation on a background
thread with synchronization at the database layer).

The FFI and JNI wrappers (as well as the tests) use
futures::executor::block_on to turn the operations back into
synchronous ones.
2020-11-03 14:35:38 -08:00
Jack Lloyd
946e0670f6 Switch to AGPL 3.0 2020-11-02 17:53:10 -05:00
Jack Lloyd
a0a4ffb40f Move libsignal-protocol-rust to rust/protocol 2020-10-15 15:41:20 -04:00