Make PIN verification failure a StatusWord case
Retry count is now u8, as it cannot exceed 16 (being returned in the lower half of SW2).
This commit is contained in:
+2
-2
@@ -184,7 +184,7 @@ impl<'tx> Transaction<'tx> {
|
||||
match response.status_words() {
|
||||
StatusWords::Success => Ok(()),
|
||||
StatusWords::AuthBlockedError => Err(Error::WrongPin { tries: 0 }),
|
||||
StatusWords::Other(sw) if sw >> 8 == 0x63 => Err(Error::WrongPin { tries: sw & 0xf }),
|
||||
StatusWords::VerifyFailError { tries } => Err(Error::WrongPin { tries }),
|
||||
_ => Err(Error::GenericError),
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ impl<'tx> Transaction<'tx> {
|
||||
match status_words {
|
||||
StatusWords::Success => Ok(()),
|
||||
StatusWords::AuthBlockedError => Err(Error::PinLocked),
|
||||
StatusWords::Other(sw) if sw >> 8 == 0x63 => Err(Error::WrongPin { tries: sw & 0xf }),
|
||||
StatusWords::VerifyFailError { tries } => Err(Error::WrongPin { tries }),
|
||||
_ => {
|
||||
error!(
|
||||
"failed changing pin, token response code: {:x}.",
|
||||
|
||||
Reference in New Issue
Block a user