mirror of
https://gitlab.computer.surgery/matrix/grapevine.git
synced 2025-12-18 16:21:24 +01:00
upgrade to latest ruma
This commit is contained in:
parent
2dbb101140
commit
c9c30fba30
8 changed files with 119 additions and 119 deletions
|
|
@ -5,8 +5,9 @@ use ruma::{
|
|||
encryption::{CrossSigningKey, DeviceKeys, OneTimeKey},
|
||||
events::{AnyToDeviceEvent, StateEventType},
|
||||
serde::Raw,
|
||||
DeviceId, DeviceKeyAlgorithm, DeviceKeyId, MilliSecondsSinceUnixEpoch,
|
||||
OwnedDeviceId, OwnedDeviceKeyId, OwnedMxcUri, OwnedUserId, UInt, UserId,
|
||||
DeviceId, MilliSecondsSinceUnixEpoch, OneTimeKeyAlgorithm, OneTimeKeyName,
|
||||
OwnedDeviceId, OwnedKeyId, OwnedMxcUri, OwnedOneTimeKeyId, OwnedUserId,
|
||||
UInt, UserId,
|
||||
};
|
||||
use tracing::warn;
|
||||
|
||||
|
|
@ -369,7 +370,7 @@ impl service::users::Data for KeyValueDatabase {
|
|||
&self,
|
||||
user_id: &UserId,
|
||||
device_id: &DeviceId,
|
||||
one_time_key_key: &DeviceKeyId,
|
||||
one_time_key_key: &OwnedKeyId<OneTimeKeyAlgorithm, OneTimeKeyName>,
|
||||
one_time_key_value: &Raw<OneTimeKey>,
|
||||
) -> Result<()> {
|
||||
let mut key = user_id.as_bytes().to_vec();
|
||||
|
|
@ -388,7 +389,7 @@ impl service::users::Data for KeyValueDatabase {
|
|||
// anymore)
|
||||
key.extend_from_slice(
|
||||
serde_json::to_string(one_time_key_key)
|
||||
.expect("DeviceKeyId::to_string always works")
|
||||
.expect("OwnedKeyId::to_string always works")
|
||||
.as_bytes(),
|
||||
);
|
||||
|
||||
|
|
@ -410,8 +411,8 @@ impl service::users::Data for KeyValueDatabase {
|
|||
&self,
|
||||
user_id: &UserId,
|
||||
device_id: &DeviceId,
|
||||
key_algorithm: &DeviceKeyAlgorithm,
|
||||
) -> Result<Option<(OwnedDeviceKeyId, Raw<OneTimeKey>)>> {
|
||||
key_algorithm: &OneTimeKeyAlgorithm,
|
||||
) -> Result<Option<(OwnedOneTimeKeyId, Raw<OneTimeKey>)>> {
|
||||
let mut prefix = user_id.as_bytes().to_vec();
|
||||
prefix.push(0xFF);
|
||||
prefix.extend_from_slice(device_id.as_bytes());
|
||||
|
|
@ -455,7 +456,7 @@ impl service::users::Data for KeyValueDatabase {
|
|||
&self,
|
||||
user_id: &UserId,
|
||||
device_id: &DeviceId,
|
||||
) -> Result<BTreeMap<DeviceKeyAlgorithm, UInt>> {
|
||||
) -> Result<BTreeMap<OneTimeKeyAlgorithm, UInt>> {
|
||||
let mut userdeviceid = user_id.as_bytes().to_vec();
|
||||
userdeviceid.push(0xFF);
|
||||
userdeviceid.extend_from_slice(device_id.as_bytes());
|
||||
|
|
@ -467,7 +468,7 @@ impl service::users::Data for KeyValueDatabase {
|
|||
.scan_prefix(userdeviceid)
|
||||
.map(|(bytes, _)| {
|
||||
Ok::<_, Error>(
|
||||
serde_json::from_slice::<OwnedDeviceKeyId>(
|
||||
serde_json::from_slice::<OwnedOneTimeKeyId>(
|
||||
bytes.rsplit(|&b| b == 0xFF).next().ok_or_else(
|
||||
|| {
|
||||
Error::bad_database(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue