1
use crate::{
2
    Key,
3
    file::{self, UnlockedItem, api},
4
};
5

            
6
/// A locked variant of [`UnlockedItem`]
7
#[derive(Clone, Debug)]
8
pub struct LockedItem {
9
    pub(crate) inner: api::EncryptedItem,
10
}
11

            
12
impl LockedItem {
13
    /// Unlocks the item.
14
4
    pub fn unlock(self, key: &Key) -> Result<UnlockedItem, file::Error> {
15
4
        self.inner.decrypt(key)
16
    }
17
}