diff --git a/Cargo.lock b/Cargo.lock index 2050d2f..4872edc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,41 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "opaque-debug", -] - -[[package]] -name = "aes-gcm" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc3be92e19a7ef47457b8e6f90707e12b6ac5d20c6f3866584fa3be0787d839f" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - [[package]] name = "ahash" version = "0.8.3" @@ -139,6 +104,45 @@ version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +[[package]] +name = "asn1-rs" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" +dependencies = [ + "asn1-rs-derive", + "asn1-rs-impl", + "displaydoc", + "nom", + "num-traits", + "rusticata-macros", + "thiserror", + "time", +] + +[[package]] +name = "asn1-rs-derive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "synstructure", +] + +[[package]] +name = "asn1-rs-impl" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "assert_fs" version = "1.0.13" @@ -370,6 +374,12 @@ version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "bimap" version = "0.6.3" @@ -388,15 +398,6 @@ version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.7", -] - [[package]] name = "block-buffer" version = "0.9.0" @@ -485,40 +486,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - [[package]] name = "clap" version = "4.3.19" @@ -651,15 +618,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "ctr" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a232f92a03f37dd7d7dd2adc67166c77e9cd88de5b019b9a9eecfaeaf7bfd481" -dependencies = [ - "cipher", -] - [[package]] name = "curve25519-dalek" version = "3.2.0" @@ -673,20 +631,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "curve25519-dalek" -version = "4.0.0-rc.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d4ba9852b42210c7538b75484f9daa0655e9a3ac04f693747bb0f02cf3cfe16" -dependencies = [ - "cfg-if", - "fiat-crypto", - "packed_simd_2", - "platforms", - "subtle", - "zeroize", -] - [[package]] name = "data-encoding" version = "2.4.0" @@ -713,6 +657,20 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "der-parser" +version = "8.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" +dependencies = [ + "asn1-rs", + "displaydoc", + "nom", + "num-bigint", + "num-traits", + "rusticata-macros", +] + [[package]] name = "deranged" version = "0.3.7" @@ -754,7 +712,6 @@ checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", "crypto-common", - "subtle", ] [[package]] @@ -778,6 +735,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "displaydoc" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.27", +] + [[package]] name = "doc-comment" version = "0.3.3" @@ -817,7 +785,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ - "curve25519-dalek 3.2.0", + "curve25519-dalek", "ed25519", "rand 0.7.3", "serde", @@ -909,12 +877,6 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" -[[package]] -name = "fiat-crypto" -version = "0.1.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e825f6987101665dea6ec934c09ec6d721de7bc1bf92248e1d5810c8cd636b77" - [[package]] name = "float-cmp" version = "0.9.0" @@ -1020,6 +982,16 @@ dependencies = [ "syn 2.0.27", ] +[[package]] +name = "futures-rustls" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd3cf68c183738046838e300353e4716c674dc5e56890de4826801a6622a28" +dependencies = [ + "futures-io", + "rustls", +] + [[package]] name = "futures-sink" version = "0.3.28" @@ -1088,16 +1060,6 @@ dependencies = [ "wasi 0.11.0+wasi-snapshot-preview1", ] -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug", - "polyval", -] - [[package]] name = "gimli" version = "0.27.3" @@ -1369,12 +1331,6 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" -[[package]] -name = "libm" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc7aa29613bd6a620df431842069224d8bc9011086b1db4c0e0cd47fa03ec9a" - [[package]] name = "libp2p" version = "0.52.1" @@ -1395,12 +1351,12 @@ dependencies = [ "libp2p-identity", "libp2p-mdns", "libp2p-metrics", - "libp2p-noise", "libp2p-ping", "libp2p-relay", "libp2p-rendezvous", "libp2p-swarm", "libp2p-tcp", + "libp2p-tls", "libp2p-yamux", "multiaddr", "pin-project", @@ -1575,46 +1531,44 @@ dependencies = [ ] [[package]] -name = "libp2p-noise" +name = "libp2p-ping" version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87945db2b3f977af09b62b9aa0a5f3e4870995a577ecd845cdeba94cdf6bbca7" +checksum = "3cd5ee3270229443a2b34b27ed0cb7470ef6b4a6e45e54e89a8771fa683bab48" dependencies = [ - "bytes", - "curve25519-dalek 3.2.0", + "either", "futures", + "futures-timer", + "instant", "libp2p-core", "libp2p-identity", + "libp2p-swarm", "log", - "multiaddr", - "multihash", - "once_cell", - "quick-protobuf", "rand 0.8.5", - "sha2 0.10.7", - "snow", - "static_assertions", - "thiserror", - "x25519-dalek", - "zeroize", + "void", ] [[package]] -name = "libp2p-ping" -version = "0.43.0" +name = "libp2p-quic" +version = "0.9.0-alpha" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd5ee3270229443a2b34b27ed0cb7470ef6b4a6e45e54e89a8771fa683bab48" +checksum = "af35e582535de00bbac3d62412d53c1f07c80f1b6ea1451716b9e4ed5002498d" dependencies = [ - "either", + "async-std", + "bytes", "futures", "futures-timer", - "instant", + "if-watch", "libp2p-core", "libp2p-identity", - "libp2p-swarm", + "libp2p-tls", "log", + "parking_lot", + "quinn", "rand 0.8.5", - "void", + "rustls", + "thiserror", + "tokio", ] [[package]] @@ -1740,6 +1694,25 @@ dependencies = [ "tokio", ] +[[package]] +name = "libp2p-tls" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec63209ec17ffb354a5fdfde7c36f14d168367c5f115fdb5a177a342414d5a55" +dependencies = [ + "futures", + "futures-rustls", + "libp2p-core", + "libp2p-identity", + "rcgen", + "ring", + "rustls", + "thiserror", + "webpki", + "x509-parser", + "yasna", +] + [[package]] name = "libp2p-yamux" version = "0.44.0" @@ -1846,6 +1819,12 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" version = "0.7.1" @@ -2004,6 +1983,16 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -2020,6 +2009,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "num-bigint" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.16" @@ -2057,6 +2067,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "oid-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" +dependencies = [ + "asn1-rs", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -2085,16 +2104,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "packed_simd_2" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1914cd452d8fccd6f9db48147b29fd4ae05bea9dc5d9ad578509f72415de282" -dependencies = [ - "cfg-if", - "libm", -] - [[package]] name = "parking" version = "2.1.0" @@ -2130,6 +2139,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +[[package]] +name = "pem" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +dependencies = [ + "base64", +] + [[package]] name = "percent-encoding" version = "2.3.0" @@ -2174,12 +2192,6 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" -[[package]] -name = "platforms" -version = "3.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d7ddaed09e0eb771a79ab0fd64609ba0afb0a8366421957936ad14cbd13630" - [[package]] name = "polling" version = "2.8.0" @@ -2196,29 +2208,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -2327,6 +2316,56 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "quinn" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cc2c5017e4b43d5995dcea317bc46c1e09404c0a9664d2908f7f02dfe943d75" +dependencies = [ + "async-io", + "async-std", + "bytes", + "futures-io", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8c8bb234e70c863204303507d841e7fa2295e95c822b2bb4ca8ebf57f17b1cb" +dependencies = [ + "bytes", + "rand 0.8.5", + "ring", + "rustc-hash", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6df19e284d93757a9fb91d63672f7741b129246a669db09d1c0063071debc0c0" +dependencies = [ + "bytes", + "libc", + "socket2 0.5.3", + "tracing", + "windows-sys 0.48.0", +] + [[package]] name = "quote" version = "1.0.32" @@ -2407,6 +2446,18 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rcgen" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +dependencies = [ + "pem", + "ring", + "time", + "yasna", +] + [[package]] name = "redox_syscall" version = "0.2.16" @@ -2542,12 +2593,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] -name = "rustc_version" -version = "0.4.0" +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rusticata-macros" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "faf0c4a6ece9950b9abdb62b1cfcf2a68b3b67a10ba445b3bb85be2a293d0632" dependencies = [ - "semver", + "nom", ] [[package]] @@ -2577,6 +2634,28 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "rustls" +version = "0.21.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rw-stream-sink" version = "0.4.0" @@ -2611,7 +2690,7 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scs" -version = "0.1.3" +version = "0.1.4" dependencies = [ "anyhow", "assert_fs", @@ -2622,6 +2701,7 @@ dependencies = [ "futures", "futures-timer", "libp2p", + "libp2p-quic", "libp2p-request-response", "predicates", "rand 0.8.5", @@ -2637,10 +2717,14 @@ dependencies = [ ] [[package]] -name = "semver" -version = "1.0.18" +name = "sct" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] [[package]] name = "serde" @@ -2792,23 +2876,6 @@ dependencies = [ "futures-lite", ] -[[package]] -name = "snow" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ccba027ba85743e09d15c03296797cad56395089b832b48b5a5217880f57733" -dependencies = [ - "aes-gcm", - "blake2", - "chacha20poly1305", - "curve25519-dalek 4.0.0-rc.1", - "rand_core 0.6.4", - "ring", - "rustc_version", - "sha2 0.10.7", - "subtle", -] - [[package]] name = "socket2" version = "0.4.9" @@ -2875,6 +2942,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "synstructure" +version = "0.12.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", + "unicode-xid", +] + [[package]] name = "system-configuration" version = "0.5.1" @@ -3159,14 +3238,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] -name = "universal-hash" -version = "0.4.0" +name = "unicode-xid" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" -dependencies = [ - "generic-array", - "subtle", -] +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" [[package]] name = "unsafe-libyaml" @@ -3335,6 +3410,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "widestring" version = "1.0.2" @@ -3558,14 +3643,20 @@ dependencies = [ ] [[package]] -name = "x25519-dalek" -version = "1.1.1" +name = "x509-parser" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" +checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" dependencies = [ - "curve25519-dalek 3.2.0", - "rand_core 0.5.1", - "zeroize", + "asn1-rs", + "data-encoding", + "der-parser", + "lazy_static", + "nom", + "oid-registry", + "rusticata-macros", + "thiserror", + "time", ] [[package]] @@ -3594,6 +3685,15 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "yasna" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17bb3549cc1321ae1296b9cdc2698e2b6cb1992adfa19a8c72e5b7a738f44cd" +dependencies = [ + "time", +] + [[package]] name = "zeroize" version = "1.6.0" diff --git a/README.md b/README.md index f9acb71..fb605b7 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Share anything with teammates across machines via CLI. Share is a tool for secur - [Signed Certs](#signed-certificate) - [Seed Key](#seeds-seed-key) - [Recipient Info](#saving-peer-info) +- [Storage](#items-storage-location) - [Update](#update) - [Roadmap](#roadmap) - [Contributing](#contributing) @@ -179,7 +180,11 @@ To see all saved peers: ```sh scs list ``` - +# Items Storage Location +Items sent (secrets, files and messages) are stored in the local folder on the machine. To find the saved items: +- Windows: `/c/Users//AppData/Local/onboardbase/secureshare/data` +- Linux: `/home//.local/share/secureshare` +- Mac: # Contributing Contributions of any kind are welcome! See the [contributing guide](contributing.md). @@ -192,7 +197,7 @@ Contributions of any kind are welcome! See the [contributing guide](contributing - [ ] Allow to always listen to specific addresses for an accessible data flow. ### Protocols -- [ ] Support QUIC. Use QUIC as default and fall back to TCP +- [x] Support QUIC. Use QUIC as default and fall back to TCP - [ ] AutoNat: If you look closely, `scs` assumes both peers are behind NATs, firewalls, or proxies. But sometimes, this might not be the case, and it is excessive to hole punch just for that. Implementing `AutoNat` will first check if the two peers can communicate directly. If not, it will then proceed to hole punch. With TCP, this might take about 3 to 10 seconds, and this is where QUIC comes in and improves upon `scs`'s speed. # License diff --git a/npm/package.json b/npm/package.json index 00c7701..200ad57 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "@onboardbase/secure-share", - "version": "0.1.3", + "version": "0.1.4", "description": "Share anything with teammates across machines via CLI", "scripts": { "test": "jest", diff --git a/share/Cargo.toml b/share/Cargo.toml index f8fc83f..2cbed98 100644 --- a/share/Cargo.toml +++ b/share/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "scs" -version = "0.1.3" +version = "0.1.4" edition = "2021" default-run = "scs" description = "Open source p2p share for devs to share anything with teammates across machines securely." @@ -24,7 +24,7 @@ serde_json = "1.0.100" serde = { version = "1.0.166", features = ["derive"] } futures = "0.3.28" futures-timer = "3.0" -libp2p = { version = "0.52.1", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux"] } +libp2p = { version = "0.52.1", features = ["async-std", "dns", "dcutr", "identify", "macros", "ping", "relay", "rendezvous", "tcp", "tokio", "yamux", "tls"] } rand = "0.8" request_response = {version = "0.25.0", package = "libp2p-request-response", features = ["json"] } directories-next = "2.0.0" @@ -33,6 +33,7 @@ serde_yaml = "0.9.24" rusqlite = { version = "0.29.0", features = ["bundled"] } time = { version = "0.3.25", features = ["parsing"]} dialoguer = "0.10.4" +quic = { version = "0.9.0-alpha", package = "libp2p-quic", features = ["tokio", "async-std"] } [dev-dependencies] assert_fs = "1.0.13" diff --git a/share/src/database/peer.rs b/share/src/database/peer.rs index 1a9e74c..0705c2e 100644 --- a/share/src/database/peer.rs +++ b/share/src/database/peer.rs @@ -121,6 +121,8 @@ mod tests { use anyhow::Result; use libp2p::{Multiaddr, PeerId}; + use crate::database::Store; + use super::ScsPeer; #[test] @@ -146,4 +148,21 @@ mod tests { let peer_id = peer.peer_id(); assert!(peer_id.is_err()); } + + #[test] + fn create_peer() -> Result<()> { + let db_path = assert_fs::NamedTempFile::new("scs_peer.db3")?; + let store = Store::initialize(Some(db_path.path().to_path_buf()))?; + + let addr: Multiaddr = "/ip4/127.0.0.1/udp/38404/quic-v1".parse().unwrap(); + let peer_id = PeerId::random(); + let name = "kasali".to_string(); + + let peer = ScsPeer::from((&addr, name, peer_id)); + peer.save(&store)?; + + let found_peer = ScsPeer::get_by_peer_id(PeerId::random().to_string(), &store)?; + assert_eq!(found_peer, None); + Ok(()) + } } diff --git a/share/src/main.rs b/share/src/main.rs index 826654a..79a7803 100644 --- a/share/src/main.rs +++ b/share/src/main.rs @@ -16,7 +16,7 @@ mod network; #[derive(Parser, Debug)] #[command(name = "scs")] #[command(author = "Onboardbase. ")] -#[command(version = "0.1.3")] +#[command(version = "0.1.4")] #[command(about = "Share anything with teammates across machines via CLI.", long_about = None)] pub struct Cli { /// Separated list of secrets to share. Key-Value pair is seperated by a comma. "my_key,my_value" diff --git a/share/src/network/hole_puncher.rs b/share/src/network/hole_puncher.rs index 6c08c49..2d1181e 100644 --- a/share/src/network/hole_puncher.rs +++ b/share/src/network/hole_puncher.rs @@ -10,17 +10,19 @@ use crate::network::request::make_request; use crate::network::{get_behaviour, ConnectionDetails, Event}; use crate::{config::Config, Mode}; use anyhow::Result; +use futures::future::Either; use futures::{ executor::{block_on, ThreadPool}, stream::StreamExt, FutureExt, }; +use libp2p::tls; use libp2p::{ core::{muxing::StreamMuxerBox, upgrade}, dns::DnsConfig, identify, identity, multiaddr::Protocol, - noise, relay, + relay, swarm::{SwarmBuilder, SwarmEvent}, tcp, yamux, Multiaddr, PeerId, Transport, }; @@ -34,7 +36,7 @@ pub fn punch( store: Store, ) -> Result<()> { let relay_address: Multiaddr = - "/ip4/157.245.40.97/tcp/4001/p2p/12D3KooWDpJ7As7BWAwRMfu1VU2WCqNjvq387JEYKDBj4kx6nXTN" + "/ip4/157.245.40.97/tcp/3456/p2p/12D3KooWJodhq2Ctxot893Uv3TzzaCoYW7jQrk5Tyfc1vKYFE4Ag" .to_string() .parse() .unwrap(); @@ -47,18 +49,25 @@ pub fn punch( //intitate relay client connection let (relay_transport, client) = relay::client::new(local_peer_id); + let transport = { let relay_tcp_quic_transport = relay_transport .or_transport(tcp::async_io::Transport::new( tcp::Config::default().port_reuse(true), )) .upgrade(upgrade::Version::V1) - .authenticate(noise::Config::new(&local_key).unwrap()) - .multiplex(yamux::Config::default()); + .authenticate(tls::Config::new(&local_key).unwrap()) + .multiplex(yamux::Config::default()) + .or_transport(quic::async_std::Transport::new(quic::Config::new( + &local_key, + ))); block_on(DnsConfig::system(relay_tcp_quic_transport)) .unwrap() - .map(|either_output, _| (either_output.0, StreamMuxerBox::new(either_output.1))) + .map(|either_output, _| match either_output { + Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), + Either::Right((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), + }) .boxed() }; @@ -69,6 +78,9 @@ pub fn punch( } .build(); + swarm + .listen_on(format!("/ip4/0.0.0.0/udp/{port}/quic-v1").parse().unwrap()) + .unwrap(); swarm .listen_on(format!("/ip4/0.0.0.0/tcp/{port}").parse().unwrap()) .unwrap(); @@ -225,6 +237,5 @@ pub fn punch( fn generate_ed25519(mut secret_key_seed: String) -> identity::Keypair { let bytes = unsafe { secret_key_seed.as_bytes_mut() }; - println!("{}", bytes.len()); identity::Keypair::ed25519_from_bytes(bytes).expect("only errors on wrong length") }