diff --git a/Cargo.lock b/Cargo.lock index c6f43ed..9137f2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -61,6 +61,21 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse 0.2.7", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + [[package]] name = "anstream" version = "1.0.0" @@ -68,7 +83,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "824a212faf96e9acacdbd09febd34438f8f711fb84e09a8916013cd7815ca28d" dependencies = [ "anstyle", - "anstyle-parse", + "anstyle-parse 1.0.0", "anstyle-query", "anstyle-wincon", "colorchoice", @@ -82,6 +97,15 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "940b3a0ca603d1eade50a4846a2afffd5ef57a9feac2c0e2ec2e14f9ead76000" +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + [[package]] name = "anstyle-parse" version = "1.0.0" @@ -183,6 +207,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base32" version = "0.5.1" @@ -221,6 +251,15 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.11.0" @@ -323,7 +362,7 @@ version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "714a53001bf66416adb0e2ef5ac857140e7dc3a0c48fb28b2f10762fc4b5069f" dependencies = [ - "anstream", + "anstream 1.0.0", "anstyle", "clap_lex", "strsim", @@ -372,6 +411,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + [[package]] name = "const-oid" version = "0.10.2" @@ -458,6 +503,18 @@ version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.7" @@ -486,6 +543,22 @@ dependencies = [ "cipher", ] +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest 0.10.7", + "fiat-crypto 0.2.9", + "rustc_version", + "subtle", + "zeroize", +] + [[package]] name = "curve25519-dalek" version = "5.0.0-pre.1" @@ -495,9 +568,9 @@ dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "rand_core", + "digest 0.11.0-rc.10", + "fiat-crypto 0.3.0", + "rand_core 0.9.5", "rustc_version", "serde", "subtle", @@ -556,14 +629,24 @@ version = "2.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid 0.9.6", + "zeroize", +] + [[package]] name = "der" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71fd89660b2dc699704064e59e9dba0147b903e85319429e131620d022be411b" dependencies = [ - "const-oid", - "pem-rfc7468", + "const-oid 0.10.2", + "pem-rfc7468 1.0.0", "zeroize", ] @@ -636,17 +719,50 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab03c107fafeb3ee9f5925686dbb7a73bc76e3932abb0d2b365cb64b169cf04c" +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid 0.9.6", + "crypto-common 0.1.7", + "subtle", +] + [[package]] name = "digest" version = "0.11.0-rc.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "afa94b64bfc6549e6e4b5a3216f22593224174083da7a90db47e951c4fb31725" dependencies = [ - "block-buffer", - "const-oid", + "block-buffer 0.11.0", + "const-oid 0.10.2", "crypto-common 0.2.1", ] +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + [[package]] name = "dispatch2" version = "0.3.1" @@ -711,11 +827,12 @@ dependencies = [ "duct", "hex", "iroh", + "iroh-persist", "iroh-tickets", "n0-error", "nix", "noq", - "rand", + "rand 0.9.2", "tempfile", "tokio", "tokio-util", @@ -723,15 +840,53 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der 0.7.10", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature 2.2.0", + "spki 0.7.3", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8 0.10.2", + "signature 2.2.0", +] + [[package]] name = "ed25519" version = "3.0.0-rc.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c6e914c7c52decb085cea910552e24c63ac019e3ab8bf001ff736da9a9d9d890" dependencies = [ - "pkcs8", + "pkcs8 0.11.0-rc.11", + "serde", + "signature 3.0.0-rc.10", +] + +[[package]] +name = "ed25519-dalek" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70e796c081cee67dc755e1a36a0a172b897fab85fc3f6bc48307991f64e4eca9" +dependencies = [ + "curve25519-dalek 4.1.3", + "ed25519 2.2.3", "serde", - "signature", + "sha2 0.10.9", + "subtle", + "zeroize", ] [[package]] @@ -740,12 +895,31 @@ version = "3.0.0-pre.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad207ed88a133091f83224265eac21109930db09bedcad05d5252f2af2de20a1" dependencies = [ - "curve25519-dalek", - "ed25519", - "rand_core", + "curve25519-dalek 5.0.0-pre.1", + "ed25519 3.0.0-rc.4", + "rand_core 0.9.5", "serde", - "sha2", - "signature", + "sha2 0.11.0-rc.2", + "signature 3.0.0-rc.10", + "subtle", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sec1", "subtle", "zeroize", ] @@ -785,6 +959,27 @@ dependencies = [ "syn", ] +[[package]] +name = "env_filter" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a1c3cc8e57274ec99de65301228b537f1e4eedc1b8e0f9411c6caac8ae7308f" +dependencies = [ + "log", +] + +[[package]] +name = "env_logger" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2daee4ea451f429a58296525ddf28b45a3b64f1acf6587e2067437bb11e218d" +dependencies = [ + "anstream 0.6.21", + "anstyle", + "env_filter", + "log", +] + [[package]] name = "equivalent" version = "1.0.2" @@ -809,7 +1004,7 @@ checksum = "4e7f34442dbe69c60fe8eaf58a8cafff81a1f278816d8ab4db255b3bef4ac3c4" dependencies = [ "getrandom 0.3.4", "libm", - "rand", + "rand 0.9.2", "siphasher", ] @@ -819,6 +1014,22 @@ version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + [[package]] name = "fiat-crypto" version = "0.3.0" @@ -995,6 +1206,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1061,6 +1273,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "h2" version = "0.4.13" @@ -1154,7 +1377,7 @@ dependencies = [ "idna", "ipnet", "once_cell", - "rand", + "rand 0.9.2", "ring", "rustls", "thiserror 2.0.18", @@ -1178,7 +1401,7 @@ dependencies = [ "moka", "once_cell", "parking_lot", - "rand", + "rand 0.9.2", "resolv-conf", "rustls", "smallvec", @@ -1188,6 +1411,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "http" version = "1.4.0" @@ -1508,7 +1740,7 @@ dependencies = [ "cfg_aliases", "data-encoding", "derive_more", - "ed25519-dalek", + "ed25519-dalek 3.0.0-pre.1", "futures-util", "getrandom 0.3.4", "hickory-resolver", @@ -1527,9 +1759,9 @@ dependencies = [ "papaya", "pin-project", "pkarr", - "pkcs8", + "pkcs8 0.11.0-rc.11", "portable-atomic", - "rand", + "rand 0.9.2", "reqwest", "rustc-hash", "rustls", @@ -1555,15 +1787,15 @@ version = "0.97.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55a354e3396b62c14717ee807dfee9a7f43f6dad47e4ac0fd1d49f1ffad14ef0" dependencies = [ - "curve25519-dalek", + "curve25519-dalek 5.0.0-pre.1", "data-encoding", "derive_more", - "digest", - "ed25519-dalek", + "digest 0.11.0-rc.10", + "ed25519-dalek 3.0.0-pre.1", "n0-error", - "rand_core", + "rand_core 0.9.5", "serde", - "sha2", + "sha2 0.11.0-rc.2", "url", "zeroize", "zeroize_derive", @@ -1597,6 +1829,23 @@ dependencies = [ "syn", ] +[[package]] +name = "iroh-persist" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222e4c81746dd5d98bb3de94233a37014e53714ef72149c6a0b68f08475a9901" +dependencies = [ + "dirs", + "ed25519-dalek 2.2.0", + "iroh", + "n0-error", + "rand 0.9.2", + "ssh-key", + "test-log", + "tokio", + "tracing", +] + [[package]] name = "iroh-relay" version = "0.97.0" @@ -1625,7 +1874,7 @@ dependencies = [ "pin-project", "pkarr", "postcard", - "rand", + "rand 0.9.2", "reqwest", "rustls", "rustls-pki-types", @@ -1707,6 +1956,9 @@ name = "lazy_static" version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin 0.9.8", +] [[package]] name = "leb128fmt" @@ -1726,6 +1978,15 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" +[[package]] +name = "libredox" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" +dependencies = [ + "libc", +] + [[package]] name = "linux-raw-sys" version = "0.12.1" @@ -2042,7 +2303,7 @@ dependencies = [ "getrandom 0.3.4", "identity-hash", "lru-slab", - "rand", + "rand 0.9.2", "ring", "rustc-hash", "rustls", @@ -2093,12 +2354,48 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.5", + "smallvec", + "zeroize", +] + [[package]] name = "num-conv" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2106,6 +2403,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -2220,6 +2518,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + [[package]] name = "os_pipe" version = "1.2.3" @@ -2230,6 +2534,44 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2 0.10.9", +] + +[[package]] +name = "p384" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe42f1670a52a47d448f14b6a5c61dd78fce51856e68edaa38f7ae3a46b8d6b6" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2 0.10.9", +] + +[[package]] +name = "p521" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc9e2161f1f215afdfce23677034ae137bbd45016a880c2eb3ba8eb95f085b2" +dependencies = [ + "base16ct", + "ecdsa", + "elliptic-curve", + "primeorder", + "rand_core 0.6.4", + "sha2 0.10.9", +] + [[package]] name = "papaya" version = "0.2.3" @@ -2275,6 +2617,15 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "pem-rfc7468" version = "1.0.0" @@ -2342,7 +2693,7 @@ dependencies = [ "bytes", "cfg_aliases", "document-features", - "ed25519-dalek", + "ed25519-dalek 3.0.0-pre.1", "getrandom 0.4.2", "ntimestamp", "self_cell", @@ -2351,14 +2702,35 @@ dependencies = [ "thiserror 2.0.18", ] +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der 0.7.10", + "pkcs8 0.10.2", + "spki 0.7.3", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der 0.7.10", + "spki 0.7.3", +] + [[package]] name = "pkcs8" version = "0.11.0-rc.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12922b6296c06eb741b02d7b5161e3aaa22864af38dfa025a1a3ba3f68c84577" dependencies = [ - "der", - "spki", + "der 0.8.0", + "spki 0.8.0-rc.4", ] [[package]] @@ -2454,6 +2826,15 @@ dependencies = [ "syn", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-crate" version = "3.5.0" @@ -2510,7 +2891,7 @@ dependencies = [ "bytes", "getrandom 0.3.4", "lru-slab", - "rand", + "rand 0.9.2", "ring", "rustc-hash", "rustls", @@ -2557,14 +2938,34 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + [[package]] name = "rand" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" dependencies = [ - "rand_chacha", - "rand_core", + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", ] [[package]] @@ -2574,7 +2975,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", ] [[package]] @@ -2595,6 +3005,17 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + [[package]] name = "regex-automata" version = "0.4.14" @@ -2659,6 +3080,16 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e061d1b48cb8d38042de4ae0a7a6401009d6143dc80d2e2d6f31f0bdd6470c7" +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.17.14" @@ -2673,6 +3104,27 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid 0.9.6", + "digest 0.10.7", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8 0.10.2", + "rand_core 0.6.4", + "sha2 0.10.9", + "signature 2.2.0", + "spki 0.7.3", + "subtle", + "zeroize", +] + [[package]] name = "rustc-hash" version = "2.1.1" @@ -2818,6 +3270,20 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der 0.7.10", + "generic-array", + "pkcs8 0.10.2", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" version = "3.7.0" @@ -2934,6 +3400,17 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + [[package]] name = "sha2" version = "0.11.0-rc.2" @@ -2942,7 +3419,7 @@ checksum = "d1e3878ab0f98e35b2df35fe53201d088299b41a6bb63e3e34dada2ac4abd924" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.11.0-rc.10", ] [[package]] @@ -3002,6 +3479,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + [[package]] name = "signature" version = "3.0.0-rc.10" @@ -3093,6 +3580,16 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5fe4ccb98d9c292d56fec89a5e07da7fc4cf0dc11e156b41793132775d3e591" +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der 0.7.10", +] + [[package]] name = "spki" version = "0.8.0-rc.4" @@ -3100,7 +3597,49 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8baeff88f34ed0691978ec34440140e1572b68c7dd4a495fd14a3dc1944daa80" dependencies = [ "base64ct", - "der", + "der 0.8.0", +] + +[[package]] +name = "ssh-cipher" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "caac132742f0d33c3af65bfcde7f6aa8f62f0e991d80db99149eb9d44708784f" +dependencies = [ + "cipher", + "ssh-encoding", +] + +[[package]] +name = "ssh-encoding" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb9242b9ef4108a78e8cd1a2c98e193ef372437f8c22be363075233321dd4a15" +dependencies = [ + "base64ct", + "pem-rfc7468 0.7.0", + "sha2 0.10.9", +] + +[[package]] +name = "ssh-key" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b86f5297f0f04d08cabaa0f6bff7cb6aec4d9c3b49d87990d63da9d9156a8c3" +dependencies = [ + "ed25519-dalek 2.2.0", + "p256", + "p384", + "p521", + "rand_core 0.6.4", + "rsa", + "sec1", + "sha2 0.10.9", + "signature 2.2.0", + "ssh-cipher", + "ssh-encoding", + "subtle", + "zeroize", ] [[package]] @@ -3192,6 +3731,28 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "test-log" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37d53ac171c92a39e4769491c4b4dde7022c60042254b5fc044ae409d34a24d4" +dependencies = [ + "env_logger", + "test-log-macros", + "tracing-subscriber", +] + +[[package]] +name = "test-log-macros" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be35209fd0781c5401458ab66e4f98accf63553e8fae7425503e92fdd319783b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "thiserror" version = "1.0.69" @@ -3377,7 +3938,7 @@ dependencies = [ "getrandom 0.3.4", "http", "httparse", - "rand", + "rand 0.9.2", "ring", "rustls-pki-types", "simdutf8", diff --git a/Cargo.toml b/Cargo.toml index 940d674..61fd687 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,6 +18,7 @@ clap = { version = "4.4.10", features = ["derive"] } hex = "0.4.3" iroh = { version = "0.97", default-features = false } iroh-tickets = { version = "0.4" } +iroh-persist = "0.1.6" noq = "0.17" rand = "0.9.2" tokio = { version = "1.34.0", features = ["full"] } diff --git a/src/main.rs b/src/main.rs index 8c50b5b..a6efe06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,7 +2,7 @@ use std::{ io, net::{SocketAddr, SocketAddrV4, SocketAddrV6, ToSocketAddrs}, - str::FromStr, + path::PathBuf, time::Duration, }; @@ -12,18 +12,18 @@ use iroh::{ endpoint::{presets, Accepting}, Endpoint, EndpointAddr, SecretKey, }; +use iroh_persist::KeyRetriever; use n0_error::{bail_any, ensure_any, AnyError, Result, StdResultExt}; + +#[cfg(unix)] +use tokio::net::{UnixListener, UnixStream}; + use tokio::{ io::{AsyncRead, AsyncWrite, AsyncWriteExt}, select, time::timeout, }; use tokio_util::sync::CancellationToken; -#[cfg(unix)] -use { - std::path::PathBuf, - tokio::net::{UnixListener, UnixStream}, -}; const ONLINE_TIMEOUT: Duration = Duration::from_secs(5); @@ -39,6 +39,11 @@ const ONLINE_TIMEOUT: Duration = Duration::from_secs(5); /// For all subcommands, you can specify a secret key using the IROH_SECRET /// environment variable. If you don't, a random one will be generated. /// +/// For all subcommands, you can specify that the generated key should be +/// persisted at either a default location or a explicitly given file. In that +/// case the key will be read from that location on subsequent runs that specify +/// the same location. If you don't, a fresh key will be generated each time. +/// /// You can also specify a port for the endpoint. If you don't, a random one /// will be chosen. #[derive(Parser, Debug)] @@ -54,7 +59,7 @@ pub enum Commands { /// /// This command only really makes sense when you are providing dumbpipe with a /// secret key. - GenerateTicket, + GenerateTicket(CommonArgs), /// Listen on an endpoint and forward stdin/stdout to the first incoming /// bidi stream. @@ -136,6 +141,13 @@ pub struct CommonArgs { #[clap(long)] pub custom_alpn: Option, + /// Use a persistent node key pair + #[arg(long)] + persist: bool, + /// Write and read the node keys at the given location + #[arg(long)] + persist_at: Option, + /// The verbosity level. Repeat to increase verbosity. #[clap(short = 'v', long, action = clap::ArgAction::Count)] pub verbose: u8, @@ -283,20 +295,13 @@ async fn copy_from_noq( } /// Get the secret key or generate a new one. -/// -/// Print the secret key to stderr if it was generated, so the user can save it. -fn get_or_create_secret() -> Result { - match std::env::var("IROH_SECRET") { - Ok(secret) => SecretKey::from_str(&secret).std_context("invalid secret"), - Err(_) => { - let key = SecretKey::generate(&mut rand::rng()); - eprintln!( - "using secret key {}", - data_encoding::HEXLOWER.encode(&key.to_bytes()) - ); - Ok(key) - } - } +async fn get_or_create_secret(common: &CommonArgs) -> Result { + KeyRetriever::new("dumbpipe") + .persist(common.persist) + .persist_at(common.persist_at.as_ref()) + .get() + .await + .map_err(n0_error::AnyError::from) } /// Create a new iroh endpoint. @@ -358,7 +363,7 @@ async fn forward_bidi( } async fn listen_stdio(args: ListenArgs) -> Result<()> { - let secret_key = get_or_create_secret()?; + let secret_key = get_or_create_secret(&args.common).await?; let endpoint = create_endpoint(secret_key, &args.common, vec![args.common.alpn()?]).await?; // wait for the endpoint to figure out its home relay and addresses before making a ticket if (timeout(ONLINE_TIMEOUT, endpoint.online()).await).is_err() { @@ -422,7 +427,7 @@ async fn listen_stdio(args: ListenArgs) -> Result<()> { } async fn connect_stdio(args: ConnectArgs) -> Result<()> { - let secret_key = get_or_create_secret()?; + let secret_key = get_or_create_secret(&args.common).await?; let endpoint = create_endpoint(secret_key, &args.common, vec![]).await?; let addr = args.ticket.endpoint_addr(); let remote_endpoint_id = addr.id; @@ -462,7 +467,7 @@ async fn connect_tcp(args: ConnectTcpArgs) -> Result<()> { .addr .to_socket_addrs() .std_context(format!("invalid host string {}", args.addr))?; - let secret_key = get_or_create_secret()?; + let secret_key = get_or_create_secret(&args.common).await?; let endpoint = create_endpoint(secret_key, &args.common, vec![]) .await .std_context("unable to bind endpoint")?; @@ -544,7 +549,7 @@ async fn listen_tcp(args: ListenTcpArgs) -> Result<()> { Ok(addrs) => addrs.collect::>(), Err(e) => bail_any!("invalid host string {}: {}", args.host, e), }; - let secret_key = get_or_create_secret()?; + let secret_key = get_or_create_secret(&args.common).await?; let endpoint = create_endpoint(secret_key, &args.common, vec![args.common.alpn()?]).await?; // wait for the endpoint to figure out its address before making a ticket if (timeout(ONLINE_TIMEOUT, endpoint.online()).await).is_err() { @@ -642,7 +647,7 @@ fn create_short_ticket(addr: &EndpointAddr) -> EndpointTicket { /// Listen on an endpoint and forward incoming connections to a Unix socket. async fn listen_unix(args: ListenUnixArgs) -> Result<()> { let socket_path = args.socket_path.clone(); - let secret_key = get_or_create_secret()?; + let secret_key = get_or_create_secret(&args.common).await?; let endpoint = create_endpoint(secret_key, &args.common, vec![args.common.alpn()?]).await?; // wait for the endpoint to figure out its address before making a ticket if (timeout(ONLINE_TIMEOUT, endpoint.online()).await).is_err() { @@ -760,7 +765,7 @@ impl Drop for UnixSocketGuard { /// Listen on a Unix socket and forward connections to an endpoint. async fn connect_unix(args: ConnectUnixArgs) -> Result<()> { let socket_path = args.socket_path.clone(); - let secret_key = get_or_create_secret()?; + let secret_key = get_or_create_secret(&args.common).await?; let endpoint = create_endpoint(secret_key, &args.common, vec![]) .await .std_context("unable to bind endpoint")?; @@ -858,8 +863,8 @@ async fn connect_unix(args: ConnectUnixArgs) -> Result<()> { Ok(()) } -async fn generate_ticket() -> Result<()> { - let secret_key = get_or_create_secret()?; +async fn generate_ticket(args: CommonArgs) -> Result<()> { + let secret_key = get_or_create_secret(&args).await?; let public_key = secret_key.public(); let addr = EndpointAddr::new(public_key); let ticket = EndpointTicket::new(addr); @@ -872,7 +877,7 @@ async fn main() -> Result<()> { tracing_subscriber::fmt::init(); let args = Args::parse(); let res = match args.command { - Commands::GenerateTicket => generate_ticket().await, + Commands::GenerateTicket(args) => generate_ticket(args).await, Commands::Listen(args) => listen_stdio(args).await, Commands::ListenTcp(args) => listen_tcp(args).await, Commands::Connect(args) => connect_stdio(args).await, diff --git a/tests/cli.rs b/tests/cli.rs index 1accbf6..78ce26e 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -64,8 +64,8 @@ fn connect_listen_happy() { .stderr_to_stdout() // .reader() .unwrap(); - // read the first 3 lines of the header, and parse the last token as a ticket - let header = read_ascii_lines(3, &mut listen).unwrap(); + // read the first 2 lines of the header, and parse the last token as a ticket + let header = read_ascii_lines(2, &mut listen).unwrap(); let header = String::from_utf8(header).unwrap(); let ticket = header.split_ascii_whitespace().last().unwrap(); let ticket = EndpointTicket::from_str(ticket).unwrap(); @@ -105,8 +105,8 @@ fn connect_listen_custom_alpn_happy() { .stderr_to_stdout() // .reader() .unwrap(); - // read the first 3 lines of the header, and parse the last token as a ticket - let header = read_ascii_lines(3, &mut listen).unwrap(); + // read the first 2 lines of the header, and parse the last token as a ticket + let header = read_ascii_lines(2, &mut listen).unwrap(); let header = String::from_utf8(header).unwrap(); let ticket = header.split_ascii_whitespace().last().unwrap(); let ticket = EndpointTicket::from_str(ticket).unwrap(); @@ -149,8 +149,8 @@ fn connect_listen_ctrlc_connect() { .stderr_to_stdout() // .reader() .unwrap(); - // read the first 3 lines of the header, and parse the last token as a ticket - let header = read_ascii_lines(3, &mut listen).unwrap(); + // read the first 2 lines of the header, and parse the last token as a ticket + let header = read_ascii_lines(2, &mut listen).unwrap(); let header = String::from_utf8(header).unwrap(); let ticket = header.split_ascii_whitespace().last().unwrap(); let ticket = EndpointTicket::from_str(ticket).unwrap(); @@ -189,8 +189,8 @@ fn connect_listen_ctrlc_listen() { .stderr_to_stdout() .reader() .unwrap(); - // read the first 3 lines of the header, and parse the last token as a ticket - let header = read_ascii_lines(3, &mut listen).unwrap(); + // read the first 2 lines of the header, and parse the last token as a ticket + let header = read_ascii_lines(2, &mut listen).unwrap(); let header = String::from_utf8(header).unwrap(); let ticket = header.split_ascii_whitespace().last().unwrap(); let ticket = EndpointTicket::from_str(ticket).unwrap(); @@ -240,7 +240,7 @@ fn listen_tcp_happy() { .stderr_to_stdout() // .reader() .unwrap(); - let header = read_ascii_lines(4, &mut listen_tcp).unwrap(); + let header = read_ascii_lines(3, &mut listen_tcp).unwrap(); let header = String::from_utf8(header).unwrap(); let ticket = header.split_ascii_whitespace().last().unwrap(); let ticket = EndpointTicket::from_str(ticket).unwrap(); @@ -267,7 +267,7 @@ fn connect_tcp_happy() { .stderr_to_stdout() // .reader() .unwrap(); - let header = read_ascii_lines(3, &mut listen).unwrap(); + let header = read_ascii_lines(2, &mut listen).unwrap(); let header = String::from_utf8(header).unwrap(); let ticket = header.split_ascii_whitespace().last().unwrap(); let ticket = EndpointTicket::from_str(ticket).unwrap();