Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix device-name when linking as secondary device #123

Merged
merged 1 commit into from
Jan 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions libsignal-service/src/account_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ use crate::{
proto::{ProvisionEnvelope, ProvisionMessage, ProvisioningVersion},
provisioning::{ProvisioningCipher, ProvisioningError},
push_service::{
AccountAttributes, DeviceCapabilities, HttpAuthOverride, PushService,
ServiceError,
AccountAttributes, HttpAuthOverride, PushService, ServiceError,
},
};

Expand Down Expand Up @@ -396,36 +395,10 @@ impl<Service: PushService> AccountManager<Service> {
/// Set profile attributes
///
/// Signal Android does not allow unsetting voice/video.
#[allow(clippy::too_many_arguments)]
pub async fn set_account_attributes(
&mut self,
signaling_key: Option<Vec<u8>>,
registration_id: u32,
voice: bool,
video: bool,
fetches_messages: bool,
pin: Option<String>,
registration_lock: Option<String>,
unidentified_access_key: Option<Vec<u8>>,
unrestricted_unidentified_access: bool,
discoverable_by_phone_number: bool,
capabilities: DeviceCapabilities,
attributes: AccountAttributes,
) -> Result<(), ServiceError> {
let attribs = AccountAttributes {
signaling_key,
registration_id,
voice,
video,
fetches_messages,
pin,
registration_lock,
unidentified_access_key,
unrestricted_unidentified_access,
discoverable_by_phone_number,

capabilities,
};
self.service.set_account_attributes(attribs).await?;
Ok(())
self.service.set_account_attributes(attributes).await
}
}
5 changes: 2 additions & 3 deletions libsignal-service/src/provisioning/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ pub struct ConfirmDeviceMessage {
pub supports_sms: bool,
pub fetches_messages: bool,
pub registration_id: u32,
pub name: String,
// FIXME: the name goes back here when we send this via the websocket
//pub name: String,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this become an issue?

}

impl ConfirmCodeMessage {
Expand Down Expand Up @@ -281,7 +282,6 @@ impl<P: PushService> LinkingManager<P> {
&mut self,
csprng: &mut R,
signaling_key: SignalingKey,
device_name: &str,
mut tx: Sender<SecondaryDeviceProvisioning>,
) -> Result<(), ProvisioningError> {
// open a websocket without authentication, to receive a tsurl://
Expand Down Expand Up @@ -373,7 +373,6 @@ impl<P: PushService> LinkingManager<P> {
supports_sms: false,
fetches_messages: true,
registration_id,
name: device_name.to_string(),
},
)
.await?;
Expand Down
2 changes: 2 additions & 0 deletions libsignal-service/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ pub struct DeviceInfo {
pub struct AccountAttributes {
#[serde(default, with = "serde_optional_base64")]
pub signaling_key: Option<Vec<u8>>,
#[serde(rename = "name", skip_serializing_if = "Option::is_none")]
pub device_name: Option<String>,
pub registration_id: u32,
pub voice: bool,
pub video: bool,
Expand Down