Просмотр исходного кода

feat: `openssl` based `hoppscotch-relay` for request forwarding (#4442)

Shreyas 4 месяцев назад
Родитель
Сommit
f52219bb95

+ 171 - 150
packages/hoppscotch-agent/src-tauri/Cargo.lock

@@ -142,9 +142,9 @@ dependencies = [
 
 [[package]]
 name = "anyhow"
-version = "1.0.89"
+version = "1.0.91"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6"
+checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8"
 
 [[package]]
 name = "arbitrary"
@@ -267,7 +267,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -302,7 +302,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -516,9 +516,9 @@ dependencies = [
 
 [[package]]
 name = "brotli"
-version = "6.0.0"
+version = "7.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b"
+checksum = "cc97b8f16f944bba54f0433f07e30be199b6dc2bd25937444bbad560bcea29bd"
 dependencies = [
  "alloc-no-stdlib",
  "alloc-stdlib",
@@ -543,9 +543,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
 
 [[package]]
 name = "bytemuck"
-version = "1.18.0"
+version = "1.19.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae"
+checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d"
 
 [[package]]
 name = "byteorder"
@@ -561,9 +561,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
 
 [[package]]
 name = "bytes"
-version = "1.7.2"
+version = "1.8.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3"
+checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da"
 dependencies = [
  "serde",
 ]
@@ -637,9 +637,9 @@ dependencies = [
 
 [[package]]
 name = "cc"
-version = "1.1.28"
+version = "1.1.31"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e80e3b6a3ab07840e1cae9b0666a63970dc28e8ed5ffbcdacbfc760c281bfc1"
+checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f"
 dependencies = [
  "shlex",
 ]
@@ -887,7 +887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
 dependencies = [
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -897,7 +897,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f"
 dependencies = [
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -912,30 +912,25 @@ dependencies = [
 [[package]]
 name = "curl"
 version = "0.4.47"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9fb4d13a1be2b58f14d60adba57c9834b78c62fd86c3e76a148f732686e9265"
+source = "git+https://github.com/CuriousCorrelation/curl-rust.git#1ec8079cf527b9cf47cc7a48c68b458affdae273"
 dependencies = [
  "curl-sys",
  "libc",
  "openssl-probe",
  "openssl-sys",
- "schannel",
  "socket2",
- "windows-sys 0.52.0",
 ]
 
 [[package]]
 name = "curl-sys"
 version = "0.4.77+curl-8.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f469e8a5991f277a208224f6c7ad72ecb5f986e36d09ae1f2c1bb9259478a480"
+source = "git+https://github.com/CuriousCorrelation/curl-rust.git#1ec8079cf527b9cf47cc7a48c68b458affdae273"
 dependencies = [
  "cc",
  "libc",
  "libz-sys",
  "openssl-sys",
  "pkg-config",
- "vcpkg",
  "windows-sys 0.52.0",
 ]
 
@@ -962,7 +957,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -986,7 +981,7 @@ dependencies = [
  "proc-macro2",
  "quote",
  "strsim",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -997,7 +992,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
 dependencies = [
  "darling_core",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1044,7 +1039,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1057,7 +1052,7 @@ dependencies = [
  "proc-macro2",
  "quote",
  "rustc_version",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1125,7 +1120,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1157,7 +1152,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1255,7 +1250,7 @@ checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1423,7 +1418,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1510,7 +1505,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1764,7 +1759,7 @@ dependencies = [
  "proc-macro-error",
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1843,7 +1838,7 @@ dependencies = [
  "proc-macro-error",
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -1946,15 +1941,12 @@ dependencies = [
  "axum-extra",
  "base16",
  "chrono",
- "curl",
  "dashmap",
  "env_logger",
- "http",
+ "hoppscotch-relay",
  "lazy_static",
  "log",
  "mockito",
- "openssl",
- "openssl-sys",
  "rand 0.8.5",
  "serde",
  "serde_json",
@@ -1969,11 +1961,27 @@ dependencies = [
  "tokio",
  "tokio-util",
  "tower-http",
- "url-escape",
  "uuid",
  "x25519-dalek",
 ]
 
+[[package]]
+name = "hoppscotch-relay"
+version = "0.1.1"
+dependencies = [
+ "curl",
+ "env_logger",
+ "http",
+ "log",
+ "openssl",
+ "openssl-sys",
+ "serde",
+ "serde_json",
+ "thiserror",
+ "tokio-util",
+ "url-escape",
+]
+
 [[package]]
 name = "html5ever"
 version = "0.26.0"
@@ -2042,9 +2050,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
 
 [[package]]
 name = "hyper"
-version = "1.4.1"
+version = "1.5.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05"
+checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a"
 dependencies = [
  "bytes",
  "futures-channel",
@@ -2149,9 +2157,9 @@ dependencies = [
 
 [[package]]
 name = "image"
-version = "0.25.2"
+version = "0.25.4"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "99314c8a2152b8ddb211f924cdae532d8c5e4c8bb54728e12fff1b0cd5963a10"
+checksum = "bc144d44a31d753b02ce64093d532f55ff8dc4ebf2ffb8a63c0dda691385acae"
 dependencies = [
  "bytemuck",
  "byteorder-lite",
@@ -2298,9 +2306,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130"
 
 [[package]]
 name = "js-sys"
-version = "0.3.70"
+version = "0.3.72"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"
+checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9"
 dependencies = [
  "wasm-bindgen",
 ]
@@ -2311,7 +2319,19 @@ version = "2.0.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "5b1fb8864823fad91877e6caea0baca82e49e8db50f8e5c9f9a453e27d3330fc"
 dependencies = [
- "jsonptr",
+ "jsonptr 0.4.7",
+ "serde",
+ "serde_json",
+ "thiserror",
+]
+
+[[package]]
+name = "json-patch"
+version = "3.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "863726d7afb6bc2590eeff7135d923545e5e964f004c2ccf8716c25e70a86f08"
+dependencies = [
+ "jsonptr 0.6.3",
  "serde",
  "serde_json",
  "thiserror",
@@ -2328,6 +2348,16 @@ dependencies = [
  "serde_json",
 ]
 
+[[package]]
+name = "jsonptr"
+version = "0.6.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5dea2b27dd239b2556ed7a25ba842fe47fd602e7fc7433c2a8d6106d4d9edd70"
+dependencies = [
+ "serde",
+ "serde_json",
+]
+
 [[package]]
 name = "keyboard-types"
 version = "0.7.0"
@@ -2384,9 +2414,9 @@ dependencies = [
 
 [[package]]
 name = "libc"
-version = "0.2.159"
+version = "0.2.161"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5"
+checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
 
 [[package]]
 name = "libloading"
@@ -2674,7 +2704,7 @@ dependencies = [
  "proc-macro-crate 2.0.2",
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -2960,7 +2990,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -2971,9 +3001,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
 
 [[package]]
 name = "openssl-src"
-version = "300.3.2+3.3.2"
+version = "300.4.0+3.4.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a211a18d945ef7e648cc6e0058f4c548ee46aab922ea203e0d30e966ea23647b"
+checksum = "a709e02f2b4aca747929cca5ed248880847c650233cf8b8cdc48f40aaf4898a6"
 dependencies = [
  "cc",
 ]
@@ -3073,9 +3103,9 @@ dependencies = [
 
 [[package]]
 name = "pathdiff"
-version = "0.2.1"
+version = "0.2.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd"
+checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361"
 
 [[package]]
 name = "percent-encoding"
@@ -3187,7 +3217,7 @@ dependencies = [
  "phf_shared 0.11.2",
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -3372,9 +3402,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
 
 [[package]]
 name = "proc-macro2"
-version = "1.0.87"
+version = "1.0.89"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b3e4daa0dcf6feba26f985457cdf104d4b4256fc5a09547140f3631bb076b19a"
+checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e"
 dependencies = [
  "unicode-ident",
 ]
@@ -3708,9 +3738,9 @@ dependencies = [
 
 [[package]]
 name = "rustls"
-version = "0.23.14"
+version = "0.23.15"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8"
+checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993"
 dependencies = [
  "once_cell",
  "ring",
@@ -3731,9 +3761,9 @@ dependencies = [
 
 [[package]]
 name = "rustls-pki-types"
-version = "1.9.0"
+version = "1.10.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0e696e35370c65c9c541198af4543ccd580cf17fc25d8e05c5a242b202488c55"
+checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b"
 
 [[package]]
 name = "rustls-webpki"
@@ -3748,9 +3778,9 @@ dependencies = [
 
 [[package]]
 name = "rustversion"
-version = "1.0.17"
+version = "1.0.18"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6"
+checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248"
 
 [[package]]
 name = "ryu"
@@ -3767,15 +3797,6 @@ dependencies = [
  "winapi-util",
 ]
 
-[[package]]
-name = "schannel"
-version = "0.1.26"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1"
-dependencies = [
- "windows-sys 0.59.0",
-]
-
 [[package]]
 name = "schemars"
 version = "0.8.21"
@@ -3800,7 +3821,7 @@ dependencies = [
  "proc-macro2",
  "quote",
  "serde_derive_internals",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -3846,9 +3867,9 @@ dependencies = [
 
 [[package]]
 name = "serde"
-version = "1.0.210"
+version = "1.0.213"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
+checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1"
 dependencies = [
  "serde_derive",
 ]
@@ -3866,13 +3887,13 @@ dependencies = [
 
 [[package]]
 name = "serde_derive"
-version = "1.0.210"
+version = "1.0.213"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
+checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -3883,14 +3904,14 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
 name = "serde_json"
-version = "1.0.128"
+version = "1.0.132"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8"
+checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03"
 dependencies = [
  "itoa 1.0.11",
  "memchr",
@@ -3916,7 +3937,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -3967,7 +3988,7 @@ dependencies = [
  "darling",
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -4220,9 +4241,9 @@ dependencies = [
 
 [[package]]
 name = "syn"
-version = "2.0.79"
+version = "2.0.85"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590"
+checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56"
 dependencies = [
  "proc-macro2",
  "quote",
@@ -4304,7 +4325,7 @@ checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -4326,9 +4347,9 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
 
 [[package]]
 name = "tauri"
-version = "2.0.4"
+version = "2.0.6"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "44438500b50708bfc1e6083844e135d1b516325aae58710dcd8fb67e050ae87c"
+checksum = "d3889b392db6d32a105d3757230ea0220090b8f94c90d3e60b6c5eb91178ab1b"
 dependencies = [
  "anyhow",
  "bytes",
@@ -4377,16 +4398,16 @@ dependencies = [
 
 [[package]]
 name = "tauri-build"
-version = "2.0.1"
+version = "2.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "935f9b3c49b22b3e2e485a57f46d61cd1ae07b1cbb2ba87387a387caf2d8c4e7"
+checksum = "9f96827ccfb1aa40d55d0ded79562d18ba18566657a553f992a982d755148376"
 dependencies = [
  "anyhow",
  "cargo_toml",
  "dirs 5.0.1",
  "glob",
  "heck 0.5.0",
- "json-patch",
+ "json-patch 3.0.1",
  "schemars",
  "semver",
  "serde",
@@ -4399,14 +4420,14 @@ dependencies = [
 
 [[package]]
 name = "tauri-codegen"
-version = "2.0.1"
+version = "2.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "95d7443dd4f0b597704b6a14b964ee2ed16e99928d8e6292ae9825f09fbcd30e"
+checksum = "8947f16f47becd9e9cd39b74ee337fd1981574d78819be18e4384d85e5a0b82f"
 dependencies = [
  "base64 0.22.1",
  "brotli",
  "ico",
- "json-patch",
+ "json-patch 2.0.0",
  "plist",
  "png",
  "proc-macro2",
@@ -4415,7 +4436,7 @@ dependencies = [
  "serde",
  "serde_json",
  "sha2",
- "syn 2.0.79",
+ "syn 2.0.85",
  "tauri-utils",
  "thiserror",
  "time",
@@ -4426,23 +4447,23 @@ dependencies = [
 
 [[package]]
 name = "tauri-macros"
-version = "2.0.1"
+version = "2.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4d2c0963ccfc3f5194415f2cce7acc975942a8797fbabfb0aa1ed6f59326ae7f"
+checksum = "8bd1c8d4a66799d3438747c3a79705cd665a95d6f24cb5f315413ff7a981fe2a"
 dependencies = [
  "heck 0.5.0",
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
  "tauri-codegen",
  "tauri-utils",
 ]
 
 [[package]]
 name = "tauri-plugin"
-version = "2.0.1"
+version = "2.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b2e6660a409963e4d57b9bfab4addd141eeff41bd3a7fb14e13004a832cf7ef6"
+checksum = "6fa4e6c94cb1d635f65a770c69e23de1bc054b0e4c554fa037a7cc7676333d39"
 dependencies = [
  "anyhow",
  "glob",
@@ -4472,9 +4493,9 @@ dependencies = [
 
 [[package]]
 name = "tauri-plugin-dialog"
-version = "2.0.1"
+version = "2.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddb2fe88b602461c118722c574e2775ab26a4e68886680583874b2f6520608b7"
+checksum = "4307310e1d2c09ab110235834722e7c2b85099b683e1eb7342ab351b0be5ada3"
 dependencies = [
  "log",
  "raw-window-handle",
@@ -4490,9 +4511,9 @@ dependencies = [
 
 [[package]]
 name = "tauri-plugin-fs"
-version = "2.0.1"
+version = "2.0.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab300488ebec3487ca5f56289692e7e45feb07eea8d5e1dba497f7dc9dd9c407"
+checksum = "96ba7d46e86db8c830d143ef90ab5a453328365b0cc834c24edea4267b16aba0"
 dependencies = [
  "anyhow",
  "dunce",
@@ -4511,9 +4532,9 @@ dependencies = [
 
 [[package]]
 name = "tauri-plugin-shell"
-version = "2.0.1"
+version = "2.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "371fb9aca2823990a2d0db7970573be5fdf07881fcaa2b835b29631feb84aec1"
+checksum = "0ad7880c5586b6b2104be451e3d7fc0f3800c84bda69e9ba81c828f87cb34267"
 dependencies = [
  "encoding_rs",
  "log",
@@ -4532,9 +4553,9 @@ dependencies = [
 
 [[package]]
 name = "tauri-plugin-store"
-version = "2.0.1"
+version = "2.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5058f179f7215390fc5a68eeffcb805b7e2681d6e817a5d08094fae7ab649e68"
+checksum = "e9a580be53f04bb62422d239aa798e88522877f58a0d4a0e745f030055a51bb4"
 dependencies = [
  "dunce",
  "log",
@@ -4578,9 +4599,9 @@ dependencies = [
 
 [[package]]
 name = "tauri-runtime"
-version = "2.1.0"
+version = "2.1.1"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c8f437293d6f5e5dce829250f4dbdce4e0b52905e297a6689cc2963eb53ac728"
+checksum = "a1ef7363e7229ac8d04e8a5d405670dbd43dde8fc4bc3bc56105c35452d03784"
 dependencies = [
  "dpi",
  "gtk",
@@ -4597,9 +4618,9 @@ dependencies = [
 
 [[package]]
 name = "tauri-runtime-wry"
-version = "2.1.1"
+version = "2.1.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1431602bcc71f2f840ad623915c9842ecc32999b867c4a787d975a17a9625cc6"
+checksum = "62fa2068e8498ad007b54d5773d03d57c3ff6dd96f8c8ce58beff44d0d5e0d30"
 dependencies = [
  "gtk",
  "http",
@@ -4623,9 +4644,9 @@ dependencies = [
 
 [[package]]
 name = "tauri-utils"
-version = "2.0.1"
+version = "2.0.2"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c38b0230d6880cf6dd07b6d7dd7789a0869f98ac12146e0d18d1c1049215a045"
+checksum = "1fc65d6f5c54e56b66258948a6d9e47a82ea41f4b5a7612bfbdd1634c2913ed0"
 dependencies = [
  "brotli",
  "cargo_metadata",
@@ -4634,7 +4655,7 @@ dependencies = [
  "glob",
  "html5ever",
  "infer",
- "json-patch",
+ "json-patch 2.0.0",
  "kuchikiki",
  "log",
  "memchr",
@@ -4699,22 +4720,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
 
 [[package]]
 name = "thiserror"
-version = "1.0.64"
+version = "1.0.65"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84"
+checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5"
 dependencies = [
  "thiserror-impl",
 ]
 
 [[package]]
 name = "thiserror-impl"
-version = "1.0.64"
+version = "1.0.65"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3"
+checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -4765,9 +4786,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
 
 [[package]]
 name = "tokio"
-version = "1.40.0"
+version = "1.41.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998"
+checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb"
 dependencies = [
  "backtrace",
  "bytes",
@@ -4790,7 +4811,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -4938,7 +4959,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -5211,9 +5232,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
 
 [[package]]
 name = "wasm-bindgen"
-version = "0.2.93"
+version = "0.2.95"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"
+checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e"
 dependencies = [
  "cfg-if",
  "once_cell",
@@ -5222,24 +5243,24 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-backend"
-version = "0.2.93"
+version = "0.2.95"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"
+checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358"
 dependencies = [
  "bumpalo",
  "log",
  "once_cell",
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
  "wasm-bindgen-shared",
 ]
 
 [[package]]
 name = "wasm-bindgen-futures"
-version = "0.4.43"
+version = "0.4.45"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed"
+checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b"
 dependencies = [
  "cfg-if",
  "js-sys",
@@ -5249,9 +5270,9 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-macro"
-version = "0.2.93"
+version = "0.2.95"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"
+checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56"
 dependencies = [
  "quote",
  "wasm-bindgen-macro-support",
@@ -5259,22 +5280,22 @@ dependencies = [
 
 [[package]]
 name = "wasm-bindgen-macro-support"
-version = "0.2.93"
+version = "0.2.95"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"
+checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
  "wasm-bindgen-backend",
  "wasm-bindgen-shared",
 ]
 
 [[package]]
 name = "wasm-bindgen-shared"
-version = "0.2.93"
+version = "0.2.95"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"
+checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d"
 
 [[package]]
 name = "wasm-streams"
@@ -5305,9 +5326,9 @@ dependencies = [
 
 [[package]]
 name = "wayland-client"
-version = "0.31.6"
+version = "0.31.7"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e3f45d1222915ef1fd2057220c1d9d9624b7654443ea35c3877f7a52bd0a5a2d"
+checksum = "b66249d3fc69f76fd74c82cc319300faa554e9d865dab1f7cd66cc20db10b280"
 dependencies = [
  "bitflags 2.6.0",
  "rustix",
@@ -5317,9 +5338,9 @@ dependencies = [
 
 [[package]]
 name = "wayland-protocols"
-version = "0.32.4"
+version = "0.32.5"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2b5755d77ae9040bb872a25026555ce4cb0ae75fd923e90d25fba07d81057de0"
+checksum = "7cd0ade57c4e6e9a8952741325c30bf82f4246885dca8bf561898b86d0c1f58e"
 dependencies = [
  "bitflags 2.6.0",
  "wayland-backend",
@@ -5351,9 +5372,9 @@ dependencies = [
 
 [[package]]
 name = "web-sys"
-version = "0.3.70"
+version = "0.3.72"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"
+checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112"
 dependencies = [
  "js-sys",
  "wasm-bindgen",
@@ -5434,7 +5455,7 @@ checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -5533,7 +5554,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -5544,7 +5565,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -5830,9 +5851,9 @@ dependencies = [
 
 [[package]]
 name = "wry"
-version = "0.46.2"
+version = "0.46.3"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6fa1c8c760041c64ce6be99f83d6cb55fe3fcd85a1ad46d32895f6e65cee87ba"
+checksum = "cd5cdf57c66813d97601181349c63b96994b3074fc3d7a31a8cce96e968e3bbd"
 dependencies = [
  "base64 0.22.1",
  "block2",
@@ -6000,7 +6021,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]
@@ -6020,7 +6041,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69"
 dependencies = [
  "proc-macro2",
  "quote",
- "syn 2.0.79",
+ "syn 2.0.85",
 ]
 
 [[package]]

+ 3 - 7
packages/hoppscotch-agent/src-tauri/Cargo.toml

@@ -2,7 +2,7 @@
 name = "hoppscotch-agent"
 version = "0.1.1"
 description = "A cross-platform HTTP request agent for Hoppscotch for advanced request handling including custom headers, certificates, proxies, and local system integration."
-authors = ["CuriousCorrelation", "AndrewBastin"]
+authors = ["AndrewBastin", "CuriousCorrelation"]
 edition = "2021"
 
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
@@ -31,18 +31,14 @@ chrono = { version = "0.4", features = ["serde"] }
 rand = "0.8.5"
 log = "0.4.22"
 env_logger = "0.11.5"
-curl = { version = "0.4.47", features = ["ntlm", "static-curl", "static-ssl"] }
-openssl = { version = "0.10.68", features = ["vendored"] }
-openssl-sys = { version = "0.9.104", features = ["vendored"] }
-url-escape = "0.1.1"
+hoppscotch-relay = { path = "../../hoppscotch-relay" }
 thiserror = "1.0.64"
-tauri-plugin-store = "2.0.1"
+tauri-plugin-store = "2.1.0"
 x25519-dalek = { version = "2.0.1", features = ["getrandom"] }
 base16 = "0.2.1"
 aes-gcm = { version = "0.10.3", features = ["aes"] }
 tauri-plugin-updater = "2.0.2"
 tauri-plugin-dialog = "2.0.1"
-http = "1.1.0"
 lazy_static = "1.5.0"
 
 [dev-dependencies]

+ 36 - 35
packages/hoppscotch-agent/src-tauri/src/controller.rs

@@ -8,16 +8,14 @@ use axum_extra::{
     headers::{authorization::Bearer, Authorization},
     TypedHeader,
 };
+use hoppscotch_relay::{RequestWithMetadata, ResponseWithMetadata};
 use std::sync::Arc;
 use tauri::{AppHandle, Emitter};
 use x25519_dalek::{EphemeralSecret, PublicKey};
 
 use crate::{
     error::{AppError, AppResult},
-    model::{
-        AuthKeyResponse, ConfirmedRegistrationRequest, HandshakeResponse, RequestDef,
-        RunRequestResponse,
-    },
+    model::{AuthKeyResponse, ConfirmedRegistrationRequest, HandshakeResponse},
     state::{AppState, Registration},
     util::EncryptedJson,
 };
@@ -27,19 +25,18 @@ use serde_json::json;
 use uuid::Uuid;
 
 fn generate_otp() -> String {
-  let otp: u32 = rand::thread_rng().gen_range(0..1_000_000);
+    let otp: u32 = rand::thread_rng().gen_range(0..1_000_000);
 
-  format!("{:06}", otp)
+    format!("{:06}", otp)
 }
 
 pub async fn handshake(
-  State((_, app_handle)): State<(Arc<AppState>, AppHandle)>
+    State((_, app_handle)): State<(Arc<AppState>, AppHandle)>,
 ) -> AppResult<Json<HandshakeResponse>> {
     Ok(Json(HandshakeResponse {
         status: "success".to_string(),
         __hoppscotch__agent__: true,
-        agent_version: app_handle.package_info().version.to_string()
-
+        agent_version: app_handle.package_info().version.to_string(),
     }))
 }
 
@@ -86,11 +83,11 @@ pub async fn verify_registration(
     let agent_public_key = PublicKey::from(&agent_secret_key);
 
     let their_public_key = {
-        let public_key_slice: &[u8; 32] = &base16::decode(&confirmed_registration.client_public_key_b16)
-          .map_err(|_| AppError::InvalidClientPublicKey)?
-          [0..32]
-          .try_into()
-          .map_err(|_| AppError::InvalidClientPublicKey)?;
+        let public_key_slice: &[u8; 32] =
+            &base16::decode(&confirmed_registration.client_public_key_b16)
+                .map_err(|_| AppError::InvalidClientPublicKey)?[0..32]
+                .try_into()
+                .map_err(|_| AppError::InvalidClientPublicKey)?;
 
         PublicKey::from(public_key_slice.to_owned())
     };
@@ -98,10 +95,13 @@ pub async fn verify_registration(
     let shared_secret = agent_secret_key.diffie_hellman(&their_public_key);
 
     let _ = state.update_registrations(app_handle.clone(), |regs| {
-      regs.insert(auth_key_copy, Registration {
-        registered_at: created_at,
-        shared_secret_b16: base16::encode_lower(shared_secret.as_bytes())
-      });
+        regs.insert(
+            auth_key_copy,
+            Registration {
+                registered_at: created_at,
+                shared_secret_b16: base16::encode_lower(shared_secret.as_bytes()),
+            },
+        );
     })?;
 
     let auth_payload = json!({
@@ -124,25 +124,28 @@ pub async fn run_request<T>(
     State((state, _app_handle)): State<(Arc<AppState>, T)>,
     TypedHeader(auth_header): TypedHeader<Authorization<Bearer>>,
     headers: HeaderMap,
-    body: Bytes
-) -> AppResult<EncryptedJson<RunRequestResponse>> {
-    let nonce = headers.get("X-Hopp-Nonce")
-      .ok_or(AppError::Unauthorized)?
-      .to_str()
-      .map_err(|_| AppError::Unauthorized)?;
-
-    let req: RequestDef = state.validate_access_and_get_data(auth_header.token(), nonce, &body)
+    body: Bytes,
+) -> AppResult<EncryptedJson<ResponseWithMetadata>> {
+    let nonce = headers
+        .get("X-Hopp-Nonce")
+        .ok_or(AppError::Unauthorized)?
+        .to_str()
+        .map_err(|_| AppError::Unauthorized)?;
+
+    let req: RequestWithMetadata = state
+        .validate_access_and_get_data(auth_header.token(), nonce, &body)
         .ok_or(AppError::Unauthorized)?;
 
-    let reg_info = state.get_registration_info(auth_header.token())
+    let req_id = req.req_id;
+
+    let reg_info = state
+        .get_registration_info(auth_header.token())
         .ok_or(AppError::Unauthorized)?;
 
     let cancel_token = tokio_util::sync::CancellationToken::new();
     state.add_cancellation_token(req.req_id, cancel_token.clone());
 
-    let req_id = req.req_id;
     let cancel_token_clone = cancel_token.clone();
-
     // Execute the HTTP request in a blocking thread pool and handles cancellation.
     //
     // It:
@@ -158,9 +161,9 @@ pub async fn run_request<T>(
     // - `spawn_blocking` moves this operation to a thread pool designed for
     //   blocking tasks, so other async operations to continue unblocked.
     let result = tokio::select! {
-        res = tokio::task::spawn_blocking(move || crate::interceptor::run_request_task(&req, cancel_token_clone)) => {
+        res = tokio::task::spawn_blocking(move || hoppscotch_relay::run_request_task(&req, cancel_token_clone)) => {
             match res {
-                Ok(task_result) => task_result,
+                Ok(task_result) => Ok(task_result?),
                 Err(_) => Err(AppError::InternalServerError),
             }
         },
@@ -171,11 +174,9 @@ pub async fn run_request<T>(
 
     state.remove_cancellation_token(req_id);
 
-    result.map(|val| {
-      EncryptedJson {
+    result.map(|val| EncryptedJson {
         key_b16: reg_info.shared_secret_b16,
-        data: val
-      }
+        data: val,
     })
 }
 

+ 2 - 0
packages/hoppscotch-agent/src-tauri/src/error.rs

@@ -42,6 +42,8 @@ pub enum AppError {
     RegistrationSaveError,
     #[error("Store error: {0}")]
     TauriPluginStore(#[from] tauri_plugin_store::Error),
+    #[error("Relay error: {0}")]
+    Relay(#[from] hoppscotch_relay::RelayError),
 }
 
 impl IntoResponse for AppError {

+ 0 - 567
packages/hoppscotch-agent/src-tauri/src/interceptor.rs

@@ -1,567 +0,0 @@
-use crate::{
-    error::AppError,
-    model::{BodyDef, ClientCertDef, FormDataValue, KeyValuePair, RequestDef, RunRequestResponse},
-    util::get_status_text,
-};
-use curl::easy::{Easy, List};
-use openssl::{pkcs12::Pkcs12, ssl::SslContextBuilder, x509::X509};
-use openssl_sys::SSL_CTX;
-use std::time::SystemTime;
-use tokio_util::sync::CancellationToken;
-
-pub(crate) fn run_request_task(
-    req: &RequestDef,
-    cancel_token: CancellationToken,
-) -> Result<RunRequestResponse, AppError> {
-    let mut curl_handle = Easy::new();
-
-    curl_handle
-        .progress(true)
-        .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-    curl_handle
-        .custom_request(&req.method)
-        .map_err(|_| AppError::InvalidMethod)?;
-
-    curl_handle
-        .url(&req.endpoint)
-        .map_err(|_| AppError::InvalidUrl)?;
-
-    curl_handle
-        .http_headers(get_headers_list(&req)?)
-        .map_err(|_| AppError::InvalidHeaders)?;
-
-    apply_body_to_curl_handle(&mut curl_handle, &req)?;
-
-    curl_handle
-        .ssl_verify_peer(req.validate_certs)
-        .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-    curl_handle
-        .ssl_verify_host(req.validate_certs)
-        .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-    apply_client_cert_to_curl_handle(&mut curl_handle, &req)?;
-
-    apply_proxy_config_to_curl_handle(&mut curl_handle, &req)?;
-
-    let mut response_body = Vec::new();
-    let mut response_headers = Vec::new();
-
-    let (start_time_ms, end_time_ms) = {
-        let mut transfer = curl_handle.transfer();
-
-        transfer
-            .ssl_ctx_function(|ssl_ctx_ptr| {
-                let cert_list = get_x509_certs_from_root_cert_bundle(&req);
-
-                if !cert_list.is_empty() {
-                    let mut ssl_ctx_builder =
-                        unsafe { SslContextBuilder::from_ptr(ssl_ctx_ptr as *mut SSL_CTX) };
-
-                    let cert_store = ssl_ctx_builder.cert_store_mut();
-
-                    for cert in cert_list {
-                        if let Err(e) = cert_store.add_cert(cert) {
-                            eprintln!("Failed writing cert into cert store: {}", e);
-                        }
-                    }
-                }
-
-                Ok(())
-            })
-            .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-        transfer
-            .progress_function(|_, _, _, _| !cancel_token.is_cancelled())
-            .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-        transfer
-            .header_function(|header| {
-                let header = String::from_utf8_lossy(header).into_owned();
-
-                if let Some((key, value)) = header.split_once(':') {
-                    response_headers.push(KeyValuePair {
-                        key: key.trim().to_string(),
-                        value: value.trim().to_string(),
-                    });
-                }
-
-                true
-            })
-            .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-        transfer
-            .write_function(|data| {
-                response_body.extend_from_slice(data);
-                Ok(data.len())
-            })
-            .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-        let start_time_ms = SystemTime::now()
-            .duration_since(std::time::UNIX_EPOCH)
-            .unwrap()
-            .as_millis();
-
-        transfer
-            .perform()
-            .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-
-        let end_time_ms = SystemTime::now()
-            .duration_since(std::time::UNIX_EPOCH)
-            .unwrap()
-            .as_millis();
-
-        (start_time_ms, end_time_ms)
-    };
-
-    let response_status = curl_handle
-        .response_code()
-        .map_err(|err| AppError::RequestRunError(err.description().to_string()))?
-        as u16;
-
-    let response_status_text = get_status_text(response_status).to_string();
-
-    Ok(RunRequestResponse {
-        status: response_status,
-        status_text: response_status_text,
-        headers: response_headers,
-        data: response_body,
-        time_start_ms: start_time_ms,
-        time_end_ms: end_time_ms,
-    })
-}
-
-fn get_headers_list(req: &RequestDef) -> Result<List, AppError> {
-    let mut result = List::new();
-
-    for KeyValuePair { key, value } in &req.headers {
-        result
-            .append(&format!("{}: {}", key, value))
-            .map_err(|err| AppError::RequestRunError(err.description().to_string()))?;
-    }
-
-    Ok(result)
-}
-
-fn apply_body_to_curl_handle(curl_handle: &mut Easy, req: &RequestDef) -> Result<(), AppError> {
-    match &req.body {
-        Some(BodyDef::Text(text)) => {
-            curl_handle
-                .post_fields_copy(text.as_bytes())
-                .map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Error while setting body: {}",
-                        err.description()
-                    ))
-                })?;
-        }
-        Some(BodyDef::FormData(entries)) => {
-            let mut form = curl::easy::Form::new();
-
-            for entry in entries {
-                let mut part = form.part(&entry.key);
-
-                match &entry.value {
-                    FormDataValue::Text(data) => {
-                        part.contents(data.as_bytes());
-                    }
-                    FormDataValue::File {
-                        filename,
-                        data,
-                        mime,
-                    } => {
-                        part.buffer(filename, data.clone()).content_type(mime);
-                    }
-                };
-
-                part.add().map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Error while setting body: {}",
-                        err.description()
-                    ))
-                })?;
-            }
-
-            curl_handle.httppost(form).map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Error while setting body: {}",
-                    err.description()
-                ))
-            })?;
-        }
-        Some(BodyDef::URLEncoded(entries)) => {
-            let data = entries
-                .iter()
-                .map(|KeyValuePair { key, value }| {
-                    format!(
-                        "{}={}",
-                        &url_escape::encode_www_form_urlencoded(key),
-                        url_escape::encode_www_form_urlencoded(value)
-                    )
-                })
-                .collect::<Vec<String>>()
-                .join("&");
-
-            curl_handle
-                .post_fields_copy(data.as_bytes())
-                .map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Error while setting body: {}",
-                        err.description()
-                    ))
-                })?;
-        }
-        None => {}
-    };
-
-    Ok(())
-}
-
-fn apply_client_cert_to_curl_handle(handle: &mut Easy, req: &RequestDef) -> Result<(), AppError> {
-    match &req.client_cert {
-        Some(ClientCertDef::PEMCert {
-            certificate_pem,
-            key_pem,
-        }) => {
-            handle.ssl_cert_type("PEM").map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Failed setting PEM Cert Type: {}",
-                    err.description()
-                ))
-            })?;
-
-            handle.ssl_cert_blob(certificate_pem).map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Failed setting PEM Cert Blob: {}",
-                    err.description()
-                ))
-            })?;
-
-            handle.ssl_key_type("PEM").map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Failed setting PEM key type: {}",
-                    err.description()
-                ))
-            })?;
-
-            handle.ssl_key_blob(key_pem).map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Failed setting PEM Cert blob: {}",
-                    err.description()
-                ))
-            })?;
-        }
-        Some(ClientCertDef::PFXCert {
-            certificate_pfx,
-            password,
-        }) => {
-            let pkcs12 = Pkcs12::from_der(&certificate_pfx).map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Failed to parse PFX certificate from DER: {}",
-                    err
-                ))
-            })?;
-
-            let parsed = pkcs12.parse2(password).map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Failed to parse PFX certificate with provided password: {}",
-                    err
-                ))
-            })?;
-
-            if let (Some(cert), Some(key)) = (parsed.cert, parsed.pkey) {
-                let certificate_pem = cert.to_pem().map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Failed to convert PFX certificate to PEM format: {}",
-                        err
-                    ))
-                })?;
-
-                let key_pem = key.private_key_to_pem_pkcs8().map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Failed to convert PFX private key to PEM format: {}",
-                        err
-                    ))
-                })?;
-
-                handle.ssl_cert_type("PEM").map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Failed setting PEM Cert Type for converted PFX: {}",
-                        err.description()
-                    ))
-                })?;
-
-                handle.ssl_cert_blob(&certificate_pem).map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Failed setting PEM Cert Blob for converted PFX: {}",
-                        err.description()
-                    ))
-                })?;
-
-                handle.ssl_key_type("PEM").map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Failed setting PEM key type for converted PFX: {}",
-                        err.description()
-                    ))
-                })?;
-
-                handle.ssl_key_blob(&key_pem).map_err(|err| {
-                    AppError::RequestRunError(format!(
-                        "Failed setting PEM key blob for converted PFX: {}",
-                        err.description()
-                    ))
-                })?;
-            } else {
-                return Err(AppError::RequestRunError(
-                    "PFX certificate parsing succeeded, but either cert or private key is missing"
-                        .to_string(),
-                ));
-            }
-        }
-        None => {}
-    };
-
-    Ok(())
-}
-
-fn get_x509_certs_from_root_cert_bundle(req: &RequestDef) -> Vec<X509> {
-    req.root_cert_bundle_files
-        .iter()
-        .map(|pem_bundle| openssl::x509::X509::stack_from_pem(pem_bundle))
-        .filter_map(|certs| {
-            if let Ok(certs) = certs {
-                Some(certs)
-            } else {
-                None
-            }
-        })
-        .flatten()
-        .collect()
-}
-
-fn apply_proxy_config_to_curl_handle(handle: &mut Easy, req: &RequestDef) -> Result<(), AppError> {
-    if let Some(proxy_config) = &req.proxy {
-        handle
-            .proxy_auth(curl::easy::Auth::new().auto(true))
-            .map_err(|err| {
-                AppError::RequestRunError(format!(
-                    "Failed to set proxy Auth Mode: {}",
-                    err.description()
-                ))
-            })?;
-
-        handle.proxy(&proxy_config.url).map_err(|err| {
-            AppError::RequestRunError(format!("Failed to set proxy URL: {}", err.description()))
-        })?;
-    }
-
-    Ok(())
-}
-
-#[cfg(test)]
-mod tests {
-    use crate::model::FormDataEntry;
-
-    use super::*;
-    use mockito::Server;
-
-    #[test]
-    fn test_run_request_task_success() {
-        let mut server = Server::new();
-        let mock = server
-            .mock("GET", "/test")
-            .with_status(200)
-            .with_header("content-type", "text/plain")
-            .with_body("Hello, World!")
-            .create();
-
-        let req = RequestDef {
-            req_id: 1,
-            method: "GET".to_string(),
-            endpoint: format!("{}/test", server.url()),
-            headers: vec![],
-            body: None,
-            validate_certs: false,
-            root_cert_bundle_files: vec![],
-            client_cert: None,
-            proxy: None,
-        };
-        let cancel_token = CancellationToken::new();
-
-        let result = run_request_task(&req, cancel_token);
-        assert!(result.is_ok());
-
-        let response = result.unwrap();
-        assert_eq!(response.status, 200);
-        assert_eq!(response.status_text, "OK");
-        assert!(response
-            .headers
-            .iter()
-            .any(|h| h.key == "content-type" && h.value == "text/plain"));
-        assert_eq!(response.data, b"Hello, World!");
-
-        mock.assert();
-    }
-
-    #[test]
-    fn test_run_request_task_with_headers() {
-        let mut server = Server::new();
-        let mock = server
-            .mock("GET", "/test")
-            .match_header("X-Custom-Header", "TestValue")
-            .with_status(200)
-            .create();
-
-        let req = RequestDef {
-            req_id: 1,
-            method: "GET".to_string(),
-            endpoint: format!("{}/test", server.url()),
-            headers: vec![KeyValuePair {
-                key: "X-Custom-Header".to_string(),
-                value: "TestValue".to_string(),
-            }],
-            body: None,
-            validate_certs: false,
-            root_cert_bundle_files: vec![],
-            client_cert: None,
-            proxy: None,
-        };
-        let cancel_token = CancellationToken::new();
-
-        let result = run_request_task(&req, cancel_token);
-        assert!(result.is_ok());
-
-        mock.assert();
-    }
-
-    #[test]
-    fn test_run_request_task_with_body() {
-        let mut server = Server::new();
-        let mock = server
-            .mock("POST", "/test")
-            .match_body("test_body")
-            .with_status(201)
-            .create();
-
-        let req = RequestDef {
-            req_id: 1,
-            method: "POST".to_string(),
-            endpoint: format!("{}/test", server.url()),
-            headers: vec![],
-            body: Some(BodyDef::Text("test_body".to_string())),
-            validate_certs: false,
-            root_cert_bundle_files: vec![],
-            client_cert: None,
-            proxy: None,
-        };
-        let cancel_token = CancellationToken::new();
-
-        let result = run_request_task(&req, cancel_token);
-        assert!(result.is_ok());
-        assert_eq!(result.unwrap().status, 201);
-
-        mock.assert();
-    }
-
-    #[test]
-    fn test_run_request_task_with_url_encoded_body() {
-        let mut server = Server::new();
-        let mock = server
-            .mock("POST", "/test")
-            .match_body("key1=value1&key2=value2")
-            .with_status(200)
-            .create();
-
-        let req = RequestDef {
-            req_id: 1,
-            method: "POST".to_string(),
-            endpoint: format!("{}/test", server.url()),
-            headers: vec![],
-            body: Some(BodyDef::URLEncoded(vec![
-                KeyValuePair {
-                    key: "key1".to_string(),
-                    value: "value1".to_string(),
-                },
-                KeyValuePair {
-                    key: "key2".to_string(),
-                    value: "value2".to_string(),
-                },
-            ])),
-            validate_certs: false,
-            root_cert_bundle_files: vec![],
-            client_cert: None,
-            proxy: None,
-        };
-        let cancel_token = CancellationToken::new();
-
-        let result = run_request_task(&req, cancel_token);
-        assert!(result.is_ok());
-
-        mock.assert();
-    }
-
-    #[test]
-    fn test_run_request_task_with_invalid_url() {
-        let req = RequestDef {
-            req_id: 1,
-            method: "GET".to_string(),
-            endpoint: "invalid_url".to_string(),
-            headers: vec![],
-            body: None,
-            validate_certs: false,
-            root_cert_bundle_files: vec![],
-            client_cert: None,
-            proxy: None,
-        };
-        let cancel_token = CancellationToken::new();
-
-        let result = run_request_task(&req, cancel_token);
-
-        assert!(result.is_err());
-    }
-
-    #[test]
-    fn test_run_request_task_with_form_data() {
-        let mut server = Server::new();
-        let mock = server
-            .mock("POST", "/test")
-            .match_header(
-                "content-type",
-                mockito::Matcher::Regex("multipart/form-data.*".to_string()),
-            )
-            .with_status(200)
-            .create();
-
-        let req = RequestDef {
-            req_id: 1,
-            method: "POST".to_string(),
-            endpoint: format!("{}/test", server.url()),
-            headers: vec![],
-            body: Some(BodyDef::FormData(vec![
-                FormDataEntry {
-                    key: "text_field".to_string(),
-                    value: FormDataValue::Text("text_value".to_string()),
-                },
-                FormDataEntry {
-                    key: "file_field".to_string(),
-                    value: FormDataValue::File {
-                        filename: "test.txt".to_string(),
-                        data: b"file_content".to_vec(),
-                        mime: "text/plain".to_string(),
-                    },
-                },
-            ])),
-            validate_certs: false,
-            root_cert_bundle_files: vec![],
-            client_cert: None,
-            proxy: None,
-        };
-        let cancel_token = CancellationToken::new();
-
-        let result = run_request_task(&req, cancel_token);
-        assert!(result.is_ok());
-
-        mock.assert();
-    }
-}

+ 1 - 2
packages/hoppscotch-agent/src-tauri/src/lib.rs

@@ -1,6 +1,5 @@
 pub mod controller;
 pub mod error;
-pub mod interceptor;
 pub mod model;
 pub mod route;
 pub mod server;
@@ -73,7 +72,7 @@ pub fn run() {
                   });
             };
 
-            let app_state = Arc::new(AppState::new(app_handle.clone()));
+            let app_state = Arc::new(AppState::new(app_handle.clone())?);
 
             app.manage(app_state.clone());
 

+ 3 - 72
packages/hoppscotch-agent/src-tauri/src/model.rs

@@ -7,7 +7,7 @@ pub struct HandshakeResponse {
     pub __hoppscotch__agent__: bool,
 
     pub status: String,
-    pub agent_version: String
+    pub agent_version: String,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -18,7 +18,7 @@ pub struct ConfirmedRegistrationRequest {
     /// to the agent so that the agent can establish a shared secret
     /// which will be used to encrypt traffic between agent
     /// and client after registration
-    pub client_public_key_b16: String
+    pub client_public_key_b16: String,
 }
 
 #[derive(Debug, Serialize, Deserialize)]
@@ -30,74 +30,5 @@ pub struct AuthKeyResponse {
     /// agent so that the client can establish a shared secret
     /// which will be used to encrypt traffic between agent
     /// and client after registration
-    pub agent_public_key_b16: String
-}
-
-#[derive(Clone, Debug, Serialize, Deserialize)]
-pub struct KeyValuePair {
-    pub key: String,
-    pub value: String,
-}
-
-#[derive(Debug, Deserialize)]
-pub enum FormDataValue {
-    Text(String),
-    File {
-        filename: String,
-        data: Vec<u8>,
-        mime: String,
-    },
-}
-
-#[derive(Debug, Deserialize)]
-pub struct FormDataEntry {
-    pub key: String,
-    pub value: FormDataValue,
-}
-
-#[derive(Debug, Deserialize)]
-pub enum BodyDef {
-    Text(String),
-    URLEncoded(Vec<KeyValuePair>),
-    FormData(Vec<FormDataEntry>),
-}
-
-#[derive(Debug, Deserialize)]
-pub struct RequestDef {
-    pub req_id: usize,
-    pub method: String,
-    pub endpoint: String,
-    pub headers: Vec<KeyValuePair>,
-    pub body: Option<BodyDef>,
-    pub validate_certs: bool,
-    pub root_cert_bundle_files: Vec<Vec<u8>>,
-    pub client_cert: Option<ClientCertDef>,
-    pub proxy: Option<ProxyConfig>,
-}
-
-#[derive(Debug, Deserialize)]
-pub struct ProxyConfig {
-    pub url: String,
-}
-
-#[derive(Debug, Deserialize)]
-pub enum ClientCertDef {
-    PEMCert {
-        certificate_pem: Vec<u8>,
-        key_pem: Vec<u8>,
-    },
-    PFXCert {
-        certificate_pfx: Vec<u8>,
-        password: String,
-    },
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct RunRequestResponse {
-    pub status: u16,
-    pub status_text: String,
-    pub headers: Vec<KeyValuePair>,
-    pub data: Vec<u8>,
-    pub time_start_ms: u128,
-    pub time_end_ms: u128,
+    pub agent_public_key_b16: String,
 }

+ 8 - 8
packages/hoppscotch-agent/src-tauri/src/state.rs

@@ -7,7 +7,7 @@ use tauri_plugin_store::StoreBuilder;
 use tokio::sync::RwLock;
 use tokio_util::sync::CancellationToken;
 
-use crate::error::AppError;
+use crate::error::{AppError, AppResult};
 
 /// Describes one registered app instance
 #[derive(Debug, Clone, Serialize, Deserialize)]
@@ -34,10 +34,10 @@ pub struct AppState {
 }
 
 impl AppState {
-    pub fn new(app_handle: tauri::AppHandle) -> Self {
-        let store = StoreBuilder::new(&app_handle, "app_data.bin").build();
+    pub fn new(app_handle: tauri::AppHandle) -> AppResult<Self> {
+        let store = StoreBuilder::new(&app_handle, "app_data.bin").build()?;
 
-        let _ = store.load();
+        let _ = store.reload();
 
         // Try loading and parsing registrations from the store, if that failed,
         // load the default list
@@ -46,11 +46,11 @@ impl AppState {
             .and_then(|val| serde_json::from_value(val.clone()).ok())
             .unwrap_or_else(|| DashMap::new());
 
-        Self {
+        Ok(Self {
             active_registration_code: RwLock::new(None),
             cancellation_tokens: DashMap::new(),
             registrations,
-        }
+        })
     }
 
     /// Gets you a readonly reference to the registrations list
@@ -70,9 +70,9 @@ impl AppState {
     ) -> Result<(), AppError> {
         update_func(&self.registrations);
 
-        let store = StoreBuilder::new(&app_handle, "app_data.bin").build();
+        let store = StoreBuilder::new(&app_handle, "app_data.bin").build()?;
 
-        let _ = store.load()?;
+        let _ = store.reload()?;
 
         let _ = store
             .delete("registrations")

+ 0 - 7
packages/hoppscotch-agent/src-tauri/src/util.rs

@@ -3,13 +3,6 @@ use axum::{body::Body, response::{IntoResponse, Response}};
 use rand::rngs::OsRng;
 use serde::Serialize;
 
-pub fn get_status_text(status: u16) -> &'static str {
-    http::StatusCode::from_u16(status)
-        .map(|status| status.canonical_reason())
-        .unwrap_or(Some("Unknown Status"))
-        .unwrap_or("Unknown Status")
-}
-
 #[derive(Debug)]
 pub struct EncryptedJson<T: Serialize> {
   pub key_b16: String,

+ 2 - 0
packages/hoppscotch-common/locales/en.json

@@ -79,6 +79,7 @@
     "not_running_title": "Agent not detected",
     "registration_title": "Agent registration",
     "verify_ssl_certs": "Verify SSL Certificates",
+    "ca_certs": "CA Certificates",
     "client_certs": "Client Certificates",
     "use_http_proxy": "Use HTTP Proxy",
     "proxy_capabilities": "Hoppscotch Agent supports HTTP/HTTPS/SOCKS proxies along with NTLM and Basic Auth in those proxies. Include the username and password for the proxy authentication in the URL itself.",
@@ -382,6 +383,7 @@
     "gql_prettify_invalid_query": "Couldn't prettify an invalid query, solve query syntax errors and try again",
     "incomplete_config_urls": "Incomplete configuration URLs",
     "incorrect_email": "Incorrect email",
+    "invalid_file_type": "Invalid file type for `{filename}`.",
     "invalid_link": "Invalid link",
     "invalid_link_description": "The link you clicked is invalid or expired.",
     "invalid_embed_link": "The embed does not exist or is invalid.",

Некоторые файлы не были показаны из-за большого количества измененных файлов