Skip to content

Commit a7b2bb1

Browse files
committed
crypto: MemoryStore uses backup versions to track which sessions are backed up
1 parent 9b2f2a4 commit a7b2bb1

File tree

3 files changed

+385
-13
lines changed

3 files changed

+385
-13
lines changed

crates/matrix-sdk-crypto/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ Breaking changes:
2525

2626
Additions:
2727

28+
- Expose new method `BackupMachine::backup_version`.
29+
([#3320](https://github.com/matrix-org/matrix-rust-sdk/pull/3320))
30+
2831
- Expose new method `OlmMachine::device_creation_time`.
2932
([#3275](https://github.com/matrix-org/matrix-rust-sdk/pull/3275))
3033

crates/matrix-sdk-crypto/src/backups/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,12 @@ impl BackupMachine {
419419
Ok(())
420420
}
421421

422+
/// Provide the `backup_version` of the current `backup_key`, or None if there is no current
423+
/// key, or the key is not used with any backup version.
424+
pub async fn backup_version(&self) -> Option<String> {
425+
self.backup_key.read().await.as_ref().and_then(|k| k.backup_version())
426+
}
427+
422428
/// Store the backup decryption key in the crypto store.
423429
///
424430
/// This is useful if the client wants to support gossiping of the backup

0 commit comments

Comments
 (0)