bitwarden_wasm_internal/vault/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
pub mod ciphers;
pub mod folders;
pub mod totp;

use std::rc::Rc;

use bitwarden_core::Client;
use ciphers::ClientCiphers;
use totp::ClientTotp;
use wasm_bindgen::prelude::*;

use crate::ClientFolders;

#[wasm_bindgen]
pub struct VaultClient(Rc<Client>);

impl VaultClient {
    pub fn new(client: Rc<Client>) -> Self {
        Self(client)
    }
}

#[wasm_bindgen]
impl VaultClient {
    pub fn ciphers(&self) -> ClientCiphers {
        ClientCiphers::new(self.0.clone())
    }

    pub fn folders(&self) -> ClientFolders {
        ClientFolders::new(self.0.clone())
    }

    pub fn totp(&self) -> ClientTotp {
        ClientTotp::new(self.0.clone())
    }
}