From 09c07a5926d6ab073eac6e07b86cda892a9760aa Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 24 Feb 2022 11:10:15 +0100 Subject: [PATCH] Update nitrokey-rs to 16f6c38 (branch backend) --- Cargo.lock | 3 +-- Cargo.toml | 3 ++- src/commands.rs | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 67e7c765..565ed15a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -210,8 +210,7 @@ dependencies = [ [[package]] name = "nitrokey" version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddeb2d19d5499ab4740c0131562e8c4b2c13f8954677be4318c1efc944911531" +source = "git+https://git.sr.ht/~ireas/nitrokey-rs?branch=backend#16f6c38eff783382cf1f1679271254aa85e7ce1d" dependencies = [ "lazy_static", "libc", diff --git a/Cargo.toml b/Cargo.toml index 19e77bc9..1b9a149f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,8 @@ version = "0.2" version = "0.1" [dependencies.nitrokey] -version = "0.9.0" +git = "https://git.sr.ht/~ireas/nitrokey-rs" +branch = "backend" [dependencies.progressing] version = "3.0.2" diff --git a/src/commands.rs b/src/commands.rs index ad61c65d..737d32ba 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -112,7 +112,7 @@ fn find_device(config: &config::Config) -> anyhow::Result /// Connect to a Nitrokey device that matches the given requirements fn connect<'mgr>( - manager: &'mgr mut nitrokey::Manager, + manager: &'mgr nitrokey::Manager, config: &config::Config, ) -> anyhow::Result> { let device_info = find_device(config)?; @@ -131,12 +131,12 @@ fn with_device(ctx: &mut Context<'_>, op: F) -> anyhow::Result<()> where F: FnOnce(&mut Context<'_>, nitrokey::DeviceWrapper<'_>) -> anyhow::Result<()>, { - let mut manager = + let manager = nitrokey::take().context("Failed to acquire access to Nitrokey device manager")?; set_log_level(ctx); - let device = connect(&mut manager, &ctx.config)?; + let device = connect(&manager, &ctx.config)?; op(ctx, device) } @@ -145,7 +145,7 @@ fn with_storage_device(ctx: &mut Context<'_>, op: F) -> anyhow::Result<()> where F: FnOnce(&mut Context<'_>, nitrokey::Storage<'_>) -> anyhow::Result<()>, { - let mut manager = + let manager = nitrokey::take().context("Failed to acquire access to Nitrokey device manager")?; set_log_level(ctx); @@ -158,7 +158,7 @@ where ctx.config.model = Some(args::DeviceModel::Storage); } - let device = connect(&mut manager, &ctx.config)?; + let device = connect(&manager, &ctx.config)?; if let nitrokey::DeviceWrapper::Storage(storage) = device { op(ctx, storage) } else { @@ -518,7 +518,7 @@ pub fn list(ctx: &mut Context<'_>, no_connect: bool) -> anyhow::Result<()> { println!(ctx, "No Nitrokey device connected")?; } else { println!(ctx, "USB path\tmodel\tserial number")?; - let mut manager = + let manager = nitrokey::take().context("Failed to acquire access to Nitrokey device manager")?; for device_info in device_infos {