cli: add status command

Provides equivalent functionality to `yubico-piv-tool`
This commit is contained in:
Tony Arcieri
2019-12-09 17:51:05 -08:00
parent 283e6fe363
commit 78d5f33695
12 changed files with 189 additions and 34 deletions
+12 -1
View File
@@ -32,7 +32,8 @@
use crate::{error::Error, yubikey::YubiKey};
use getrandom::getrandom;
use std::fmt::{self, Debug};
use std::fmt::{self, Debug, Display};
use subtle_encoding::hex;
/// CCCID size
pub const CCCID_SIZE: usize = 14;
@@ -116,3 +117,13 @@ impl Debug for CCC {
write!(f, "CCC({:?})", &self.0[..])
}
}
impl Display for CCC {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(
f,
"{}",
String::from_utf8(hex::encode(&self.0[..])).unwrap()
)
}
}