bitwarden_auth/
auth_client.rs1use bitwarden_core::Client;
2#[cfg(feature = "wasm")]
3use wasm_bindgen::prelude::*;
4
5use crate::send_access::SendAccessClient;
6
7#[derive(Clone)]
9#[cfg_attr(feature = "wasm", wasm_bindgen)]
10pub struct AuthClient {
11 pub(crate) client: Client,
15}
16
17impl AuthClient {
18 pub fn new(client: Client) -> Self {
20 Self { client }
21 }
22}
23
24#[cfg_attr(feature = "wasm", wasm_bindgen)]
25impl AuthClient {
26 pub fn send_access(&self) -> SendAccessClient {
28 SendAccessClient::new(self.client.clone())
29 }
30}
31
32pub trait AuthClientExt {
34 fn auth_new(&self) -> AuthClient;
36}
37
38impl AuthClientExt for Client {
39 fn auth_new(&self) -> AuthClient {
40 AuthClient {
41 client: self.clone(),
42 }
43 }
44}