bitwarden_uniffi/vault/
collections.rs

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

use bitwarden_vault::{Collection, CollectionView, VaultClientExt};

use crate::{Client, Result};

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

#[uniffi::export]
impl ClientCollections {
    /// Decrypt collection
    pub fn decrypt(&self, collection: Collection) -> Result<CollectionView> {
        Ok(self.0 .0.vault().collections().decrypt(collection)?)
    }

    /// Decrypt collection list
    pub fn decrypt_list(&self, collections: Vec<Collection>) -> Result<Vec<CollectionView>> {
        Ok(self.0 .0.vault().collections().decrypt_list(collections)?)
    }
}