Skip to content

Commit

Permalink
More work
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Fella committed Dec 29, 2024
1 parent 10aec7f commit 8536018
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Quotient/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<PutRoomKeysJob>(stringFromRust(request.keys_backup_version()), fromJson<QHash<RoomId, RoomKeyBackup>>(jsonFromRust(request.keys_backup_rooms()))).onResult([this, id](const auto& job){
(*cryptoMachine)->mark_keys_backup_as_sent(bytesToRust(job->rawData()), stringToRust(id));
}).QFuture<PutRoomKeysJob*>::then([](auto){}));
}
}

Expand Down
2 changes: 2 additions & 0 deletions Quotient/crypto-sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 16 additions & 0 deletions Quotient/crypto-sdk/src/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 8536018

Please sign in to comment.