pub trait GetPasswordSafe {
    fn get_password_safe(
        &self,
        user_pin: &str
    ) -> Result<PasswordSafe<'_>, CommandError>; }
Expand description

Provides access to a PasswordSafe.

The device that implements this trait must always live at least as long as a password safe retrieved from it.

Required Methods

Enables and returns the password safe.

The underlying device must always live at least as long as a password safe retrieved from it. It is mandatory to lock the underlying device using lock after the password safe has been used. Otherwise, other applications can access the password store without authentication.

Errors
Example
use nitrokey::{Device, GetPasswordSafe, PasswordSafe};

fn use_password_safe(pws: &PasswordSafe) {}

let device = nitrokey::connect()?;
match device.get_password_safe("123456") {
    Ok(pws) => {
        use_password_safe(&pws);
        device.lock()?;
    },
    Err(err) => println!("Could not open the password safe: {}", err),
};

Implementors