rust: Return the map of room keys that were imported
This commit is contained in:
parent
46ba0eec9f
commit
d138306b08
@ -29,11 +29,11 @@ features = ["lax_deserialize"]
|
||||
|
||||
[dependencies.matrix-sdk-common]
|
||||
git = "https://github.com/matrix-org/matrix-rust-sdk/"
|
||||
rev = "fc74526699b82ba5be3349e810ded51138dae7fc"
|
||||
rev = "7b6132b71e499224ed25bdc571b2a54d076551d6"
|
||||
|
||||
[dependencies.matrix-sdk-crypto]
|
||||
git = "https://github.com/matrix-org/matrix-rust-sdk/"
|
||||
rev = "fc74526699b82ba5be3349e810ded51138dae7fc"
|
||||
rev = "7b6132b71e499224ed25bdc571b2a54d076551d6"
|
||||
features = ["sled_cryptostore", "qrcode", "backups_v1"]
|
||||
|
||||
[dependencies.tokio]
|
||||
|
@ -628,8 +628,20 @@ impl OlmMachine {
|
||||
.block_on(self.inner.import_keys(keys, from_backup, listener))?;
|
||||
|
||||
Ok(KeysImportResult {
|
||||
total: result.total_count as i64,
|
||||
imported: result.imported_count as i64,
|
||||
total: result.total_count as i64,
|
||||
keys: result
|
||||
.keys
|
||||
.into_iter()
|
||||
.map(|(r, m)| {
|
||||
(
|
||||
r.to_string(),
|
||||
m.into_iter()
|
||||
.map(|(s, k)| (s, k.into_iter().collect()))
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
.collect(),
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,9 @@ dictionary DeviceLists {
|
||||
};
|
||||
|
||||
dictionary KeysImportResult {
|
||||
i64 total;
|
||||
i64 imported;
|
||||
i64 total;
|
||||
record<DOMString, record<DOMString, sequence<string>>> keys;
|
||||
};
|
||||
|
||||
dictionary DecryptedEvent {
|
||||
|
@ -295,8 +295,15 @@ impl From<DeviceLists> for RumaDeviceLists {
|
||||
}
|
||||
|
||||
pub struct KeysImportResult {
|
||||
pub total: i64,
|
||||
/// The number of room keys that were imported.
|
||||
pub imported: i64,
|
||||
/// The total number of room keys that were found in the export.
|
||||
pub total: i64,
|
||||
/// The map of keys that were imported.
|
||||
///
|
||||
/// It's a map from room id to a map of the sender key to a list of session
|
||||
/// ids.
|
||||
pub keys: HashMap<String, HashMap<String, Vec<String>>>,
|
||||
}
|
||||
|
||||
pub(crate) enum OwnedResponse {
|
||||
|
Loading…
Reference in New Issue
Block a user