diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index d3e534f..2fc5bc5 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -68,6 +68,10 @@ checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" name = "app" version = "0.1.0" dependencies = [ + "aws-config", + "aws-sdk-sts", + "aws-smithy-types", + "aws-types", "netstat2", "serde", "serde_json", @@ -136,12 +140,288 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "aws-config" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7688e1dfbb9f7804fab0a830820d7e827b8d973906763cf1a855ce4719292f5" +dependencies = [ + "aws-http", + "aws-sdk-sso", + "aws-sdk-sts", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", + "aws-smithy-types", + "aws-types", + "bytes", + "hex", + "http", + "hyper", + "ring", + "time", + "tokio", + "tower", + "tracing", + "zeroize", +] + +[[package]] +name = "aws-endpoint" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "253d7cd480bfa59a5323390e9e91885a8f06a275e0517d81eeb1070b6aa7d271" +dependencies = [ + "aws-smithy-http", + "aws-smithy-types", + "aws-types", + "http", + "regex", + "tracing", +] + +[[package]] +name = "aws-http" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd1b83859383e46ea8fda633378f9f3f02e6e3a446fd89f0240b5c3662716c9" +dependencies = [ + "aws-smithy-http", + "aws-smithy-types", + "aws-types", + "bytes", + "http", + "http-body", + "lazy_static", + "percent-encoding", + "pin-project-lite", + "tracing", +] + +[[package]] +name = "aws-sdk-sso" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf03342c2b3f52b180f484e60586500765474f2bfc7dcd4ffe893a7a1929db1d" +dependencies = [ + "aws-endpoint", + "aws-http", + "aws-sig-auth", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-json", + "aws-smithy-types", + "aws-types", + "bytes", + "http", + "tokio-stream", + "tower", +] + +[[package]] +name = "aws-sdk-sts" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa1de4e07ea87a30a317c7b563b3a40fd18a843ad794216dda81672b6e174bce" +dependencies = [ + "aws-endpoint", + "aws-http", + "aws-sig-auth", + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-query", + "aws-smithy-types", + "aws-smithy-xml", + "aws-types", + "bytes", + "http", + "tower", + "tracing", +] + +[[package]] +name = "aws-sig-auth" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6126c4ff918e35fb9ae1bf2de71157fad36f0cc6a2b1d0f7197ee711713700fc" +dependencies = [ + "aws-sigv4", + "aws-smithy-http", + "aws-types", + "http", + "tracing", +] + +[[package]] +name = "aws-sigv4" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c7f88d7395f5411c6eef5889b6cd577ce6b677af461356cbfc20176c26c160" +dependencies = [ + "aws-smithy-http", + "form_urlencoded", + "hex", + "hmac", + "http", + "once_cell", + "percent-encoding", + "regex", + "sha2", + "time", + "tracing", +] + +[[package]] +name = "aws-smithy-async" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e6a895d68852dd1564328e63ef1583e5eb307dd2a5ebf35d862a5c402957d5e" +dependencies = [ + "futures-util", + "pin-project-lite", + "tokio", + "tokio-stream", +] + +[[package]] +name = "aws-smithy-client" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f505bf793eb3e6d7c166ef1275c27b4b2cd5361173fe950ac8e2cfc08c29a7ef" +dependencies = [ + "aws-smithy-async", + "aws-smithy-http", + "aws-smithy-http-tower", + "aws-smithy-types", + "bytes", + "fastrand", + "http", + "http-body", + "hyper", + "hyper-rustls", + "lazy_static", + "pin-project-lite", + "tokio", + "tower", + "tracing", +] + +[[package]] +name = "aws-smithy-http" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37e4b4304b7ea4af1af3e08535100eb7b6459d5a6264b92078bf85176d04ab85" +dependencies = [ + "aws-smithy-types", + "bytes", + "bytes-utils", + "futures-core", + "http", + "http-body", + "hyper", + "once_cell", + "percent-encoding", + "pin-project-lite", + "pin-utils", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "aws-smithy-http-tower" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e86072ecc4dc4faf3e2071144285cfd539263fe7102b701d54fb991eafb04af8" +dependencies = [ + "aws-smithy-http", + "aws-smithy-types", + "bytes", + "http", + "http-body", + "pin-project-lite", + "tower", + "tracing", +] + +[[package]] +name = "aws-smithy-json" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e3ddd9275b167bc59e9446469eca56177ec0b51225632f90aaa2cd5f41c940e" +dependencies = [ + "aws-smithy-types", +] + +[[package]] +name = "aws-smithy-query" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13b19d2e0b3ce20e460bad0d0d974238673100edebba6978c2c1aadd925602f7" +dependencies = [ + "aws-smithy-types", + "urlencoding", +] + +[[package]] +name = "aws-smithy-types" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "987b1e37febb9bd409ca0846e82d35299e572ad8279bc404778caeb5fc05ad56" +dependencies = [ + "base64-simd", + "itoa 1.0.2", + "num-integer", + "ryu", + "time", +] + +[[package]] +name = "aws-smithy-xml" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37ce3791e14eec75ffac851a5a559f1ce6b31843297f42cc8bfba82714a6a5d8" +dependencies = [ + "xmlparser", +] + +[[package]] +name = "aws-types" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c05adca3e2bcf686dd2c47836f216ab52ed7845c177d180c84b08522c1166a3" +dependencies = [ + "aws-smithy-async", + "aws-smithy-client", + "aws-smithy-http", + "aws-smithy-types", + "http", + "rustc_version 0.4.0", + "tracing", + "zeroize", +] + [[package]] name = "base64" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +[[package]] +name = "base64-simd" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "781dd20c3aff0bd194fe7d2a977dd92f21c173891f3a03b677359e5fa457e5d5" +dependencies = [ + "simd-abstraction", +] + [[package]] name = "bitflags" version = "1.3.2" @@ -217,6 +497,16 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" +[[package]] +name = "bytes-utils" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e47d3a8076e283f3acd27400535992edb3ba4b5bb72f8891ad8fbe7932a7d4b9" +dependencies = [ + "bytes", + "either", +] + [[package]] name = "cairo-rs" version = "0.15.12" @@ -618,6 +908,7 @@ checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -736,7 +1027,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1203,6 +1494,25 @@ dependencies = [ "syn", ] +[[package]] +name = "h2" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1254,6 +1564,15 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "html5ever" version = "0.25.2" @@ -1279,12 +1598,75 @@ dependencies = [ "itoa 1.0.2", ] +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + [[package]] name = "http-range" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21dec9db110f5f872ed9699c3ecf50cf16f423502706ba5c72462e28d3157573" +[[package]] +name = "httparse" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa 1.0.2", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +dependencies = [ + "http", + "hyper", + "log", + "rustls", + "rustls-native-certs", + "tokio", + "tokio-rustls", + "webpki-roots", +] + [[package]] name = "ico" version = "0.1.0" @@ -1682,7 +2064,7 @@ dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -1931,7 +2313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f23a407004a1033f53e93f9b45580d14de23928faad187384f891507c9b0c045" dependencies = [ "pathdiff", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -2000,6 +2382,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "outref" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f222829ae9293e33a9f5e9f440c6760a3d450a64affe1846486b140db81c1f4" + [[package]] name = "pango" version = "0.15.10" @@ -2076,7 +2464,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -2589,6 +2977,18 @@ dependencies = [ "webpki", ] +[[package]] +name = "rustls-native-certs" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +dependencies = [ + "openssl-probe", + "rustls-pemfile", + "schannel", + "security-framework", +] + [[package]] name = "rustls-pemfile" version = "1.0.1" @@ -2632,7 +3032,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] @@ -2880,6 +3280,15 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f054c6c1a6e95179d6f23ed974060dcefb2d9388bb7256900badad682c499de4" +[[package]] +name = "simd-abstraction" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cadb29c57caadc51ff8346233b5cec1d240b68ce55cf1afc764818791876987" +dependencies = [ + "outref", +] + [[package]] name = "siphasher" version = "0.3.10" @@ -3141,6 +3550,12 @@ dependencies = [ "syn", ] +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + [[package]] name = "syn" version = "1.0.98" @@ -3514,9 +3929,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.20.1" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg", "bytes", @@ -3524,13 +3939,12 @@ dependencies = [ "memchr", "mio", "num_cpus", - "once_cell", "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -3566,6 +3980,20 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-util" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.9" @@ -3575,6 +4003,34 @@ dependencies = [ "serde", ] +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + [[package]] name = "tracing" version = "0.1.36" @@ -3582,6 +4038,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" dependencies = [ "cfg-if", + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3646,6 +4103,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typenum" version = "1.15.0" @@ -3710,6 +4173,12 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" + [[package]] name = "utf-8" version = "0.7.6" @@ -3798,6 +4267,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -4104,12 +4583,33 @@ dependencies = [ "windows_x86_64_msvc 0.36.1", ] +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + [[package]] name = "windows-tokens" version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3263d25f1170419995b78ff10c06b949e8a986c35c208dc24333c64753a87169" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.32.0" @@ -4128,6 +4628,12 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.24.0" @@ -4152,6 +4658,12 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.24.0" @@ -4176,6 +4688,12 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.24.0" @@ -4200,6 +4718,18 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.24.0" @@ -4224,6 +4754,12 @@ version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winreg" version = "0.10.1" @@ -4320,3 +4856,15 @@ name = "xml-rs" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + +[[package]] +name = "xmlparser" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25c75bf9ea12c4040a97f829154768bbbce366287e2dc044af160cd79a13fd" + +[[package]] +name = "zeroize" +version = "1.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c792a56..7a7fdd7 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -23,6 +23,10 @@ tokio = { version = ">=1.19", features = ["full"] } sqlx = { version = "0.6.2", features = ["sqlite", "runtime-tokio-rustls"] } netstat2 = "0.9.1" sysinfo = "0.26.8" +aws-types = "0.52.0" +aws-sdk-sts = "0.22.0" +aws-smithy-types = "0.52.0" +aws-config = "0.52.0" [features] # by default Tauri runs in production mode diff --git a/src-tauri/src/clientinfo.rs b/src-tauri/src/clientinfo.rs index a0dbc03..2285dc9 100644 --- a/src-tauri/src/clientinfo.rs +++ b/src-tauri/src/clientinfo.rs @@ -36,7 +36,7 @@ pub fn get_clients(local_port: u16) -> Result, ClientInfoError> { let mut clients = Vec::new(); let mut sys = System::new(); for p in get_associated_pids(local_port)? { - let pid = Pid::from(p as usize); + let pid = Pid::from(p as i32); sys.refresh_process(pid); let proc = sys.process(pid) .ok_or(ClientInfoError::PidNotFound)?; diff --git a/src-tauri/src/errors.rs b/src-tauri/src/errors.rs index 5bbdd73..5abd6e4 100644 --- a/src-tauri/src/errors.rs +++ b/src-tauri/src/errors.rs @@ -58,6 +58,8 @@ pub enum RequestError { RequestTooLarge, NoCredentials(GetCredentialsError), ClientInfo(ClientInfoError), + Tauri(tauri::Error), + NoMainWindow, } impl From for RequestError { fn from(e: std::io::Error) -> RequestError { @@ -79,6 +81,11 @@ impl From for RequestError { RequestError::ClientInfo(e) } } +impl From for RequestError { + fn from(e: tauri::Error) -> RequestError { + RequestError::Tauri(e) + } +} impl Display for RequestError { fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> { @@ -92,6 +99,8 @@ impl Display for RequestError { NoCredentials(GetCredentialsError::Empty) => write!(f, "Received go-ahead but no credentials are known"), ClientInfo(ClientInfoError::PidNotFound) => write!(f, "Could not resolve PID of client process."), ClientInfo(ClientInfoError::NetstatError(e)) => write!(f, "Error getting client socket details: {e}"), + Tauri(e) => write!(f, "Tauri error: {e}"), + NoMainWindow => write!(f, "No main application window found"), } } } @@ -102,6 +111,26 @@ pub enum GetCredentialsError { Empty, } +pub type AwsTokenError = aws_sdk_sts::types::SdkError; + +pub enum GetSessionError { + NoCredentials, // SDK returned successfully but credentials are None + SdkError(AwsTokenError), +} +impl From for GetSessionError { + fn from(e: AwsTokenError) -> GetSessionError { + GetSessionError::SdkError(e) + } +} +impl Display for GetSessionError { + fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> { + match self { + GetSessionError::NoCredentials => write!(f, "Request completed successfully but no credentials were returned"), + GetSessionError::SdkError(e) => write!(f, "Error response from AWS: {e}") + } + } +} + pub enum UnlockError { NotLocked, @@ -109,6 +138,7 @@ pub enum UnlockError { BadPassphrase, InvalidUtf8, // Somehow we got invalid utf-8 even though decryption succeeded DbError(SqlxError), + GetSession(GetSessionError), } impl From for UnlockError { fn from (e: SqlxError) -> UnlockError { @@ -118,6 +148,11 @@ impl From for UnlockError { } } } +impl From for UnlockError { + fn from(e: GetSessionError) -> UnlockError { + UnlockError::GetSession(e) + } +} impl Display for UnlockError { fn fmt(&self, f: &mut Formatter) -> Result<(), std::fmt::Error> { use UnlockError::*; @@ -127,6 +162,7 @@ impl Display for UnlockError { BadPassphrase => write!(f, "Invalid passphrase"), InvalidUtf8 => write!(f, "Decrypted data was corrupted"), DbError(e) => write!(f, "Database error: {e}"), + GetSession(e) => write!(f, "Failed to create AWS session: {e}") } } } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index d6b61f2..dd08289 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -10,7 +10,6 @@ mod clientinfo; mod ipc; mod state; mod server; -mod storage; fn main() { diff --git a/src-tauri/src/server.rs b/src-tauri/src/server.rs index 0bf9ea0..fccdd29 100644 --- a/src-tauri/src/server.rs +++ b/src-tauri/src/server.rs @@ -53,9 +53,11 @@ async fn handle(mut stream: TcpStream, app_handle: AppHandle) -> Result<(), Requ }; let clients = clientinfo::get_clients(peer_addr.port())?; - // Do we want to panic if this fails? Does that mean the frontend is dead? let req = Request {id: request_id, clients}; - app_handle.emit_all("credentials-request", req).unwrap(); + app_handle.emit_all("credentials-request", req)?; + let window = app_handle.get_window("main").ok_or(RequestError::NoMainWindow)?; + window.show()?; + window.set_focus()?; let mut buf = [0; 8192]; // it's what tokio's BufReader uses let mut n = 0; diff --git a/src-tauri/src/state.rs b/src-tauri/src/state.rs index 61fa307..14dc344 100644 --- a/src-tauri/src/state.rs +++ b/src-tauri/src/state.rs @@ -49,14 +49,6 @@ pub enum Session { } -// #[derive(Serialize, Deserialize)] -// pub enum SessionStatus { -// Unlocked, -// Locked, -// Empty, -// } - - pub struct AppState { pub session: RwLock, pub request_count: RwLock, @@ -110,7 +102,7 @@ impl AppState { Ok(Session::Locked(creds)) } - pub async fn save_creds(&self, creds: Credentials, passphrase: &str) -> Result<(), sqlx::error::Error> { + pub async fn save_creds(&self, creds: Credentials, passphrase: &str) -> Result<(), UnlockError> { let (key_id, secret_key) = match creds { Credentials::LongLived {access_key_id, secret_access_key} => { (access_key_id, secret_access_key) @@ -124,16 +116,21 @@ impl AppState { // not sure we need both salt AND nonce given that we generate a // fresh salt every time we encrypt, but better safe than sorry let nonce = secretbox::gen_nonce(); - let key_enc = secretbox::seal(secret_key.as_bytes(), &nonce, &key); + let secret_key_enc = secretbox::seal(secret_key.as_bytes(), &nonce, &key); - // insert into database - // eventually replace this with a temporary session - let mut session = self.session.write().unwrap(); - *session = Session::Unlocked(Credentials::LongLived { - access_key_id: key_id, - secret_access_key: secret_key, - }); + sqlx::query( + "INSERT INTO credentials (access_key_id, secret_key_enc, salt, nonce) + VALUES (?, ?, ?, ?)" + ) + .bind(&key_id) + .bind(&secret_key_enc) + .bind(&salt.0[0..]) + .bind(&nonce.0[0..]) + .execute(&self.pool) + .await?; + + self.new_session(&key_id, &secret_key).await?; Ok(()) } @@ -162,26 +159,27 @@ impl AppState { } pub async fn decrypt(&self, passphrase: &str) -> Result<(), UnlockError> { - let session = self.session.read().unwrap(); - let locked = match *session { - Session::Empty => {return Err(UnlockError::NoCredentials);}, - Session::Unlocked(_) => {return Err(UnlockError::NotLocked);}, - Session::Locked(ref c) => c, + let (key_id, secret) = { + // do this all in a block so rustc doesn't complain about holding a lock across an await + let session = self.session.read().unwrap(); + let locked = match *session { + Session::Empty => {return Err(UnlockError::NoCredentials);}, + Session::Unlocked(_) => {return Err(UnlockError::NotLocked);}, + Session::Locked(ref c) => c, + }; + + let mut key_buf = [0; secretbox::KEYBYTES]; + // pretty sure this only fails if we're out of memory + pwhash::derive_key_interactive(&mut key_buf, passphrase.as_bytes(), &locked.salt).unwrap(); + let decrypted = secretbox::open(&locked.secret_key_enc, &locked.nonce, &Key(key_buf)) + .map_err(|_e| UnlockError::BadPassphrase)?; + + let secret_str = String::from_utf8(decrypted).map_err(|_e| UnlockError::InvalidUtf8)?; + (locked.access_key_id.clone(), secret_str) }; - let mut key_buf = [0; secretbox::KEYBYTES]; - // pretty sure this only fails if we're out of memory - pwhash::derive_key_interactive(&mut key_buf, passphrase.as_bytes(), &locked.salt).unwrap(); - let decrypted = secretbox::open(&locked.secret_key_enc, &locked.nonce, &Key(key_buf)) - .map_err(|_e| UnlockError::BadPassphrase)?; + self.new_session(&key_id, &secret).await?; - let secret_str = String::from_utf8(decrypted).map_err(|_e| UnlockError::InvalidUtf8)?; - let mut session = self.session.write().unwrap(); - let creds = Credentials::LongLived { - access_key_id: locked.access_key_id.clone(), - secret_access_key: secret_str, - }; - *session = Session::Unlocked(creds); Ok(()) } @@ -193,4 +191,54 @@ impl AppState { Session::Empty => Err(GetCredentialsError::Empty), } } + + async fn new_session(&self, key_id: &str, secret_key: &str) -> Result<(), GetSessionError> { + let creds = aws_sdk_sts::Credentials::new( + key_id, + secret_key, + None, // token + None, // expiration + "creddy", // "provider name" apparently + ); + let config = aws_config::from_env() + .credentials_provider(creds) + .load() + .await; + + let client = aws_sdk_sts::Client::new(&config); + let resp = client.get_session_token() + .duration_seconds(43_200) + .send() + .await?; + + let aws_session = resp.credentials().ok_or(GetSessionError::NoCredentials)?; + + let access_key_id = aws_session.access_key_id() + .ok_or(GetSessionError::NoCredentials)? + .to_string(); + let secret_access_key = aws_session.secret_access_key() + .ok_or(GetSessionError::NoCredentials)? + .to_string(); + let token = aws_session.session_token() + .ok_or(GetSessionError::NoCredentials)? + .to_string(); + let expiration = aws_session.expiration() + .ok_or(GetSessionError::NoCredentials)? + .fmt(aws_smithy_types::date_time::Format::DateTime) + .unwrap(); // only fails if the d/t is out of range, which it can't be for this format + + let mut app_session = self.session.write().unwrap(); + let session_creds = Credentials::ShortLived { + access_key_id, + secret_access_key, + token, + expiration, + }; + + println!("Got new session:\n{}", serde_json::to_string(&session_creds).unwrap()); + + *app_session = Session::Unlocked(session_creds); + + Ok(()) + } } diff --git a/src-tauri/src/storage.rs b/src-tauri/src/storage.rs deleted file mode 100644 index 6e3a5b6..0000000 --- a/src-tauri/src/storage.rs +++ /dev/null @@ -1,42 +0,0 @@ -use sodiumoxide::crypto::{pwhash, secretbox}; - -use crate::state; - - -pub fn save(data: &str, passphrase: &str) { - let salt = pwhash::Salt([0; 32]); // yes yes, just for now - let mut kbuf = [0; secretbox::KEYBYTES]; - pwhash::derive_key_interactive(&mut kbuf, passphrase.as_bytes(), &salt) - .expect("Couldn't compute password hash. Are you out of memory?"); - let key = secretbox::Key(kbuf); - let nonce = secretbox::Nonce([0; 24]); // we don't care about e.g. replay attacks so this might be safe? - let encrypted = secretbox::seal(data.as_bytes(), &nonce, &key); - - //todo: store in a database, along with salt, nonce, and hash parameters - std::fs::write("credentials.enc", &encrypted).expect("Failed to write file."); - - //todo: key is automatically zeroed, but we should use 'zeroize' or something to zero out passphrase and data -} - - -// pub fn load(passphrase: &str) -> String { -// let salt = pwhash::Salt([0; 32]); -// let mut kbuf = [0; secretbox::KEYBYTES]; -// pwhash::derive_key_interactive(&mut kbuf, passphrase.as_bytes(), &salt) -// .expect("Couldn't compute password hash. Are you out of memory?"); -// let key = secretbox::Key(kbuf); -// let nonce = secretbox::Nonce([0; 24]); - -// let encrypted = std::fs::read("credentials.enc").expect("Failed to read file."); -// let decrypted = secretbox::open(&encrypted, &nonce, &key).expect("Failed to decrypt."); -// String::from_utf8(decrypted).expect("Invalid utf-8") -// } - -pub fn load(passphrase: &str) -> state::Credentials { - state::Credentials::ShortLived { - access_key_id: "ASIAZ7WSVLORKQI27QGB".to_string(), - secret_access_key: "blah".to_string(), - token: "gah".to_string(), - expiration: "2022-11-29T10:45:12Z".to_string(), - } -} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 8f71074..0187091 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -58,6 +58,7 @@ "fullscreen": false, "height": 600, "resizable": true, + "label": "main", "title": "Creddy", "width": 800 } diff --git a/src/views/Approve.svelte b/src/views/Approve.svelte index 187fb57..031398c 100644 --- a/src/views/Approve.svelte +++ b/src/views/Approve.svelte @@ -22,8 +22,16 @@ function deny() { dispatch('navigate', {target: 'ShowDenied'}); } + + function handleHotkey(event) { + if (event.shiftKey && (event.code === 'Enter' || event.code === 'NumpadEnter')) { + approve(); + } + } + +

An application would like to access your AWS credentials.