crypto: Be more forgiving when updating one-time key counts

master
Damir Jelić 2021-02-17 15:24:46 +01:00
parent 6cc03d1c19
commit 5ca40b9893
1 changed files with 4 additions and 4 deletions

View File

@ -191,11 +191,11 @@ impl Account {
} }
pub async fn update_uploaded_key_count(&self, key_count: &BTreeMap<DeviceKeyAlgorithm, UInt>) { pub async fn update_uploaded_key_count(&self, key_count: &BTreeMap<DeviceKeyAlgorithm, UInt>) {
let one_time_key_count = key_count.get(&DeviceKeyAlgorithm::SignedCurve25519); if let Some(count) = key_count.get(&DeviceKeyAlgorithm::SignedCurve25519) {
let count: u64 = (*count).into();
let count: u64 = one_time_key_count.map_or(0, |c| (*c).into());
self.inner.update_uploaded_key_count(count); self.inner.update_uploaded_key_count(count);
} }
}
pub async fn receive_keys_upload_response( pub async fn receive_keys_upload_response(
&self, &self,