Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32556219
D8750.1767217713.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D8750.1767217713.diff
View Options
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
@@ -44,6 +44,13 @@
notifPrekey: string,
notifPrekeySignature: string,
) => Promise<boolean>,
+ +uploadOneTimeKeys: (
+ userId: string,
+ deviceId: string,
+ accessToken: string,
+ contentOneTimePreKeys: $ReadOnlyArray<string>,
+ notifOneTimePreKeys: $ReadOnlyArray<string>,
+ ) => Promise<boolean>,
};
export type { RustNativeBindingAPI };
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
@@ -4,6 +4,7 @@
pub mod prekey;
pub mod register_user;
pub mod remove_reserved_usernames;
+pub mod upload_one_time_keys;
pub mod identity_client {
tonic::include_proto!("identity.client");
}
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,40 @@
+use super::*;
+
+use identity_client::UploadOneTimeKeysRequest;
+use tracing::{debug, error};
+
+#[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>,
+) -> bool {
+ let channel = match get_identity_service_channel().await {
+ Ok(c) => c,
+ Err(e) => {
+ error!(
+ "Error when attempting to connection identity service: {}",
+ e
+ );
+ return false;
+ }
+ };
+
+ let mut identity_client = IdentityClientServiceClient::new(channel);
+
+ 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;
+
+ result.is_ok()
+}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Dec 31, 9:48 PM (2 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5874524
Default Alt Text
D8750.1767217713.diff (2 KB)
Attached To
Mode
D8750: [Keyserver/rust] Implement upload_one_time_keys to identity service
Attached
Detach File
Event Timeline
Log In to Comment