From bab33d84078a0ff2eb3d55ef39ea382b797abc92 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Wed, 29 Jan 2020 12:25:33 +0100 Subject: Update nitrokey dependency to 0.6.0 nitrokey 0.6.0 introduced the SerialNumber struct (instead of representing serial numbers as strings). We no longer have to manually format the serial number as SerialNumber implements Display. --- src/commands.rs | 6 +++--- src/pinentry.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/commands.rs b/src/commands.rs index e361509..08dad04 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -343,7 +343,7 @@ fn print_status( ctx, r#"Status: model: {model} - serial number: 0x{id} + serial number: {id} firmware version: {fwv} user retry count: {urc} admin retry count: {arc}"#, @@ -393,7 +393,7 @@ pub fn list(ctx: &mut args::ExecCtx<'_>, no_connect: bool) -> Result<()> { .map(|m| m.to_string()) .unwrap_or_else(|| "unknown".into()); let serial_number = match device_info.serial_number { - Some(serial_number) => format!("0x{}", serial_number), + Some(serial_number) => serial_number.to_string(), None => { // Storage devices do not have the serial number present in // the device information. We have to connect to them to @@ -402,7 +402,7 @@ pub fn list(ctx: &mut args::ExecCtx<'_>, no_connect: bool) -> Result<()> { "N/A".to_string() } else { let device = manager.connect_path(device_info.path.clone())?; - format!("0x{}", device.get_serial_number()?) + device.get_serial_number()?.to_string() } } }; diff --git a/src/pinentry.rs b/src/pinentry.rs index fd47657..af2b4dc 100644 --- a/src/pinentry.rs +++ b/src/pinentry.rs @@ -54,7 +54,7 @@ pub trait SecretEntry: fmt::Debug { pub struct PinEntry { pin_type: PinType, model: nitrokey::Model, - serial: String, + serial: nitrokey::SerialNumber, } impl PinEntry { @@ -127,7 +127,7 @@ impl SecretEntry for PinEntry { #[derive(Debug)] pub struct PwdEntry { model: nitrokey::Model, - serial: String, + serial: nitrokey::SerialNumber, } impl PwdEntry { -- cgit v1.2.3