mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-08 07:56:55 -04:00
fix(crypto): Use the from constructor for some maps with known values
This commit is contained in:
@@ -746,17 +746,16 @@ impl ReadOnlyAccount {
|
||||
|
||||
pub(crate) fn unsigned_device_keys(&self) -> DeviceKeys {
|
||||
let identity_keys = self.identity_keys();
|
||||
|
||||
let mut keys = BTreeMap::new();
|
||||
|
||||
keys.insert(
|
||||
DeviceKeyId::from_parts(DeviceKeyAlgorithm::Curve25519, &self.device_id),
|
||||
identity_keys.curve25519().to_owned(),
|
||||
);
|
||||
keys.insert(
|
||||
DeviceKeyId::from_parts(DeviceKeyAlgorithm::Ed25519, &self.device_id),
|
||||
identity_keys.ed25519().to_owned(),
|
||||
);
|
||||
let keys = BTreeMap::from([
|
||||
(
|
||||
DeviceKeyId::from_parts(DeviceKeyAlgorithm::Curve25519, &self.device_id),
|
||||
identity_keys.curve25519().to_owned(),
|
||||
),
|
||||
(
|
||||
DeviceKeyId::from_parts(DeviceKeyAlgorithm::Ed25519, &self.device_id),
|
||||
identity_keys.ed25519().to_owned(),
|
||||
),
|
||||
]);
|
||||
|
||||
DeviceKeys::new(
|
||||
(*self.user_id).clone(),
|
||||
|
||||
@@ -397,13 +397,11 @@ impl Signing {
|
||||
}
|
||||
|
||||
pub fn cross_signing_key(&self, user_id: UserId, usage: KeyUsage) -> CrossSigningKey {
|
||||
let mut keys = BTreeMap::new();
|
||||
|
||||
keys.insert(
|
||||
let keys = BTreeMap::from([(
|
||||
DeviceKeyId::from_parts(DeviceKeyAlgorithm::Ed25519, self.public_key().as_str().into())
|
||||
.to_string(),
|
||||
self.public_key().to_string(),
|
||||
);
|
||||
)]);
|
||||
|
||||
CrossSigningKey::new(user_id, vec![usage], keys, BTreeMap::new())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user