light_magic::encrypted

Trait EncryptedDataStore

source
pub trait EncryptedDataStore: Default + Serialize {
    // Provided methods
    fn open<P>(db: P, password: &str) -> Result<EncryptedAtomicDatabase<Self>>
       where P: AsRef<Path>,
             Self: DeserializeOwned { ... }
    fn load_encrypted(file: impl Read, key: &Key<Aes256Gcm>) -> Result<Self>
       where Self: Sized + DeserializeOwned { ... }
    fn save_encrypted(
        &self,
        file: impl Write,
        key: &Key<Aes256Gcm>,
        salt: &[u8],
    ) -> Result<()>
       where Self: Serialize { ... }
}
Expand description

This trait needs to be implemented for the Database struct. It requires a few implementations. The defined functions have default implementations.

Provided Methods§

source

fn open<P>(db: P, password: &str) -> Result<EncryptedAtomicDatabase<Self>>
where P: AsRef<Path>, Self: DeserializeOwned,

Opens a Database by the specified path and password. If the Database doesn’t exist, this will create a new one! Wrap a Arc<_> around it to use it in parallel contexts!

source

fn load_encrypted(file: impl Read, key: &Key<Aes256Gcm>) -> Result<Self>
where Self: Sized + DeserializeOwned,

Loads file data into the Database after decrypting it.

source

fn save_encrypted( &self, file: impl Write, key: &Key<Aes256Gcm>, salt: &[u8], ) -> Result<()>
where Self: Serialize,

Saves data of the Database to a file after encrypting it.

Object Safety§

This trait is not object safe.

Implementors§