bitwarden_wasm_internal/vault/
folders.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use std::rc::Rc;

use bitwarden_core::Client;
use bitwarden_vault::{Folder, FolderView, VaultClientExt};
use wasm_bindgen::prelude::*;

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

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

#[wasm_bindgen]
impl ClientFolders {
    /// Decrypt folder
    pub fn decrypt(&self, folder: Folder) -> Result<FolderView, bitwarden_core::Error> {
        self.0.vault().folders().decrypt(folder)
    }
}