Struct jarida::CredentialGuard[][src]

pub struct CredentialGuard { /* fields omitted */ }

A type used to verify the username and password used to secure the database.

Implementations

impl CredentialGuard[src]

pub fn new(salt: DbSalt, username: &str, password: &str) -> CredentialGuard[src]

Generate a new CredentialGuard from the database’s unique salt and the user’s name and password.

pub fn update_credentials(&mut self, username: &str, password: &str)[src]

Update the user’s name and password

pub fn try_decrypt_key(self, encrypted_key: Vec<u8>) -> Result<DataGuard, Self>[src]

Try to decrypt the key using the current user’s name and password. If successful, this CredentialGuard is consumed and a DataGuard is returned, which can be used to encrypt/decrypt data. Upon failure, this guard is returned and the guard’s credentials should be updated before calling this function again.

pub fn generate_encrypted_key(&self) -> Result<Vec<u8>, UnspecifiedError>[src]

Generate a randome symmetric encryption key for securing data. The key is encrypted using the user’s name and password and, as such, can be public.

Trait Implementations

impl Debug for CredentialGuard[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,