Skip to content

Commit

Permalink
Resolve warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed Sep 18, 2023
1 parent 7ca248e commit 6795e8b
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 24 deletions.
3 changes: 1 addition & 2 deletions crates/bitwarden/src/auth/login/password.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::{
api::request::PasswordTokenRequest,
login::{determine_password_hash, TwoFactorRequest},
},
client::LoginMethod,
client::{kdf::Kdf, LoginMethod},
crypto::EncString,
Client,
};
Expand All @@ -21,7 +21,6 @@ use crate::{
api::response::IdentityTokenResponse,
login::response::{captcha_response::CaptchaResponse, two_factor::TwoFactorProviders},
},
client::kdf::Kdf,
error::Result,
};

Expand Down
4 changes: 2 additions & 2 deletions crates/bitwarden/src/auth/renew.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::time::{Duration, Instant};

#[cfg(feature = "internal")]
use crate::auth::api::request::ApiTokenRequest;
use crate::{auth::api::request::ApiTokenRequest, client::UserLoginMethod};
use crate::{
auth::api::{request::AccessTokenRequest, response::IdentityTokenResponse},
client::{Client, LoginMethod, ServiceAccountLoginMethod, UserLoginMethod},
client::{Client, LoginMethod, ServiceAccountLoginMethod},
error::{Error, Result},
};

Expand Down
35 changes: 17 additions & 18 deletions crates/bitwarden/src/client/client.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
use std::time::{Duration, Instant};

use reqwest::header::{self};
use uuid::Uuid;
#[cfg(feature = "internal")]
use {
crate::{
auth::login::{
api_key_login, password_login, send_two_factor_email, ApiKeyLoginRequest,
ApiKeyLoginResponse, PasswordLoginRequest, PasswordLoginResponse,
TwoFactorEmailRequest,
},
crypto::EncString,
platform::{
generate_fingerprint, get_user_api_key, sync, FingerprintRequest, FingerprintResponse,
SecretVerificationRequest, SyncRequest, SyncResponse, UserApiKeyResponse,
},
use crate::{
auth::login::{
api_key_login, password_login, send_two_factor_email, ApiKeyLoginRequest,
ApiKeyLoginResponse, PasswordLoginRequest, PasswordLoginResponse, TwoFactorEmailRequest,
},
client::kdf::Kdf,
crypto::EncString,
platform::{
generate_fingerprint, get_user_api_key, sync, FingerprintRequest, FingerprintResponse,
SecretVerificationRequest, SyncRequest, SyncResponse, UserApiKeyResponse,
},
log::debug,
};
use reqwest::header::{self};
use uuid::Uuid;

#[cfg(feature = "secrets")]
use crate::auth::login::{access_token_login, AccessTokenLoginRequest, AccessTokenLoginResponse};
Expand All @@ -26,7 +23,6 @@ use crate::{
client::{
client_settings::{ClientSettings, DeviceType},
encryption_settings::EncryptionSettings,
kdf::Kdf,
},
crypto::SymmetricCryptoKey,
error::{Error, Result},
Expand All @@ -49,6 +45,7 @@ pub(crate) enum LoginMethod {
}

#[derive(Debug, Clone)]
#[cfg(feature = "internal")]
pub(crate) enum UserLoginMethod {
Username {
client_id: String,
Expand Down Expand Up @@ -194,7 +191,7 @@ impl Client {
Some(LoginMethod::ServiceAccount(ServiceAccountLoginMethod::AccessToken {
organization_id,
..
})) => return Some(organization_id),
})) => Some(organization_id),
_ => None,
}
}
Expand All @@ -203,8 +200,10 @@ impl Client {
self.encryption_settings.as_ref().ok_or(Error::VaultLocked)
}

#[cfg(feature = "internal")]
#[cfg(feature = "mobile")]
pub(crate) fn set_login_method(&mut self, login_method: LoginMethod) {
use log::debug;

debug! {"setting login method: {:#?}", login_method}
self.login_method = Some(login_method);
}
Expand Down
3 changes: 1 addition & 2 deletions crates/bitwarden/src/client/kdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ use bitwarden_api_identity::models::{KdfType, PreloginResponseModel};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

use crate::error::Error;
#[cfg(feature = "internal")]
use crate::error::Result;
use crate::error::{Error, Result};

#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
Expand Down

0 comments on commit 6795e8b

Please sign in to comment.