bitwarden_uniffi/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
23
24
25
26
use std::sync::Arc;

use bitwarden_vault::{Folder, FolderView, VaultClientExt};

use crate::{Client, Result};

#[derive(uniffi::Object)]
pub struct ClientFolders(pub Arc<Client>);

#[uniffi::export]
impl ClientFolders {
    /// Encrypt folder
    pub fn encrypt(&self, folder: FolderView) -> Result<Folder> {
        Ok(self.0 .0.vault().folders().encrypt(folder)?)
    }

    /// Decrypt folder
    pub fn decrypt(&self, folder: Folder) -> Result<FolderView> {
        Ok(self.0 .0.vault().folders().decrypt(folder)?)
    }

    /// Decrypt folder list
    pub fn decrypt_list(&self, folders: Vec<Folder>) -> Result<Vec<FolderView>> {
        Ok(self.0 .0.vault().folders().decrypt_list(folders)?)
    }
}