Struct seckey::SecKey [] [src]

pub struct SecKey<T: Sized>(_);

Secure Key.

The use memsec/malloc protection secret bytes. When you need the password stored in the memory, you should use it.

More docs see Secure memory · libsodium.

Methods

impl<T> SecKey<T> where T: Sized
[src]

Map read. returns closure return value.

use seckey::SecKey;

let mut pass: [u8; 8] = [8; 8];
let secpass = SecKey::new(&pass).unwrap();
assert!(secpass.read_map(|b| b == &pass));

Map write. returns closure return value.

secpass.write_map(|bs| bs[0] = 0);
let bs = secpass.read_map(|bs| {
    let mut pass = [0; 8];
    pass.clone_from_slice(bs);
    pass
});
assert_eq!(bs, [0, 8, 8, 8, 8, 8, 8, 8]);

Trait Implementations

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

Performs the conversion.

impl<T> Debug for SecKey<T>
[src]

Formats the value using the given formatter.

impl<T> Drop for SecKey<T>
[src]

A method called when the value goes out of scope. Read more