From 314e19c1afe2cc0fd61588888df358ad56003f36 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Fri, 23 Feb 2024 14:30:06 +0100 Subject: [PATCH] Upgrade sequoia-cert-store and sequoia-wot. - Upgrade `sequoia-cert-store` and `sequoia-wot` and adapt to their API changes. --- Cargo.lock | 13 +++++++------ Cargo.toml | 4 ++-- src/commands/cert/import.rs | 7 ++++--- src/commands/network.rs | 8 ++++---- src/commands/pki/link.rs | 2 +- src/sq.rs | 2 +- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2bba13cf..c93b8f24 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2024,6 +2024,7 @@ version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf4e226dcd58b4be396f7bd3c20da8fdee2911400705297ba7d2d7cc2c30f716" dependencies = [ + "cc", "pkg-config", "vcpkg", ] @@ -3128,9 +3129,9 @@ dependencies = [ [[package]] name = "sequoia-cert-store" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d58235b88e5518ca84a74462e07c4391cb9b3067dccfb9b4ed8a8fdad77299" +checksum = "e65486e541400d9d08559bfa6a57d9bb33e4678a378b9240cd7c370e2d9b4ae6" dependencies = [ "anyhow", "crossbeam", @@ -3251,9 +3252,9 @@ dependencies = [ [[package]] name = "sequoia-openpgp" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26e9c71323d9848404e343a6b5c3a73de10bc496ca3481b66586ba9064de027e" +checksum = "ebf154ce4af3d7983de8fded403f98ff9eb3ee38dffccea0472ac38aa4276df4" dependencies = [ "aes", "aes-gcm", @@ -3369,9 +3370,9 @@ dependencies = [ [[package]] name = "sequoia-wot" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383672b024f126625127ec2b709b1e2f8d4814ab1bf4f800abb1a9fdc8dedcd3" +checksum = "7f383e37d18e0b9ae9e39ead83c581d5fc4f73e20bc1f4f7b76185d7136698b5" dependencies = [ "anyhow", "chrono", diff --git a/Cargo.toml b/Cargo.toml index d675138f..09058911 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -43,9 +43,9 @@ humantime = "2" indicatif = "0.17" itertools = ">=0.10, <0.13" once_cell = "1.17" -sequoia-cert-store = "0.4.2" +sequoia-cert-store = "0.5.0" sequoia-keystore = { version = "0.2" } -sequoia-wot = "0.9" +sequoia-wot = "0.10" tempfile = "3.1" tokio = { version = "1.13.1" } rpassword = "7.0" diff --git a/src/commands/cert/import.rs b/src/commands/cert/import.rs index ddff06e0..896b0a19 100644 --- a/src/commands/cert/import.rs +++ b/src/commands/cert/import.rs @@ -46,7 +46,7 @@ pub fn dispatch<'store>(mut config: Config<'store>, cmd: import::Command) Ok(raw_cert) => LazyCert::from(raw_cert), Err(err) => { wprintln!("Error parsing input: {}", err); - stats.errors += 1; + stats.inc_errors(); continue; } }; @@ -57,7 +57,7 @@ pub fn dispatch<'store>(mut config: Config<'store>, cmd: import::Command) if let Err(err) = cert_store.update_by(Arc::new(cert), &mut stats) { wprintln!("Error importing {}, {:?}: {}", fingerprint, userid, err); - stats.errors += 1; + stats.inc_errors(); continue; } else { wprintln!("Imported {}, {}", fingerprint, Safe(&userid)); @@ -72,7 +72,8 @@ pub fn dispatch<'store>(mut config: Config<'store>, cmd: import::Command) wprintln!("Imported {} new certificates, updated {} certificates, \ {} certificates unchanged, {} errors.", - stats.new, stats.updated, stats.unchanged, stats.errors); + stats.new_certs(), stats.updated_certs(), + stats.unchanged_certs(), stats.errors()); Ok(result?) } diff --git a/src/commands/network.rs b/src/commands/network.rs index ba500bb9..31a17df9 100644 --- a/src/commands/network.rs +++ b/src/commands/network.rs @@ -129,10 +129,10 @@ pub fn import_certs(config: &mut Config, certs: Vec) -> Result<()> { } wprintln!("\nImported {}, updated {}, {} unchanged, {}.", - stats.new.of("new certificate"), - stats.updated.of("certificate"), - stats.unchanged.of("certificate"), - stats.errors.of("error")); + stats.new_certs().of("new certificate"), + stats.updated_certs().of("certificate"), + stats.unchanged_certs().of("certificate"), + stats.errors().of("error")); wprintln!("\nAfter checking that a certificate really belongs to the \ stated owner, you can mark the certificate as authenticated \ diff --git a/src/commands/pki/link.rs b/src/commands/pki/link.rs index 9cd89322..2c873580 100644 --- a/src/commands/pki/link.rs +++ b/src/commands/pki/link.rs @@ -767,7 +767,7 @@ pub fn retract(mut config: Config, c: link::RetractCommand) pub fn list(config: Config, c: link::ListCommand) -> Result<()> { - let mut cert_store = config.cert_store_or_else()?; + let cert_store = config.cert_store_or_else()?; cert_store.prefetch_all(); let trust_root = config.local_trust_root()?; diff --git a/src/sq.rs b/src/sq.rs index 55c638e9..82339857 100644 --- a/src/sq.rs +++ b/src/sq.rs @@ -431,7 +431,7 @@ impl<'store> Config<'store> { cert_store::CertStore::empty() }; - let mut keyring = cert_store::store::Certs::empty(); + let keyring = cert_store::store::Certs::empty(); let mut error = None; for filename in self.keyrings.iter() { let f = std::fs::File::open(filename)