Handle reference data not found in metadata command (#558)

This commit is contained in:
Nazar Serhiichuk
2025-08-14 16:37:57 +03:00
committed by GitHub
parent b4be1bb216
commit 1fc807fdcb
4 changed files with 60 additions and 9 deletions
+8 -9
View File
@@ -163,17 +163,16 @@ impl<'tx> Transaction<'tx> {
.p2(slot.into())
.transmit(self, CB_OBJ_MAX)?;
if !response.is_success() {
if response.status_words() == StatusWords::NotSupportedError {
return Err(Error::NotSupported); // Requires firmware 5.2.3
} else {
return Err(Error::GenericError);
match response.status_words() {
StatusWords::Success => {
let buf = Buffer::new(response.data().into());
piv::SlotMetadata::try_from(buf)
}
StatusWords::ReferenceDataNotFoundError => Err(Error::NotFound),
// Requires firmware 5.2.3
StatusWords::NotSupportedError => Err(Error::NotSupported),
_ => Err(Error::GenericError),
}
let buf = Buffer::new(response.data().into());
piv::SlotMetadata::try_from(buf)
}
/// Verify device PIN.