[][src]Struct secret_keeper::keepers::env::EnvKeeper

pub struct EnvKeeper {}

EnvKeeper generates encryption key from a passphrase in environment variable.

The passphrase from the environment is combined wih a nonce plus salt through PBKDF2+HMAC+SHA256 to generate the key. (Implementation by RustCrypto)

Uri formats:

  • env: uses the default environment variable VAULT_PASSWORD
  • env:VARNAME - variable VARNAME contains the passphrase
  • env://VARNAME - alternate syntax

Implementations

impl EnvKeeper[src]

pub fn new() -> Self[src]

Trait Implementations

impl Debug for EnvKeeper[src]

impl SecretKeeper for EnvKeeper[src]

fn get_scheme(&self) -> &str[src]

returns the uri scheme

fn wrap<'life0, 'life1, 'life2, 'life3, 'async_trait>(
    &'life0 self,
    uri: &'life1 str,
    nonce: &'life2 [u8],
    key: &'life3 [u8]
) -> Pin<Box<dyn Future<Output = Result<WrappedKey, Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    'life3: 'async_trait,
    Self: 'async_trait, 
[src]

Encrypts key with a passphrase-generated key Passphrase is retrieved from enviornment variable (default VAULT_PASSWORD, or the name in the key uri "env:<VAR_NAME>"). Returned encrypted key is stringified with bech32. Applications using envelope encryption don't call this function directly, but instead use Cipher.export. Cipher.export invokes SecretKeeper.wrap to encrypt the key and generate the WrappedKey.

fn unwrap<'life0, 'life1, 'life2, 'async_trait>(
    &'life0 self,
    nonce: &'life1 [u8],
    wk: &'life2 WrappedKey
) -> Pin<Box<dyn Future<Output = Result<Bytes, Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    'life2: 'async_trait,
    Self: 'async_trait, 
[src]

Unwraps and decrypts key with a passphrase-generated key Passphrase is retrieved from enviornment variable (default VAULT_PASSWORD, or the name in the key uri "env:<VAR_NAME>").

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> Same<T> for T[src]

type Output = T

Should always be Self

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.