Page MenuHomePhabricator

D8750.diff
No OneTemporary

D8750.diff

diff --git a/keyserver/addons/rust-node-addon/rust-binding-types.js b/keyserver/addons/rust-node-addon/rust-binding-types.js
--- a/keyserver/addons/rust-node-addon/rust-binding-types.js
+++ b/keyserver/addons/rust-node-addon/rust-binding-types.js
@@ -54,6 +54,13 @@
notifPrekey: string,
notifPrekeySignature: string,
) => Promise<boolean>,
+ +uploadOneTimeKeys: (
+ userId: string,
+ deviceId: string,
+ accessToken: string,
+ contentOneTimePreKeys: $ReadOnlyArray<string>,
+ notifOneTimePreKeys: $ReadOnlyArray<string>,
+ ) => Promise<boolean>,
+getInboundKeysForUserDevice: (
identifierType: string,
identifierValue: string,
diff --git a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
--- a/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
+++ b/keyserver/addons/rust-node-addon/src/identity_client/mod.rs
@@ -3,6 +3,7 @@
pub mod prekey;
pub mod register_user;
pub mod remove_reserved_usernames;
+pub mod upload_one_time_keys;
use grpc_clients::identity::authenticated::AuthLayer;
use grpc_clients::identity::protos::unauthenticated as client_proto;
@@ -11,7 +12,7 @@
use client_proto::{
AddReservedUsernamesRequest, DeviceKeyUpload, IdentityKeyInfo, PreKey,
RegistrationFinishRequest, RegistrationStartRequest, DeviceType,
- RemoveReservedUsernameRequest, InboundKeyInfo
+ RemoveReservedUsernameRequest, InboundKeyInfo, UploadOneTimeKeysRequest
};
use lazy_static::lazy_static;
use napi::bindgen_prelude::*;
diff --git a/keyserver/addons/rust-node-addon/src/identity_client/upload_one_time_keys.rs b/keyserver/addons/rust-node-addon/src/identity_client/upload_one_time_keys.rs
new file mode 100644
--- /dev/null
+++ b/keyserver/addons/rust-node-addon/src/identity_client/upload_one_time_keys.rs
@@ -0,0 +1,29 @@
+use super::*;
+
+use tracing::debug;
+
+#[napi]
+#[instrument(skip_all)]
+pub async fn upload_one_time_keys(
+ user_id: String,
+ device_id: String,
+ access_token: String,
+ content_one_time_pre_keys: Vec<String>,
+ notif_one_time_pre_keys: Vec<String>,
+) -> Result<bool> {
+ // Set up the gRPC client that will be used to talk to the Identity service
+ let mut identity_client = get_identity_client_service_channel().await?;
+
+ let upload_request = UploadOneTimeKeysRequest {
+ user_id,
+ device_id,
+ access_token,
+ content_one_time_pre_keys,
+ notif_one_time_pre_keys,
+ };
+
+ debug!("Sending one time keys to Identity service");
+ let result = identity_client.upload_one_time_keys(upload_request).await;
+
+ Ok(true)
+}

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 23, 4:15 AM (18 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2568113
Default Alt Text
D8750.diff (2 KB)

Event Timeline