mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 20:03:07 +02:00
SessionNotFound should provide the address that didn't have a session
This commit is contained in:
parent
d2ab3dd09f
commit
b53c9dfa9e
@ -65,8 +65,8 @@ pub enum SignalProtocolError {
|
||||
/// no sender key state
|
||||
NoSenderKeyState,
|
||||
|
||||
/// session with '{0}' not found
|
||||
SessionNotFound(String),
|
||||
/// session with {0} not found
|
||||
SessionNotFound(crate::ProtocolAddress),
|
||||
/// invalid session structure
|
||||
InvalidSessionStructure,
|
||||
/// session for {0} has invalid registration ID {1:X}
|
||||
|
@ -849,7 +849,7 @@ pub async fn sealed_sender_encrypt_from_usmc<R: Rng + CryptoRng>(
|
||||
let their_identity = identity_store
|
||||
.get_identity(destination, ctx)
|
||||
.await?
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(format!("{}", destination)))?;
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(destination.clone()))?;
|
||||
|
||||
let ephemeral = KeyPair::generate(rng);
|
||||
|
||||
@ -1270,7 +1270,7 @@ pub async fn sealed_sender_multi_recipient_encrypt<R: Rng + CryptoRng>(
|
||||
let their_identity = identity_store
|
||||
.get_identity(destination, ctx)
|
||||
.await?
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(format!("{}", destination)))?;
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(destination.clone()))?;
|
||||
|
||||
let their_registration_id = session.remote_registration_id().map_err(|_| {
|
||||
SignalProtocolError::InvalidState(
|
||||
|
@ -27,7 +27,7 @@ pub async fn message_encrypt(
|
||||
let mut session_record = session_store
|
||||
.load_session(remote_address, ctx)
|
||||
.await?
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(format!("{}", remote_address)))?;
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(remote_address.clone()))?;
|
||||
let session_state = session_record.session_state_mut()?;
|
||||
|
||||
let chain_key = session_state.get_sender_chain_key()?;
|
||||
@ -240,7 +240,7 @@ pub async fn message_decrypt_signal<R: Rng + CryptoRng>(
|
||||
let mut session_record = session_store
|
||||
.load_session(remote_address, ctx)
|
||||
.await?
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(format!("{}", remote_address)))?;
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(remote_address.clone()))?;
|
||||
|
||||
let ptext =
|
||||
decrypt_message_with_record(remote_address, &mut session_record, ciphertext, csprng)?;
|
||||
|
@ -211,10 +211,10 @@ impl InMemSessionStore {
|
||||
) -> Result<Vec<&SessionRecord>> {
|
||||
addresses
|
||||
.iter()
|
||||
.map(|address| {
|
||||
.map(|&address| {
|
||||
self.sessions
|
||||
.get(address)
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(address.to_string()))
|
||||
.ok_or_else(|| SignalProtocolError::SessionNotFound(address.clone()))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user