diff --git a/Quotient/connection.cpp b/Quotient/connection.cpp index 4bceffdb3..ce0737589 100644 --- a/Quotient/connection.cpp +++ b/Quotient/connection.cpp @@ -735,9 +735,9 @@ void Connection::Private::processOutgoingRequests() (*cryptoMachine)->mark_room_message_as_sent(stringToRust(targetEvt.id()), stringToRust(id)); })); } else if (type == 6) { // keys backup - // Afaict these requests are never actually used by the sdk - qWarning() << "keys";// << stringFromRust(request.json()); - //TODO + futures.append(q->callApi(stringFromRust(request.keys_backup_version()), fromJson>(jsonFromRust(request.keys_backup_rooms()))).onResult([this, id](const auto& job){ + (*cryptoMachine)->mark_keys_backup_as_sent(bytesToRust(job->rawData()), stringToRust(id)); + }).QFuture::then([](auto){})); } } diff --git a/Quotient/crypto-sdk/src/lib.rs b/Quotient/crypto-sdk/src/lib.rs index ba9acd010..10c25a355 100644 --- a/Quotient/crypto-sdk/src/lib.rs +++ b/Quotient/crypto-sdk/src/lib.rs @@ -236,6 +236,8 @@ mod ffi { fn room_msg_matrix_type(self: &OutgoingRequest) -> String; fn to_device_txn_id(self: &OutgoingRequest) -> String; fn room_msg_txn_id(self: &OutgoingRequest) -> String; + fn keys_backup_version(self: &OutgoingRequest) -> String; + fn keys_backup_rooms(self: &OutgoingRequest) -> String; fn timeout(self: &KeysClaimRequest) -> usize; fn id(self: &KeysClaimRequest) -> String; diff --git a/Quotient/crypto-sdk/src/request.rs b/Quotient/crypto-sdk/src/request.rs index fbeda3810..f926add27 100644 --- a/Quotient/crypto-sdk/src/request.rs +++ b/Quotient/crypto-sdk/src/request.rs @@ -149,6 +149,22 @@ impl OutgoingRequest { } } + pub(crate) fn keys_backup_version(&self) -> String { + if let OutgoingRequests::KeysBackup(request) = self.0.request() { + serde_json::to_string(&request.version).unwrap() + } else { + panic!() + } + } + + pub(crate) fn keys_backup_rooms(&self) -> String { + if let OutgoingRequests::KeysBackup(request) = self.0.request() { + serde_json::to_string(&request.rooms).unwrap() + } else { + panic!() + } + } + pub(crate) fn keys_upload_device_keys(&self) -> String { if let OutgoingRequests::KeysUpload(request) = self.0.request() { serde_json::to_string(&request.device_keys).unwrap()