Struct nitrokey::Pro [−][src]
A Nitrokey Pro device without user or admin authentication.
Use the connect
method to obtain an instance wrapper or the connect_pro
method to
directly obtain an instance. If you want to execute a command that requires user or admin
authentication, use authenticate_admin
or authenticate_user
.
Examples
Authentication with error handling:
use nitrokey::{Authenticate, User, Pro}; fn perform_user_task<'a>(device: &User<'a, Pro<'a>>) {} fn perform_other_task(device: &Pro) {} let mut manager = nitrokey::take()?; let device = manager.connect_pro()?; let device = match device.authenticate_user("123456") { Ok(user) => { perform_user_task(&user); user.device() }, Err((device, err)) => { eprintln!("Could not authenticate as user: {}", err); device }, }; perform_other_task(&device);
Trait Implementations
impl<'a> Authenticate<'a> for Pro<'a>
[src]
fn authenticate_user(
self,
password: &str
) -> Result<User<'a, Self>, (Self, Error)>
[src]
self,
password: &str
) -> Result<User<'a, Self>, (Self, Error)>
fn authenticate_admin(
self,
password: &str
) -> Result<Admin<'a, Self>, (Self, Error)>
[src]
self,
password: &str
) -> Result<Admin<'a, Self>, (Self, Error)>
impl<'a> Debug for Pro<'a>
[src]
impl<'a> Device<'a> for Pro<'a>
[src]
fn into_manager(self) -> &'a mut Manager
[src]
fn get_model(&self) -> Model
[src]
fn get_status(&self) -> Result<Status, Error>
[src]
fn get_serial_number(&self) -> Result<SerialNumber, Error>
[src]
fn get_user_retry_count(&self) -> Result<u8, Error>
[src]
fn get_admin_retry_count(&self) -> Result<u8, Error>
[src]
fn get_firmware_version(&self) -> Result<FirmwareVersion, Error>
[src]
fn get_config(&self) -> Result<Config, Error>
[src]
fn change_admin_pin(&mut self, current: &str, new: &str) -> Result<(), Error>
[src]
fn change_user_pin(&mut self, current: &str, new: &str) -> Result<(), Error>
[src]
fn unlock_user_pin(
&mut self,
admin_pin: &str,
user_pin: &str
) -> Result<(), Error>
[src]
&mut self,
admin_pin: &str,
user_pin: &str
) -> Result<(), Error>
fn lock(&mut self) -> Result<(), Error>
[src]
fn factory_reset(&mut self, admin_pin: &str) -> Result<(), Error>
[src]
fn build_aes_key(&mut self, admin_pin: &str) -> Result<(), Error>
[src]
impl<'a> Drop for Pro<'a>
[src]
impl<'a> From<Pro<'a>> for DeviceWrapper<'a>
[src]
impl<'a> GenerateOtp for Pro<'a>
[src]
fn set_time(&mut self, time: u64, force: bool) -> Result<(), Error>
[src]
fn get_hotp_slot_name(&self, slot: u8) -> Result<String, Error>
[src]
fn get_totp_slot_name(&self, slot: u8) -> Result<String, Error>
[src]
fn get_hotp_code(&mut self, slot: u8) -> Result<String, Error>
[src]
fn get_totp_code(&self, slot: u8) -> Result<String, Error>
[src]
impl<'a> GetPasswordSafe<'a> for Pro<'a>
[src]
fn get_password_safe(
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
[src]
&mut self,
user_pin: &str
) -> Result<PasswordSafe<'_, 'a>, Error>
Auto Trait Implementations
impl<'a> RefUnwindSafe for Pro<'a>
impl<'a> Send for Pro<'a>
impl<'a> Sync for Pro<'a>
impl<'a> Unpin for Pro<'a>
impl<'a> !UnwindSafe for Pro<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,