EncryptedDataStore

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 create_from_str<P>(
        data: &str,
        path: 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: DeserializeOwned { ... }
    fn save_encrypted(
        &self,
        file: impl Write,
        key: &Key<Aes256Gcm>,
        salt: [u8; 16],
    ) -> Result<()> { ... }
    fn encrypt(
        &self,
        key: &Key<Aes256Gcm>,
        salt: [u8; 16],
    ) -> Result<EncryptedData> { ... }
    fn decrypt(encrypted: &EncryptedData, key: &Key<Aes256Gcm>) -> Result<Self>
       where Self: DeserializeOwned { ... }
}
Expand description

Implement on your Database type.

Provided Methods§

Source

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

Source

fn create_from_str<P>( data: &str, path: P, password: &str, ) -> Result<EncryptedAtomicDatabase<Self>>
where P: AsRef<Path>, Self: DeserializeOwned,

Source

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

Loads after decrypting EncryptedData read from file.

Source

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

Saves current state as encrypted EncryptedData to file.

Source

fn encrypt(&self, key: &Key<Aes256Gcm>, salt: [u8; 16]) -> Result<EncryptedData>

Encrypts the current data and returns the envelope.

Source

fn decrypt(encrypted: &EncryptedData, key: &Key<Aes256Gcm>) -> Result<Self>
where Self: DeserializeOwned,

Decrypts the envelope into data.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§