Skip to main content

ResponseStatus

Enum ResponseStatus 

Source
#[repr(u8)]
pub enum ResponseStatus {
Show 17 variants Ok = 0, InvalidCommand = 1, InvalidPayload = 2, InvalidSlot = 3, AteccCommunicationError = 4, AteccChipError = 5, TouchTimeout = 6, NotProvisioned = 7, LockMagicMismatch = 8, LockCrcMismatch = 9, Busy = 10, WrongPin = 11, PinRequired = 12, PinBlocked = 13, WrongPuk = 14, Bricked = 15, EmergencyResetNotPermitted = 16,
}
Expand description

First byte of every HID response.

Variants§

§

Ok = 0

0x00 - Operation succeeded. Payload depends on the originating command (e.g. 64-byte pubkey for GetPubkey, 64-byte signature for Sign, empty for VerifyPin).

§

InvalidCommand = 1

0x01 - Command opcode unknown.

§

InvalidPayload = 2

0x02 - Payload size or shape is invalid.

§

InvalidSlot = 3

0x03 - Slot index out of range.

§

AteccCommunicationError = 4

0x04 - I2C / wake / framing error talking to the ATECC. payload[0] is a one-byte sub-code identifying the precise failure category (HAL nack, wake-failed, CRC mismatch, timeout, malformed response, buffer-too-small, self-test failure). The canonical encoding matches atecc608b::AteccErrorKind::as_sub_code.

§

AteccChipError = 5

0x05 - Chip returned an error status. The chip’s raw status byte is in payload[0]. Decode via atecc608b::ChipError::from_status_byte to get the symbolic variant (ParseError, ExecutionError, etc.).

§

TouchTimeout = 6

0x06 - The user did not press the button within the 30 s window.

§

NotProvisioned = 7

0x07 - Token has not been provisioned yet.

§

LockMagicMismatch = 8

0x08 - Magic word for a Lock* command did not match.

§

LockCrcMismatch = 9

0x09 - CRC of the expected config does not match what’s on chip.

§

Busy = 10

0x0A - Another operation is in progress.

§

WrongPin = 11

0x0B - PIN was wrong. Tries remaining in payload[0].

§

PinRequired = 12

0x0C - A PIN session is required before signing.

§

PinBlocked = 13

0x0D - PIN slot is blocked. Only PUK unblock can recover.

§

WrongPuk = 14

0x0E - PUK was wrong. Tries remaining in payload[0].

§

Bricked = 15

0x0F - PUK retries exhausted. Chip is bricked.

§

EmergencyResetNotPermitted = 16

0x10 - EmergencyReset was requested but the user still has PIN or PUK attempts remaining. Payload is 2 bytes: [pin_tries_remaining, puk_tries_remaining].

Implementations§

Source§

impl ResponseStatus

Source

pub const fn from_byte(byte: u8) -> Option<Self>

Map a raw byte to a ResponseStatus, if recognized.

Source

pub const fn as_u8(self) -> u8

The raw status byte that goes on the wire.

Trait Implementations§

Source§

impl Clone for ResponseStatus

Source§

fn clone(&self) -> ResponseStatus

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ResponseStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for ResponseStatus

Source§

fn eq(&self, other: &ResponseStatus) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl TryFrom<u8> for ResponseStatus

Source§

type Error = UnknownStatus

The type returned in the event of a conversion error.
Source§

fn try_from(byte: u8) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl Copy for ResponseStatus

Source§

impl Eq for ResponseStatus

Source§

impl StructuralPartialEq for ResponseStatus

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.