Skip to content

Commit

Permalink
Own String in HttpCredentials
Browse files Browse the repository at this point in the history
  • Loading branch information
gferon committed Mar 4, 2021
1 parent 305806e commit 28c04b3
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions libsignal-service-actix/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl AwcPushService {
let client = get_client(&cfg, user_agent);
Self {
cfg,
credentials: credentials.map(|c| c.authorization()),
credentials: credentials.and_then(|c| c.authorization()),
client,
}
}
Expand All @@ -55,7 +55,7 @@ impl AwcPushService {
{
builder = builder.basic_auth(
&http_credentials.username,
http_credentials.password.as_deref(),
Some(&http_credentials.password),
);
}
Ok(builder)
Expand Down
8 changes: 4 additions & 4 deletions libsignal-service/src/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ pub struct ServiceCredentials {
}

impl ServiceCredentials {
pub fn authorization(&self) -> HttpCredentials {
HttpCredentials {
pub fn authorization(&self) -> Option<HttpCredentials> {
self.password.as_ref().map(|password| HttpCredentials {
username: self.login(),
password: self.password.clone(),
}
password: password.clone(),
})
}

pub fn e164(&self) -> String {
Expand Down
5 changes: 2 additions & 3 deletions libsignal-service/src/gv2/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,8 @@ impl<'a, S: PushService, C: CredentialsCache> GroupsV2Api<'a, S, C> {
&group_secret_params.get_public_params(),
)?);

let password = Some(hex::encode(bincode::serialize(
&auth_credential_presentation,
)?));
let password =
hex::encode(bincode::serialize(&auth_credential_presentation)?);

Ok(HttpCredentials { username, password })
}
Expand Down
2 changes: 1 addition & 1 deletion libsignal-service/src/push_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ pub struct PreKeyStatus {
#[derive(Clone)]
pub struct HttpCredentials {
pub username: String,
pub password: Option<String>,
pub password: String,
}

impl ProfileKey {
Expand Down

0 comments on commit 28c04b3

Please sign in to comment.