Skip to content

Commit d1024de

Browse files
chore: rename Client* to *Client
1 parent edee180 commit d1024de

37 files changed

+124
-124
lines changed

crates/bitwarden-core/src/auth/client_auth.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ use crate::auth::{
2525
};
2626
use crate::{auth::renew::renew_token, error::Result, Client};
2727

28-
pub struct ClientAuth<'a> {
28+
pub struct AuthClient<'a> {
2929
pub(crate) client: &'a crate::Client,
3030
}
3131

32-
impl<'a> ClientAuth<'a> {
32+
impl<'a> AuthClient<'a> {
3333
pub async fn renew_token(&self) -> Result<()> {
3434
renew_token(&self.client.internal).await
3535
}
@@ -44,7 +44,7 @@ impl<'a> ClientAuth<'a> {
4444
}
4545

4646
#[cfg(feature = "internal")]
47-
impl<'a> ClientAuth<'a> {
47+
impl<'a> AuthClient<'a> {
4848
pub fn password_strength(
4949
&self,
5050
password: String,
@@ -142,7 +142,7 @@ impl<'a> ClientAuth<'a> {
142142
}
143143

144144
#[cfg(feature = "internal")]
145-
impl<'a> ClientAuth<'a> {
145+
impl<'a> AuthClient<'a> {
146146
pub async fn login_device(
147147
&self,
148148
email: String,
@@ -170,8 +170,8 @@ fn trust_device(client: &Client) -> Result<TrustDeviceResponse> {
170170
}
171171

172172
impl<'a> Client {
173-
pub fn auth(&'a self) -> ClientAuth<'a> {
174-
ClientAuth { client: self }
173+
pub fn auth(&'a self) -> AuthClient<'a> {
174+
AuthClient { client: self }
175175
}
176176
}
177177

crates/bitwarden-core/src/mobile/client_crypto.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ use crate::{
1313
},
1414
};
1515

16-
pub struct ClientCrypto<'a> {
16+
pub struct CryptoClient<'a> {
1717
pub(crate) client: &'a crate::Client,
1818
}
1919

20-
impl<'a> ClientCrypto<'a> {
20+
impl<'a> CryptoClient<'a> {
2121
pub async fn initialize_user_crypto(
2222
&self,
2323
req: InitUserCryptoRequest,
@@ -59,7 +59,7 @@ impl<'a> ClientCrypto<'a> {
5959
}
6060

6161
impl<'a> Client {
62-
pub fn crypto(&'a self) -> ClientCrypto<'a> {
63-
ClientCrypto { client: self }
62+
pub fn crypto(&'a self) -> CryptoClient<'a> {
63+
CryptoClient { client: self }
6464
}
6565
}

crates/bitwarden-core/src/mobile/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ pub mod kdf;
44
mod client_crypto;
55
mod client_kdf;
66

7-
pub use client_crypto::ClientCrypto;
7+
pub use client_crypto::CryptoClient;
88
pub use client_kdf::ClientKdf;

crates/bitwarden-core/src/platform/client_platform.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use super::{
55
};
66
use crate::{error::Result, Client};
77

8-
pub struct ClientPlatform<'a> {
8+
pub struct PlatformClient<'a> {
99
pub(crate) client: &'a Client,
1010
}
1111

12-
impl<'a> ClientPlatform<'a> {
12+
impl<'a> PlatformClient<'a> {
1313
pub fn fingerprint(&self, input: &FingerprintRequest) -> Result<FingerprintResponse> {
1414
generate_fingerprint(input)
1515
}
@@ -27,7 +27,7 @@ impl<'a> ClientPlatform<'a> {
2727
}
2828

2929
impl<'a> Client {
30-
pub fn platform(&'a self) -> ClientPlatform<'a> {
31-
ClientPlatform { client: self }
30+
pub fn platform(&'a self) -> PlatformClient<'a> {
31+
PlatformClient { client: self }
3232
}
3333
}

crates/bitwarden-exporters/src/client_exporter.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use crate::{
66
ExportError, ExportFormat,
77
};
88

9-
pub struct ClientExporters<'a> {
9+
pub struct ExporterClients<'a> {
1010
client: &'a Client,
1111
}
1212

13-
impl<'a> ClientExporters<'a> {
13+
impl<'a> ExporterClients<'a> {
1414
fn new(client: &'a Client) -> Self {
1515
Self { client }
1616
}
@@ -34,12 +34,12 @@ impl<'a> ClientExporters<'a> {
3434
}
3535
}
3636

37-
pub trait ClientExportersExt<'a> {
38-
fn exporters(&'a self) -> ClientExporters<'a>;
37+
pub trait ExporterClientsExt<'a> {
38+
fn exporters(&'a self) -> ExporterClients<'a>;
3939
}
4040

41-
impl<'a> ClientExportersExt<'a> for Client {
42-
fn exporters(&'a self) -> ClientExporters<'a> {
43-
ClientExporters::new(self)
41+
impl<'a> ExporterClientsExt<'a> for Client {
42+
fn exporters(&'a self) -> ExporterClients<'a> {
43+
ExporterClients::new(self)
4444
}
4545
}

crates/bitwarden-exporters/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod csv;
1212
mod encrypted_json;
1313
mod json;
1414
mod models;
15-
pub use client_exporter::{ClientExporters, ClientExportersExt};
15+
pub use client_exporter::{ExporterClients, ExporterClientsExt};
1616
mod error;
1717
mod export;
1818
pub use error::ExportError;

crates/bitwarden-generators/src/client_generator.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ use crate::{
66
UsernameGeneratorRequest,
77
};
88

9-
pub struct ClientGenerator<'a> {
9+
pub struct GeneratorClient<'a> {
1010
client: &'a Client,
1111
}
1212

13-
impl<'a> ClientGenerator<'a> {
13+
impl<'a> GeneratorClient<'a> {
1414
fn new(client: &'a Client) -> Self {
1515
Self { client }
1616
}
@@ -23,7 +23,7 @@ impl<'a> ClientGenerator<'a> {
2323
///
2424
/// ```
2525
/// use bitwarden_core::Client;
26-
/// use bitwarden_generators::{ClientGeneratorExt, PassphraseError, PasswordGeneratorRequest};
26+
/// use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PasswordGeneratorRequest};
2727
///
2828
/// async fn test() -> Result<(), PassphraseError> {
2929
/// let input = PasswordGeneratorRequest {
@@ -53,7 +53,7 @@ impl<'a> ClientGenerator<'a> {
5353
///
5454
/// ```
5555
/// use bitwarden_core::Client;
56-
/// use bitwarden_generators::{ClientGeneratorExt, PassphraseError, PassphraseGeneratorRequest};
56+
/// use bitwarden_generators::{GeneratorClientsExt, PassphraseError, PassphraseGeneratorRequest};
5757
///
5858
/// async fn test() -> Result<(), PassphraseError> {
5959
/// let input = PassphraseGeneratorRequest {
@@ -78,7 +78,7 @@ impl<'a> ClientGenerator<'a> {
7878
///
7979
/// ```
8080
/// use bitwarden_core::Client;
81-
/// use bitwarden_generators::{ClientGeneratorExt, UsernameError, UsernameGeneratorRequest};
81+
/// use bitwarden_generators::{GeneratorClientsExt, UsernameError, UsernameGeneratorRequest};
8282
///
8383
/// async fn test() -> Result<(), UsernameError> {
8484
/// let input = UsernameGeneratorRequest::Word {
@@ -95,12 +95,12 @@ impl<'a> ClientGenerator<'a> {
9595
}
9696
}
9797

98-
pub trait ClientGeneratorExt<'a> {
99-
fn generator(&'a self) -> ClientGenerator<'a>;
98+
pub trait GeneratorClientsExt<'a> {
99+
fn generator(&'a self) -> GeneratorClient<'a>;
100100
}
101101

102-
impl<'a> ClientGeneratorExt<'a> for Client {
103-
fn generator(&'a self) -> ClientGenerator<'a> {
104-
ClientGenerator::new(self)
102+
impl<'a> GeneratorClientsExt<'a> for Client {
103+
fn generator(&'a self) -> GeneratorClient<'a> {
104+
GeneratorClient::new(self)
105105
}
106106
}

crates/bitwarden-generators/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
mod client_generator;
22
mod username_forwarders;
3-
pub use client_generator::{ClientGenerator, ClientGeneratorExt};
3+
pub use client_generator::{GeneratorClient, GeneratorClientsExt};
44
pub(crate) mod passphrase;
55
pub use passphrase::{PassphraseError, PassphraseGeneratorRequest};
66
pub(crate) mod password;

crates/bitwarden-send/src/client_sends.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ use bitwarden_crypto::{EncString, KeyDecryptable, KeyEncryptable};
55

66
use crate::{Send, SendListView, SendView};
77

8-
pub struct ClientSends<'a> {
8+
pub struct SendClients<'a> {
99
client: &'a Client,
1010
}
1111

12-
impl<'a> ClientSends<'a> {
12+
impl<'a> SendClients<'a> {
1313
fn new(client: &'a Client) -> Self {
1414
Self { client }
1515
}
@@ -84,12 +84,12 @@ impl<'a> ClientSends<'a> {
8484
}
8585
}
8686

87-
pub trait ClientSendsExt<'a> {
88-
fn sends(&'a self) -> ClientSends<'a>;
87+
pub trait SendClientsExt<'a> {
88+
fn sends(&'a self) -> SendClients<'a>;
8989
}
9090

91-
impl<'a> ClientSendsExt<'a> for Client {
92-
fn sends(&'a self) -> ClientSends<'a> {
93-
ClientSends::new(self)
91+
impl<'a> SendClientsExt<'a> for Client {
92+
fn sends(&'a self) -> SendClients<'a> {
93+
SendClients::new(self)
9494
}
9595
}

crates/bitwarden-send/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ mod uniffi_support;
66
mod error;
77
pub use error::SendParseError;
88
mod client_sends;
9-
pub use client_sends::{ClientSends, ClientSendsExt};
9+
pub use client_sends::{SendClients, SendClientsExt};
1010
mod send;
1111
pub use send::{Send, SendListView, SendView};

crates/bitwarden-uniffi/src/auth/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use bitwarden_crypto::{AsymmetricEncString, EncString, HashPurpose, Kdf, TrustDe
1212
use crate::{error::Result, Client};
1313

1414
#[derive(uniffi::Object)]
15-
pub struct ClientAuth(pub(crate) Arc<Client>);
15+
pub struct AuthClient(pub(crate) Arc<Client>);
1616

1717
#[uniffi::export(async_runtime = "tokio")]
18-
impl ClientAuth {
18+
impl AuthClient {
1919
/// **API Draft:** Calculate Password Strength
2020
pub fn password_strength(
2121
&self,
@@ -94,7 +94,7 @@ impl ClientAuth {
9494

9595
/// Validate the user password
9696
///
97-
/// To retrieve the user's password hash, use [`ClientAuth::hash_password`] with
97+
/// To retrieve the user's password hash, use [`AuthClient::hash_password`] with
9898
/// `HashPurpose::LocalAuthentication` during login and persist it. If the login method has no
9999
/// password, use the email OTP.
100100
pub fn validate_password(&self, password: String, password_hash: String) -> Result<bool> {

crates/bitwarden-uniffi/src/crypto.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use bitwarden_crypto::{AsymmetricEncString, EncString};
1212
use crate::{error::Result, Client};
1313

1414
#[derive(uniffi::Object)]
15-
pub struct ClientCrypto(pub(crate) Arc<Client>);
15+
pub struct CryptoClient(pub(crate) Arc<Client>);
1616

1717
#[uniffi::export(async_runtime = "tokio")]
18-
impl ClientCrypto {
18+
impl CryptoClient {
1919
/// Initialization method for the user crypto. Needs to be called before any other crypto
2020
/// operations.
2121
pub async fn initialize_user_crypto(&self, req: InitUserCryptoRequest) -> Result<()> {

crates/bitwarden-uniffi/src/lib.rs

+19-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ uniffi::setup_scaffolding!();
22

33
use std::sync::Arc;
44

5-
use auth::ClientAuth;
5+
use auth::AuthClient;
66
use bitwarden_core::ClientSettings;
77

88
pub mod auth;
@@ -16,11 +16,11 @@ pub mod vault;
1616
#[cfg(target_os = "android")]
1717
mod android_support;
1818

19-
use crypto::ClientCrypto;
19+
use crypto::CryptoClient;
2020
use error::Result;
21-
use platform::ClientPlatform;
22-
use tool::{ClientExporters, ClientGenerators, ClientSends};
23-
use vault::ClientVault;
21+
use platform::PlatformClient;
22+
use tool::{ExporterClients, GeneratorClients, SendClients};
23+
use vault::VaultClient;
2424

2525
#[derive(uniffi::Object)]
2626
pub struct Client(bitwarden_core::Client);
@@ -39,37 +39,37 @@ impl Client {
3939
}
4040

4141
/// Crypto operations
42-
pub fn crypto(self: Arc<Self>) -> Arc<ClientCrypto> {
43-
Arc::new(ClientCrypto(self))
42+
pub fn crypto(self: Arc<Self>) -> Arc<CryptoClient> {
43+
Arc::new(CryptoClient(self))
4444
}
4545

4646
/// Vault item operations
47-
pub fn vault(self: Arc<Self>) -> Arc<ClientVault> {
48-
Arc::new(ClientVault(self))
47+
pub fn vault(self: Arc<Self>) -> Arc<VaultClient> {
48+
Arc::new(VaultClient(self))
4949
}
5050

51-
pub fn platform(self: Arc<Self>) -> Arc<ClientPlatform> {
52-
Arc::new(ClientPlatform(self))
51+
pub fn platform(self: Arc<Self>) -> Arc<PlatformClient> {
52+
Arc::new(PlatformClient(self))
5353
}
5454

5555
/// Generator operations
56-
pub fn generators(self: Arc<Self>) -> Arc<ClientGenerators> {
57-
Arc::new(ClientGenerators(self))
56+
pub fn generators(self: Arc<Self>) -> Arc<GeneratorClients> {
57+
Arc::new(GeneratorClients(self))
5858
}
5959

6060
/// Exporters
61-
pub fn exporters(self: Arc<Self>) -> Arc<ClientExporters> {
62-
Arc::new(ClientExporters(self))
61+
pub fn exporters(self: Arc<Self>) -> Arc<ExporterClients> {
62+
Arc::new(ExporterClients(self))
6363
}
6464

6565
/// Sends operations
66-
pub fn sends(self: Arc<Self>) -> Arc<ClientSends> {
67-
Arc::new(ClientSends(self))
66+
pub fn sends(self: Arc<Self>) -> Arc<SendClients> {
67+
Arc::new(SendClients(self))
6868
}
6969

7070
/// Auth operations
71-
pub fn auth(self: Arc<Self>) -> Arc<ClientAuth> {
72-
Arc::new(ClientAuth(self))
71+
pub fn auth(self: Arc<Self>) -> Arc<AuthClient> {
72+
Arc::new(AuthClient(self))
7373
}
7474

7575
/// Test method, echoes back the input

crates/bitwarden-uniffi/src/platform/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ use crate::{error::Result, Client};
77
mod fido2;
88

99
#[derive(uniffi::Object)]
10-
pub struct ClientPlatform(pub(crate) Arc<Client>);
10+
pub struct PlatformClient(pub(crate) Arc<Client>);
1111

1212
#[uniffi::export]
13-
impl ClientPlatform {
13+
impl PlatformClient {
1414
/// Fingerprint (public key)
1515
pub fn fingerprint(&self, req: FingerprintRequest) -> Result<String> {
1616
Ok(self.0 .0.platform().fingerprint(&req)?.fingerprint)

0 commit comments

Comments
 (0)