diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e4200c616..2fe3c4d9f 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -37,7 +37,7 @@ jobs: - uses: actions-rs/cargo@v1 with: command: clippy - args: -- -D warnings + args: --features password-storage -- -D warnings black: runs-on: ubuntu-latest diff --git a/Cargo.lock b/Cargo.lock index 39c5da6b0..0a817c633 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,9 +59,9 @@ dependencies = [ [[package]] name = "ansi_term" -version = "0.11.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" dependencies = [ "winapi", ] @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "clap" -version = "2.33.3" +version = "2.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" dependencies = [ "ansi_term", "atty", @@ -378,9 +378,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.2.2" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3825b1e8580894917dc4468cb634a1b4e9745fddc854edad72d9c04644c0319f" +checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" dependencies = [ "cfg-if 1.0.0", ] @@ -878,17 +878,15 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" dependencies = [ - "futures-util", + "http", "hyper", - "log", "rustls", "tokio", "tokio-rustls", - "webpki", ] [[package]] @@ -971,9 +969,9 @@ dependencies = [ [[package]] name = "keyring" -version = "0.10.4" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a49a8b156a663b0b6898a845f056dd2502d8f0b3bde9686b59cfb4fdbc1d4777" +checksum = "4dadaf714ce3f9d7e1c8c05aa8d070eb6e9ddd40cd7be3aca2f21fa372405104" dependencies = [ "byteorder", "secret-service", @@ -1534,9 +1532,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.6" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66d2927ca2f685faf0fc620ac4834690d29e7abb153add10f5812eef20b5e280" +checksum = "07bea77bc708afa10e59905c3d4af7c8fd43c9214251673095ff8b14345fcbc5" dependencies = [ "base64", "bytes", @@ -1556,6 +1554,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rustls", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", @@ -1613,15 +1612,23 @@ checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] name = "rustls" -version = "0.19.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "d37e5e2290f3e040b594b1a9e04377c2c671f1a1cfd9bfdef82106ac1c113f84" dependencies = [ - "base64", "log", "ring", "sct", - "webpki", + "webpki 0.22.0", +] + +[[package]] +name = "rustls-pemfile" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eebeaeb360c87bfb72e84abdb3447159c0eaececf1bef2aecd65a8be949d1c9" +dependencies = [ + "base64", ] [[package]] @@ -1667,9 +1674,9 @@ dependencies = [ [[package]] name = "sct" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" dependencies = [ "ring", "untrusted", @@ -2023,13 +2030,13 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.22.0" +version = "0.23.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +checksum = "4baa378e417d780beff82bf54ceb0d195193ea6a00c14e22359e7f39456b5689" dependencies = [ "rustls", "tokio", - "webpki", + "webpki 0.22.0", ] [[package]] @@ -2314,13 +2321,23 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "webpki-roots" version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" dependencies = [ - "webpki", + "webpki 0.21.4", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 4d4120d95..aa629fb3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ cbindgen = { version = "0.20.0", default-features = false } flate2 = "1.0.18" goblin = "0.4.3" human-panic = { version = "1.0.3", optional = true } -keyring = { version = "0.10.4", optional = true } +keyring = { version = "1.0.0", optional = true } platform-info = "0.2.0" pretty_env_logger = { version = "0.4.0", optional = true } regex = "1.4.5" diff --git a/src/main.rs b/src/main.rs index 75aeff54c..02010a28f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,8 +12,6 @@ use configparser::ini::Ini; use fs_err as fs; #[cfg(feature = "human-panic")] use human_panic::setup_panic; -#[cfg(feature = "password-storage")] -use keyring::{Keyring, KeyringError}; use maturin::GenerateProjectOptions; use maturin::{ develop, init_project, new_project, source_distribution, write_dist_info, BridgeModel, @@ -46,7 +44,7 @@ fn get_password(_username: &str) -> String { #[cfg(feature = "keyring")] { let service = env!("CARGO_PKG_NAME"); - let keyring = Keyring::new(&service, &_username); + let keyring = keyring::Entry::new(service, _username); if let Ok(password) = keyring.get_password() { return password; }; @@ -458,13 +456,13 @@ fn upload_ui(items: &[PathBuf], publish: &PublishOpt) -> Result<()> { #[cfg(feature = "keyring")] { // Delete the wrong password from the keyring - let old_username = registry.username.clone(); - let keyring = Keyring::new(&env!("CARGO_PKG_NAME"), &old_username); + let old_username = registry.username; + let keyring = keyring::Entry::new(env!("CARGO_PKG_NAME"), &old_username); match keyring.delete_password() { Ok(()) => { println!("🔑 Removed wrong password from keyring") } - Err(KeyringError::NoPasswordFound) | Err(KeyringError::NoBackendFound) => {} + Err(keyring::Error::NoEntry) | Err(keyring::Error::NoStorageAccess(_)) => {} Err(err) => { eprintln!("⚠️ Warning: Failed to remove password from keyring: {}", err) } @@ -499,11 +497,10 @@ fn upload_ui(items: &[PathBuf], publish: &PublishOpt) -> Result<()> { { // We know the password is correct, so we can save it in the keyring let username = registry.username.clone(); - let keyring = Keyring::new(&env!("CARGO_PKG_NAME"), &username); - let password = registry.password.clone(); + let keyring = keyring::Entry::new(env!("CARGO_PKG_NAME"), &username); + let password = registry.password; match keyring.set_password(&password) { Ok(()) => {} - Err(KeyringError::NoBackendFound) => {} Err(err) => { eprintln!( "⚠️ Warning: Failed to store the password in the keyring: {:?}",