Skip to content

Commit

Permalink
Merge pull request #14 from matrix-org/af/return-keys-backup-type
Browse files Browse the repository at this point in the history
backups: expect a KeysBackupRequest
  • Loading branch information
AndrewFerr authored Jul 27, 2023
2 parents 4fa256a + 7f202a3 commit 59c6bd7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ console_error_panic_hook = "0.1.7"
futures-util = "0.3.27"
http = "0.2.6"
js-sys = "0.3.49"
matrix-sdk-common = { git = "https://github.com/matrix-org/matrix-rust-sdk", rev = "2cec3b0c4568a6b8f762ff46d285df710047d2a1", features = ["js"] }
matrix-sdk-indexeddb = { git = "https://github.com/matrix-org/matrix-rust-sdk", rev = "2cec3b0c4568a6b8f762ff46d285df710047d2a1" }
matrix-sdk-qrcode = { git = "https://github.com/matrix-org/matrix-rust-sdk", rev = "2cec3b0c4568a6b8f762ff46d285df710047d2a1", optional = true }
matrix-sdk-common = { git = "https://github.com/matrix-org/matrix-rust-sdk", rev = "fc3883d08e3ce9d04be39b1fc2867c21b973dbd7", features = ["js"] }
matrix-sdk-indexeddb = { git = "https://github.com/matrix-org/matrix-rust-sdk", rev = "fc3883d08e3ce9d04be39b1fc2867c21b973dbd7" }
matrix-sdk-qrcode = { git = "https://github.com/matrix-org/matrix-rust-sdk", rev = "fc3883d08e3ce9d04be39b1fc2867c21b973dbd7", optional = true }
serde_json = "1.0.91"
serde-wasm-bindgen = "0.5.0"
tracing = { version = "0.1.36", default-features = false, features = ["std"] }
Expand All @@ -53,6 +53,6 @@ zeroize = "1.3.0"

[dependencies.matrix-sdk-crypto]
git = "https://github.com/matrix-org/matrix-rust-sdk"
rev = "2cec3b0c4568a6b8f762ff46d285df710047d2a1"
rev = "fc3883d08e3ce9d04be39b1fc2867c21b973dbd7"
default_features = false
features = ["js", "backups_v1", "automatic-room-key-forwarding"]
18 changes: 9 additions & 9 deletions src/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -918,16 +918,16 @@ impl OlmMachine {
let me = self.inner.clone();

future_to_promise(async move {
let request = me.backup_machine().backup().await?;

let Some(request) = request else {
return Ok(None);
};
match me.backup_machine().backup().await? {
Some((transaction_id, keys_backup_request)) => {
Ok(Some(requests::KeysBackupRequest::try_from((
transaction_id.to_string(),
&keys_backup_request,
))?))
}

// Wrap with our own `OutgoingRequest` wrapper, so that we can benefit from its
// `TryFrom for JsValue` implementation, which converts back to a
// `KeysBackupRequest`
Ok(Some(JsValue::try_from(OutgoingRequest(request))?))
None => Ok(None),
}
})
}

Expand Down

0 comments on commit 59c6bd7

Please sign in to comment.