Trait AppSecurity

Source
pub trait AppSecurity {
    // Required methods
    fn change_pin(
        &self,
        pin_type: u8,
        old_pin: &str,
        new_pin: &str,
    ) -> Result<()>;
    fn verify_pin(&self, pin_type: u8, pin: &str) -> Result<()>;
    fn pin_info(&self, pin_type: u8) -> Result<PinInfo>;
    fn unblock_pin(&self, admin_pin: &str, new_pin: &str) -> Result<()>;
    fn clear_secure_state(&self) -> Result<()>;
}

Required Methods§

Source

fn change_pin(&self, pin_type: u8, old_pin: &str, new_pin: &str) -> Result<()>

Lock device for exclusive access

[pin_type] - The pin type, can be PIN_TYPE_ADMIN or PIN_TYPE_USER

[old_pin] - The old pin

[new_pin] - The new pin

§specification note
  • PIN verification failed: The value of remaining retry count will be returned, 0 means the PIN has been locked
  • PIN verification success: None will be returned
§Error
  • Error::PinVerifyFailed returned when PIN verification failed
Source

fn verify_pin(&self, pin_type: u8, pin: &str) -> Result<()>

Verify PIN to get access rights

[pin_type] - The pin type,can be PIN_TYPE_ADMIN or PIN_TYPE_USER

[pin] - The pin value

§specification note
  • PIN verification failed: The value of remaining retry count will be returned, 0 means the PIN has been locked
  • PIN verification success: None will be returned
§Error
  • Error::PinVerifyFailed returned when PIN verification failed
Source

fn pin_info(&self, pin_type: u8) -> Result<PinInfo>

Get PIN info

[pin_type] - The pin type,can be PIN_TYPE_ADMIN or PIN_TYPE_USER

Source

fn unblock_pin(&self, admin_pin: &str, new_pin: &str) -> Result<()>

Unlock user PIN

[admin_pin] - The admin PIN

[new_pin] - The new PIN

[recv_capacity] - The capacity of receive buffer

§specification note
  • PIN verification failed: The value of remaining retry count will be returned, 0 means the PIN has been locked
  • PIN verification success: None will be returned
§Error
  • Error::PinVerifyFailed returned when PIN verification failed
Source

fn clear_secure_state(&self) -> Result<()>

Clear secure state

Implementors§