Trait self_encryption::Storage
[−]
[src]
pub trait Storage<E: StorageError> { fn get(&self, name: &[u8]) -> Result<Vec<u8>, E>; fn put(&mut self, name: Vec<u8>, data: Vec<u8>) -> Result<(), E>; }
Trait which must be implemented by storage objects to be used in self-encryption. Data is
passed to the storage object encrypted with name
being the SHA512 hash of data
. Storage
could be implemented as an in-memory HashMap
or a disk-based container for example.
Required Methods
fn get(&self, name: &[u8]) -> Result<Vec<u8>, E>
Retrieve data previously put
under name
. If the data does not exist, an error should be
returned.
fn put(&mut self, name: Vec<u8>, data: Vec<u8>) -> Result<(), E>
Store data
under name
.