bitwarden_wasm_internal/platform/
mod.rs1use bitwarden_core::Client;
2use bitwarden_vault::Cipher;
3use wasm_bindgen::prelude::wasm_bindgen;
4
5mod repository;
6
7#[wasm_bindgen]
8pub struct PlatformClient(Client);
9
10impl PlatformClient {
11 pub fn new(client: Client) -> Self {
12 Self(client)
13 }
14}
15
16#[wasm_bindgen]
17impl PlatformClient {
18 pub fn state(&self) -> StateClient {
19 StateClient::new(self.0.clone())
20 }
21}
22
23#[wasm_bindgen]
24pub struct StateClient(Client);
25
26impl StateClient {
27 pub fn new(client: Client) -> Self {
28 Self(client)
29 }
30}
31
32repository::create_wasm_repository!(CipherRepository, Cipher, "Repository<Cipher>");
33
34#[wasm_bindgen]
35impl StateClient {
36 pub fn register_cipher_repository(&self, store: CipherRepository) {
37 let store = store.into_channel_impl();
38 self.0.platform().state().register_client_managed(store)
39 }
40}