bitwarden_auth/identity/
client.rs

1use bitwarden_core::Client;
2#[cfg(feature = "wasm")]
3use wasm_bindgen::prelude::*;
4
5/// The IdentityClient is used to obtain identity / access tokens from the Bitwarden Identity API.
6#[derive(Clone)]
7#[cfg_attr(feature = "wasm", wasm_bindgen)]
8pub struct IdentityClient {
9    #[allow(dead_code)] // TODO: Remove when methods using client are implemented
10    pub(crate) client: Client,
11}
12
13impl IdentityClient {
14    /// Create a new IdentityClient with the given Client.
15    pub(crate) fn new(client: Client) -> Self {
16        Self { client }
17    }
18}
19
20#[cfg_attr(feature = "wasm", wasm_bindgen)]
21impl IdentityClient {
22    // TODO: Add methods to interact with the Identity API.
23}
24
25#[cfg(test)]
26mod tests {
27    use super::*;
28
29    #[test]
30    fn test_identity_client_creation() {
31        let client: Client = Client::new(None);
32        let identity_client = IdentityClient::new(client);
33
34        // Verify the identity client was created successfully
35        // The client field is present and accessible
36        let _ = identity_client.client;
37    }
38}