Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3400833
D10618.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10618.diff
View Options
diff --git a/native/native_rust_library/src/lib.rs b/native/native_rust_library/src/lib.rs
--- a/native/native_rust_library/src/lib.rs
+++ b/native/native_rust_library/src/lib.rs
@@ -4,8 +4,9 @@
use ffi::{bool_callback, string_callback, void_callback};
use grpc_clients::identity::protos::authenticated::{
InboundKeyInfo, InboundKeysForUserRequest, KeyserverKeysResponse,
- OutboundKeyInfo, OutboundKeysForUserRequest, UpdateUserPasswordFinishRequest,
- UpdateUserPasswordStartRequest, UploadOneTimeKeysRequest,
+ OutboundKeyInfo, OutboundKeysForUserRequest, RefreshUserPrekeysRequest,
+ UpdateUserPasswordFinishRequest, UpdateUserPasswordStartRequest,
+ UploadOneTimeKeysRequest,
};
use grpc_clients::identity::protos::unauth::{
DeviceKeyUpload, DeviceType, Empty, IdentityKeyInfo,
@@ -134,6 +135,18 @@
promise_id: u32,
);
+ #[cxx_name = "identityRefreshUserPrekeys"]
+ fn refresh_user_prekeys(
+ auth_user_id: String,
+ auth_device_id: String,
+ auth_access_token: String,
+ content_prekey: String,
+ content_prekey_signature: String,
+ notif_prekey: String,
+ notif_prekey_signature: String,
+ promise_id: u32,
+ );
+
#[cxx_name = "identityGenerateNonce"]
fn generate_nonce(promise_id: u32);
@@ -1102,6 +1115,57 @@
Ok(serde_json::to_string(&inbound_key_info)?)
}
+fn refresh_user_prekeys(
+ auth_user_id: String,
+ auth_device_id: String,
+ auth_access_token: String,
+ content_prekey: String,
+ content_prekey_signature: String,
+ notif_prekey: String,
+ notif_prekey_signature: String,
+ promise_id: u32,
+) {
+ RUNTIME.spawn(async move {
+ let refresh_request = RefreshUserPrekeysRequest {
+ new_content_prekeys: Some(Prekey {
+ prekey: content_prekey,
+ prekey_signature: content_prekey_signature,
+ }),
+ new_notif_prekeys: Some(Prekey {
+ prekey: notif_prekey,
+ prekey_signature: notif_prekey_signature,
+ }),
+ };
+
+ let auth_info = AuthInfo {
+ access_token: auth_access_token,
+ user_id: auth_user_id,
+ device_id: auth_device_id,
+ };
+ let result = refresh_user_prekeys_helper(refresh_request, auth_info).await;
+ handle_void_result_as_callback(result, promise_id);
+ });
+}
+
+async fn refresh_user_prekeys_helper(
+ refresh_request: RefreshUserPrekeysRequest,
+ auth_info: AuthInfo,
+) -> Result<(), Error> {
+ get_auth_client(
+ IDENTITY_SOCKET_ADDR,
+ auth_info.user_id,
+ auth_info.device_id,
+ auth_info.access_token,
+ CODE_VERSION,
+ DEVICE_TYPE.as_str_name().to_lowercase(),
+ )
+ .await?
+ .refresh_user_prekeys(refresh_request)
+ .await?;
+
+ Ok(())
+}
+
#[instrument]
fn upload_one_time_keys(
auth_user_id: String,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 3, 9:06 AM (21 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611119
Default Alt Text
D10618.diff (2 KB)
Attached To
Mode
D10618: [NativeRustModule] implement uploading prekeys
Attached
Detach File
Event Timeline
Log In to Comment