Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crypto: Simplify the interface of search_for_device #3757

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use ruma::UserId;
use tracing::error;
use vodozemac::Curve25519PublicKey;

Expand Down Expand Up @@ -150,20 +151,20 @@ impl<'a> SenderDataFinder<'a> {
self.have_device_keys(sender_device_keys).await
} else {
// No: look for the device in the store
self.search_for_device(sender_curve_key, room_key_event).await
self.search_for_device(sender_curve_key, &room_key_event.sender).await
}
}

/// Step B (there are no device keys in the to-device message)
async fn search_for_device(
&self,
sender_curve_key: Curve25519PublicKey,
room_key_event: &'a DecryptedRoomKeyEvent,
sender_user_id: &UserId,
) -> OlmResult<SenderData> {
// Does the locally-cached (in the store) devices list contain a device with the
// curve key of the sender of the to-device message?
if let Some(sender_device) =
self.store.get_device_from_curve_key(&room_key_event.sender, sender_curve_key).await?
self.store.get_device_from_curve_key(sender_user_id, sender_curve_key).await?
{
// Yes: use the device to continue
self.have_device(sender_device)
Expand Down
Loading