diff --git a/Cargo.lock b/Cargo.lock index d1d6ec3..01540ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -719,6 +719,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1250,6 +1267,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -1261,7 +1279,9 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls", "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", @@ -1269,6 +1289,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", + "tokio-rustls", "tokio-util", "tower-service", "url", @@ -1276,9 +1297,25 @@ dependencies = [ "wasm-bindgen-futures", "wasm-streams", "web-sys", + "webpki-roots", "winreg", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "rpassword" version = "7.3.1" @@ -1319,6 +1356,20 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rustls" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf4ef73721ac7bcd79b2b315da7779d8fc09718c6b3d2d1b2d94850eb8c18432" +dependencies = [ + "log", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + [[package]] name = "rustls-pemfile" version = "2.1.2" @@ -1335,6 +1386,17 @@ version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +[[package]] +name = "rustls-webpki" +version = "0.102.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "ryu" version = "1.0.18" @@ -1587,6 +1649,12 @@ dependencies = [ "zip-extract", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "strsim" version = "0.11.1" @@ -1756,6 +1824,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -1923,6 +2002,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.5.0" @@ -2076,6 +2161,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi-util" version = "0.1.8" @@ -2258,6 +2352,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +[[package]] +name = "zeroize" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + [[package]] name = "zip" version = "0.6.6" diff --git a/Cargo.toml b/Cargo.toml index e20be8e..ed1d130 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,7 @@ clap = {version = "4.5.4", features = ["derive"]} email-address-parser = "2.0.0" lazy_static = "1.4.0" regex = "1.10.4" -reqwest = {version = "0.12.3", features = ["blocking", "json", "multipart"]} +reqwest = {version = "0.12.3", features = ["blocking", "json", "multipart"], default-features = false} rpassword = "7.3.1" serde = "1.0.197" serde_derive = "1.0.197" @@ -46,3 +46,7 @@ path = "src/lib.rs" [[bin]] name = "soldeer" path = "src/main.rs" + +[features] +default = ["rustls"] +rustls = ["reqwest/rustls-tls"] diff --git a/src/auth.rs b/src/auth.rs index 0d9c785..2eb05fa 100644 --- a/src/auth.rs +++ b/src/auth.rs @@ -66,6 +66,7 @@ pub async fn login() -> Result<(), LoginError> { let req = Client::new().post(url).json(&login); let login_response = req.send().await; + let security_file = define_security_file_location(); if let Ok(response) = login_response { if response.status().is_success() { @@ -100,6 +101,7 @@ pub async fn login() -> Result<(), LoginError> { }); } } + Err(LoginError { cause: "Authentication failed. Unknown error.".to_string(), }) diff --git a/src/lib.rs b/src/lib.rs index a2d7304..65aaab7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -40,9 +40,6 @@ use std::path::PathBuf; use yansi::Paint; pub const BASE_URL: &str = "https://api.soldeer.xyz"; - -// pub static DEPENDENCY_DIR: PathBuf = Lazy::new(|| env::current_dir().unwrap()); - lazy_static! { pub static ref DEPENDENCY_DIR: PathBuf = get_current_working_dir().unwrap().join("dependencies/"); diff --git a/src/versioning.rs b/src/versioning.rs index 6750c03..6e41074 100644 --- a/src/versioning.rs +++ b/src/versioning.rs @@ -85,6 +85,8 @@ pub async fn push_version( return Err(error); } } + // deleting zip archive + let _ = remove_file(zip_archive); Ok(()) }