Changeset View
Changeset View
Standalone View
Standalone View
services/commtest/src/identity/device.rs
use comm_opaque2::client::Registration; | use comm_opaque2::client::Registration; | ||||
use rand::{distributions::Alphanumeric, Rng}; | use rand::{distributions::Alphanumeric, Rng}; | ||||
mod proto { | mod proto { | ||||
tonic::include_proto!("identity.client"); | tonic::include_proto!("identity.client"); | ||||
} | } | ||||
use proto as client; | |||||
use proto::{ | use proto::{ | ||||
identity_client_service_client::IdentityClientServiceClient, DeviceKeyUpload, | identity_client_service_client::IdentityClientServiceClient, DeviceKeyUpload, | ||||
DeviceType, IdentityKeyInfo, PreKey, RegistrationFinishRequest, | IdentityKeyInfo, PreKey, RegistrationFinishRequest, RegistrationStartRequest, | ||||
RegistrationStartRequest, | |||||
}; | }; | ||||
pub struct DeviceInfo { | pub struct DeviceInfo { | ||||
pub username: String, | pub username: String, | ||||
pub user_id: String, | pub user_id: String, | ||||
pub device_id: String, | pub device_id: String, | ||||
pub access_token: String, | pub access_token: String, | ||||
} | } | ||||
Show All 28 Lines | device_key_upload: Some(DeviceKeyUpload { | ||||
pre_key_signature: "content_prekey_sig".to_string(), | pre_key_signature: "content_prekey_sig".to_string(), | ||||
}), | }), | ||||
notif_upload: Some(PreKey { | notif_upload: Some(PreKey { | ||||
pre_key: "notif_prekey".to_string(), | pre_key: "notif_prekey".to_string(), | ||||
pre_key_signature: "notif_prekey_sig".to_string(), | pre_key_signature: "notif_prekey_sig".to_string(), | ||||
}), | }), | ||||
onetime_content_prekeys: Vec::new(), | onetime_content_prekeys: Vec::new(), | ||||
onetime_notif_prekeys: Vec::new(), | onetime_notif_prekeys: Vec::new(), | ||||
device_type: DeviceType::Keyserver.into(), | device_type: client::DeviceType::Keyserver.into(), | ||||
}), | }), | ||||
}; | }; | ||||
// TODO: allow endpoint to be configured | // TODO: allow endpoint to be configured | ||||
let mut identity_client = | let mut identity_client = | ||||
IdentityClientServiceClient::connect("http://127.0.0.1:50054") | IdentityClientServiceClient::connect("http://127.0.0.1:50054") | ||||
.await | .await | ||||
.expect("Couldn't connect to identitiy service"); | .expect("Couldn't connect to identitiy service"); | ||||
Show All 31 Lines |