From 01b889d2739a55b6677baed14681a2f0580f355c Mon Sep 17 00:00:00 2001 From: ghe0 Date: Sun, 8 Sep 2024 02:47:39 +0300 Subject: [PATCH] migrated keys to the solana sdk --- Cargo.lock | 2286 +++++++++++++++++++++++++------------------- Cargo.toml | 7 +- rustfmt.toml | 3 + src/datastore.rs | 236 ++--- src/http_server.rs | 144 +-- src/persistence.rs | 118 +-- 6 files changed, 1507 insertions(+), 1287 deletions(-) create mode 100644 rustfmt.toml diff --git a/Cargo.lock b/Cargo.lock index 548118d..1becf2a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,189 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "actix-codec" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7b0a21988c1bf877cf4759ef5ddaac04c1c9fe808c9142ecb78ba97d97a28a" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-sink", + "memchr", + "pin-project-lite", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "actix-http" +version = "3.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d48f96fc3003717aeb9856ca3d02a8c7de502667ad76eeacd830b48d2e91fac4" +dependencies = [ + "actix-codec", + "actix-rt", + "actix-service", + "actix-utils", + "ahash 0.8.11", + "base64 0.22.1", + "bitflags", + "brotli", + "bytes", + "bytestring", + "derive_more", + "encoding_rs", + "flate2", + "futures-core", + "h2 0.3.26", + "http 0.2.12", + "httparse", + "httpdate", + "itoa", + "language-tags", + "local-channel", + "mime", + "percent-encoding", + "pin-project-lite", + "rand 0.8.5", + "sha1", + "smallvec", + "tokio", + "tokio-util", + "tracing", + "zstd", +] + +[[package]] +name = "actix-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01ed3140b2f8d422c68afa1ed2e85d996ea619c988ac834d255db32138655cb" +dependencies = [ + "quote", + "syn 2.0.74", +] + +[[package]] +name = "actix-router" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d324164c51f63867b57e73ba5936ea151b8a41a1d23d1031eeb9f70d0236f8" +dependencies = [ + "bytestring", + "cfg-if", + "http 0.2.12", + "regex", + "regex-lite", + "serde", + "tracing", +] + +[[package]] +name = "actix-rt" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24eda4e2a6e042aa4e55ac438a2ae052d3b5da0ecf83d7411e1a368946925208" +dependencies = [ + "futures-core", + "tokio", +] + +[[package]] +name = "actix-server" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca2549781d8dd6d75c40cf6b6051260a2cc2f3c62343d761a969a0640646894" +dependencies = [ + "actix-rt", + "actix-service", + "actix-utils", + "futures-core", + "futures-util", + "mio", + "socket2", + "tokio", + "tracing", +] + +[[package]] +name = "actix-service" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b894941f818cfdc7ccc4b9e60fa7e53b5042a2e8567270f9147d5591893373a" +dependencies = [ + "futures-core", + "paste", + "pin-project-lite", +] + +[[package]] +name = "actix-utils" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88a1dcdff1466e3c2488e1cb5c36a71822750ad43839937f85d2f4d9f8b705d8" +dependencies = [ + "local-waker", + "pin-project-lite", +] + +[[package]] +name = "actix-web" +version = "4.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9180d76e5cc7ccbc4d60a506f2c727730b154010262df5b910eb17dbe4b8cb38" +dependencies = [ + "actix-codec", + "actix-http", + "actix-macros", + "actix-router", + "actix-rt", + "actix-server", + "actix-service", + "actix-utils", + "actix-web-codegen", + "ahash 0.8.11", + "bytes", + "bytestring", + "cfg-if", + "cookie", + "derive_more", + "encoding_rs", + "futures-core", + "futures-util", + "impl-more", + "itoa", + "language-tags", + "log", + "mime", + "once_cell", + "pin-project-lite", + "regex", + "regex-lite", + "serde", + "serde_json", + "serde_urlencoded", + "smallvec", + "socket2", + "time", + "url", +] + +[[package]] +name = "actix-web-codegen" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f591380e2e68490b5dfaf1dd1aa0ebe78d84ba7067078512b4ea6e4492d622b8" +dependencies = [ + "actix-router", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "addr2line" version = "0.22.0" @@ -18,38 +201,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] -name = "aead" -version = "0.5.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "ahash" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "crypto-common", - "generic-array", + "getrandom 0.2.15", + "once_cell", + "version_check", ] [[package]] -name = "aes" -version = "0.8.4" +name = "ahash" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", - "cipher", - "cpufeatures", -] - -[[package]] -name = "aes-gcm" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", + "getrandom 0.2.15", + "once_cell", + "version_check", + "zerocopy", ] [[package]] @@ -61,12 +239,156 @@ dependencies = [ "memchr", ] +[[package]] +name = "alloc-no-stdlib" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7bb162ec39d46ab1ca8c77bf72e890535becd1751bb45f64c597edb4c8c6b3" + +[[package]] +name = "alloc-stdlib" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94fb8275041c72129eb51b7d0322c29b8387a0386127718b096429201a5d6ece" +dependencies = [ + "alloc-no-stdlib", +] + [[package]] name = "anyhow" version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-std", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "arrayref" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + [[package]] name = "async-stream" version = "0.3.5" @@ -122,7 +444,7 @@ dependencies = [ "axum-core", "bytes", "futures-util", - "http", + "http 1.1.0", "http-body", "http-body-util", "itoa", @@ -148,7 +470,7 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", + "http 1.1.0", "http-body", "http-body-util", "mime", @@ -169,16 +491,16 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] [[package]] name = "base64" -version = "0.21.7" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64" @@ -187,22 +509,45 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] -name = "base64ct" -version = "1.6.0" +name = "bincode" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] [[package]] name = "bitflags" version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "blake3" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cca6d3674597c30ddf2c587bf8d9d65c9a84d2326d941cc79c9842dfe0ef52" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", + "digest 0.10.7", +] + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] [[package]] name = "block-buffer" @@ -213,18 +558,144 @@ dependencies = [ "generic-array", ] +[[package]] +name = "borsh" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4114279215a005bc675e386011e594e1d9b800918cea18fcadadcce864a2046b" +dependencies = [ + "borsh-derive 0.10.3", + "hashbrown 0.12.3", +] + +[[package]] +name = "borsh" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +dependencies = [ + "borsh-derive 1.5.1", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0754613691538d51f329cce9af41d7b7ca150bc973056f1156611489475f54f7" +dependencies = [ + "borsh-derive-internal", + "borsh-schema-derive-internal", + "proc-macro-crate 0.1.5", + "proc-macro2", + "syn 1.0.109", +] + +[[package]] +name = "borsh-derive" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +dependencies = [ + "once_cell", + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.74", + "syn_derive", +] + +[[package]] +name = "borsh-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afb438156919598d2c7bad7e1c0adf3d26ed3840dbc010db1a882a65583ca2fb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "borsh-schema-derive-internal" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634205cc43f74a1b9046ef87c4540ebda95696ec0f315024860cad7c5b0f5ccd" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "brotli" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74f7971dbd9326d58187408ab83117d8ac1bb9c17b085fdacd1cf2f598719b6b" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a45bd2e4095a8b518033b128020dd4a55aab1c0a381ba4404a472630f4bc362" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + [[package]] name = "bumpalo" version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" +[[package]] +name = "bv" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340" +dependencies = [ + "feature-probe", + "serde", +] + [[package]] name = "bytecount" version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" +[[package]] +name = "bytemuck" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94bbb0ad554ad961ddc5da507a12a29b14e4ae5bda06b19f575a3e6079d2e2ae" + +[[package]] +name = "bytemuck_derive" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc8b54b395f2fcfbb3d90c47b01c7f444d94d05bdeb775811dec868ac3bbc26" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "byteorder" version = "1.5.0" @@ -237,12 +708,23 @@ version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +[[package]] +name = "bytestring" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74d80203ea6b29df88012294f62733de21cfeab47f17b41af3a38bc30a03ee72" +dependencies = [ + "bytes", +] + [[package]] name = "cc" version = "1.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fb8dd288a69fc53a1996d7ecfbf4a20d59065bff137ce7e56bbd620de191189" dependencies = [ + "jobserver", + "libc", "shlex", ] @@ -259,54 +741,57 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] -name = "cipher" -version = "0.4.4" +name = "chrono" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ - "crypto-common", - "inout", + "num-traits", ] [[package]] -name = "const-oid" -version = "0.9.6" +name = "console_error_panic_hook" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" +checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" +dependencies = [ + "cfg-if", + "wasm-bindgen", +] + +[[package]] +name = "console_log" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89f72f65e8501878b8a004d5a1afb780987e2ce2b4532c562e367a72c57499f" +dependencies = [ + "log", + "web-sys", +] + +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "cookie" -version = "0.18.1" +version = "0.16.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ - "aes-gcm", - "base64 0.22.1", - "hmac", "percent-encoding", - "rand", - "sha2", - "subtle", "time", "version_check", ] -[[package]] -name = "core-foundation" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" - [[package]] name = "cpufeatures" version = "0.2.13" @@ -316,12 +801,27 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-utils" version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + [[package]] name = "crypto-common" version = "0.1.6" @@ -329,43 +829,64 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", - "rand_core", "typenum", ] [[package]] -name = "ctr" -version = "0.9.2" +name = "crypto-mac" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ - "cipher", + "generic-array", + "subtle", ] [[package]] name = "curve25519-dalek" -version = "4.1.3" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "rustc_version", + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", "subtle", "zeroize", ] [[package]] -name = "curve25519-dalek-derive" -version = "0.1.1" +name = "darling" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", "proc-macro2", "quote", + "strsim", + "syn 2.0.74", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", "syn 2.0.74", ] @@ -383,16 +904,6 @@ dependencies = [ "parking_lot_core", ] -[[package]] -name = "der" -version = "0.7.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" -dependencies = [ - "const-oid", - "zeroize", -] - [[package]] name = "deranged" version = "0.3.11" @@ -402,43 +913,91 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "derivation-path" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0" + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "0.99.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.74", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + [[package]] name = "digest" version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", + "block-buffer 0.10.4", "crypto-common", "subtle", ] [[package]] name = "ed25519" -version = "2.2.3" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +checksum = "91cff35c70bba8a626e3185d8cd48cc11b5437e1a5bcd15b9b5fa3c64b6dfee7" dependencies = [ - "pkcs8", - "serde", "signature", ] [[package]] name = "ed25519-dalek" -version = "2.1.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" +checksum = "c762bae6dcaf24c4c84667b8579785430908723d5c889f469d76a41d59cc7a9d" dependencies = [ "curve25519-dalek", "ed25519", - "rand_core", + "rand 0.7.3", "serde", - "sha2", - "subtle", + "sha2 0.9.9", "zeroize", ] +[[package]] +name = "ed25519-dalek-bip32" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d2be62a4061b872c8c0873ee4fc6f101ce7b889d039f019c5fa2af471a59908" +dependencies = [ + "derivation-path", + "ed25519-dalek", + "hmac 0.12.1", + "sha2 0.10.8", +] + [[package]] name = "either" version = "1.13.0" @@ -454,26 +1013,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "enumflags2" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d232db7f5956f3f14313dc2f87985c58bd2c695ce124c8cdd984e08e15ac133d" -dependencies = [ - "enumflags2_derive", -] - -[[package]] -name = "enumflags2_derive" -version = "0.7.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de0d48a183585823424a4ce1aa132d174a6a81bd540895822eb4c8373a8e49e8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.74", -] - [[package]] name = "equivalent" version = "1.0.1" @@ -490,16 +1029,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "etag" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b3d0661a2ccddc26cba0b834e9b717959ed6fdd76c7129ee159c170a875bf44" -dependencies = [ - "str-buf", - "xxhash-rust", -] - [[package]] name = "fastrand" version = "2.1.0" @@ -507,10 +1036,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] -name = "fiat-crypto" -version = "0.2.9" +name = "feature-probe" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" +checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da" [[package]] name = "fixedbitset" @@ -518,27 +1047,22 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" +[[package]] +name = "flate2" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +dependencies = [ + "crc32fast", + "miniz_oxide 0.8.0", +] + [[package]] name = "fnv" version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - [[package]] name = "form_urlencoded" version = "1.2.1" @@ -563,23 +1087,6 @@ version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.74", -] - [[package]] name = "futures-sink" version = "0.3.30" @@ -599,14 +1106,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", - "futures-io", - "futures-macro", - "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", - "slab", ] [[package]] @@ -615,10 +1117,24 @@ version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ + "serde", "typenum", "version_check", ] +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", + "wasm-bindgen", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -628,26 +1144,35 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] -[[package]] -name = "ghash" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" -dependencies = [ - "opaque-debug", - "polyval", -] - [[package]] name = "gimli" version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.12", + "indexmap 2.4.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "h2" version = "0.4.5" @@ -659,7 +1184,7 @@ dependencies = [ "fnv", "futures-core", "futures-sink", - "http", + "http 1.1.0", "indexmap 2.4.0", "slab", "tokio", @@ -671,14 +1196,15 @@ dependencies = [ name = "hacker-challenge" version = "0.1.0" dependencies = [ + "actix-web", "async-stream", "dashmap", - "ed25519-dalek", "hex", "prost", "prost-types", - "rand", - "salvo", + "rand 0.8.5", + "serde", + "solana-sdk", "tabled", "tokio", "tokio-stream", @@ -691,6 +1217,18 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.8", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.11", +] [[package]] name = "hashbrown" @@ -698,30 +1236,6 @@ version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -[[package]] -name = "headers" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322106e6bd0cba2d5ead589ddb8150a13d7c4217cf80d7c4f682ca994ccc6aa9" -dependencies = [ - "base64 0.21.7", - "bytes", - "headers-core", - "http", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" -dependencies = [ - "http", -] - [[package]] name = "heck" version = "0.4.1" @@ -740,13 +1254,45 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + [[package]] name = "hmac" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" dependencies = [ - "digest", + "digest 0.10.7", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac 0.8.1", +] + +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", ] [[package]] @@ -767,7 +1313,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", - "http", + "http 1.1.0", ] [[package]] @@ -778,7 +1324,7 @@ checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", "futures-util", - "http", + "http 1.1.0", "http-body", "pin-project-lite", ] @@ -804,8 +1350,8 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "h2", - "http", + "h2 0.4.5", + "http 1.1.0", "http-body", "httparse", "httpdate", @@ -816,25 +1362,6 @@ dependencies = [ "want", ] -[[package]] -name = "hyper-rustls" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" -dependencies = [ - "futures-util", - "http", - "hyper", - "hyper-util", - "log", - "rustls", - "rustls-native-certs", - "rustls-pki-types", - "tokio", - "tokio-rustls", - "tower-service", -] - [[package]] name = "hyper-timeout" version = "0.5.1" @@ -848,22 +1375,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "hyper-tls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" -dependencies = [ - "bytes", - "http-body-util", - "hyper", - "hyper-util", - "native-tls", - "tokio", - "tokio-native-tls", - "tower-service", -] - [[package]] name = "hyper-util" version = "0.1.7" @@ -873,7 +1384,7 @@ dependencies = [ "bytes", "futures-channel", "futures-util", - "http", + "http 1.1.0", "http-body", "hyper", "pin-project-lite", @@ -884,6 +1395,12 @@ dependencies = [ "tracing", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "0.5.0" @@ -894,6 +1411,12 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "impl-more" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206ca75c9c03ba3d4ace2460e57b189f39f43de612c2f85836e65c929701bb2d" + [[package]] name = "indexmap" version = "1.9.3" @@ -915,19 +1438,22 @@ dependencies = [ ] [[package]] -name = "inout" -version = "0.1.3" +name = "itertools" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ - "generic-array", + "either", ] [[package]] -name = "ipnet" -version = "2.9.0" +name = "itertools" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] [[package]] name = "itertools" @@ -944,6 +1470,15 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.70" @@ -954,32 +1489,103 @@ dependencies = [ ] [[package]] -name = "jsonwebtoken" -version = "9.3.0" +name = "keccak" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ - "base64 0.21.7", - "js-sys", - "pem", - "ring", - "serde", - "serde_json", - "simple_asn1", + "cpufeatures", ] +[[package]] +name = "language-tags" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4345964bb142484797b161f473a503a434de77149dd8c7427788c6e13379388" + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.7.3", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "local-channel" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6cbc85e69b8df4b8bb8b89ec634e7189099cea8927a276b7384ce5488e53ec8" +dependencies = [ + "futures-core", + "futures-sink", + "local-waker", +] + +[[package]] +name = "local-waker" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d873d7c67ce09b42110d801813efbc9364414e356be9935700d368351657487" + [[package]] name = "lock_api" version = "0.4.12" @@ -1008,22 +1614,30 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + [[package]] name = "mime" version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" -[[package]] -name = "mime-infer" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91caed19dd472bc88bcd063571df18153529d49301a1918f4cf37f42332bee2e" -dependencies = [ - "mime", - "unicase", -] - [[package]] name = "miniz_oxide" version = "0.7.4" @@ -1033,6 +1647,15 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "1.0.2" @@ -1041,64 +1664,16 @@ checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi", "libc", - "wasi", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] -[[package]] -name = "multer" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http", - "httparse", - "memchr", - "mime", - "spin", - "version_check", -] - [[package]] name = "multimap" version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" -dependencies = [ - "serde", -] - -[[package]] -name = "native-tls" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" -dependencies = [ - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "nix" -version = "0.29.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "cfg_aliases", - "libc", -] [[package]] name = "num-bigint" @@ -1116,6 +1691,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "num-integer" version = "0.1.46" @@ -1134,6 +1720,27 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_enum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +dependencies = [ + "proc-macro-crate 3.2.0", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "object" version = "0.36.3" @@ -1155,50 +1762,6 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" -[[package]] -name = "openssl" -version = "0.10.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" -dependencies = [ - "bitflags 2.6.0", - "cfg-if", - "foreign-types", - "libc", - "once_cell", - "openssl-macros", - "openssl-sys", -] - -[[package]] -name = "openssl-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.74", -] - -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.103" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "papergrid" version = "0.12.0" @@ -1230,17 +1793,22 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets 0.52.6", + "windows-targets", ] [[package]] -name = "pem" -version = "3.0.4" +name = "paste" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" dependencies = [ - "base64 0.22.1", - "serde", + "digest 0.10.7", ] [[package]] @@ -1291,34 +1859,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - [[package]] name = "pkg-config" version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" -[[package]] -name = "polyval" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - [[package]] name = "powerfmt" version = "0.2.0" @@ -1346,9 +1892,18 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ "toml_edit", ] @@ -1404,7 +1959,7 @@ checksum = "5bb182580f71dd070f88d01ce3de9f4da5021db7115d2e1c3605a754153b77c1" dependencies = [ "bytes", "heck", - "itertools", + "itertools 0.13.0", "log", "multimap", "once_cell", @@ -1424,7 +1979,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18bec9b0adc4eba778b33684b7ba3e7137789434769ee3ce3930463ef904cfca" dependencies = [ "anyhow", - "itertools", + "itertools 0.13.0", "proc-macro2", "quote", "syn 2.0.74", @@ -1439,6 +1994,15 @@ dependencies = [ "prost", ] +[[package]] +name = "qstring" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" +dependencies = [ + "percent-encoding", +] + [[package]] name = "quote" version = "1.0.36" @@ -1448,6 +2012,19 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc", +] + [[package]] name = "rand" version = "0.8.5" @@ -1455,8 +2032,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", ] [[package]] @@ -1466,7 +2053,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", ] [[package]] @@ -1475,7 +2071,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", ] [[package]] @@ -1484,7 +2089,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.6.0", + "bitflags", ] [[package]] @@ -1510,72 +2115,18 @@ dependencies = [ "regex-syntax", ] +[[package]] +name = "regex-lite" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" + [[package]] name = "regex-syntax" version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" -[[package]] -name = "reqwest" -version = "0.12.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" -dependencies = [ - "base64 0.22.1", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-tls", - "hyper-util", - "ipnet", - "js-sys", - "log", - "mime", - "native-tls", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "sync_wrapper 1.0.1", - "system-configuration", - "tokio", - "tokio-native-tls", - "tokio-util", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "wasm-streams", - "web-sys", - "winreg", -] - -[[package]] -name = "ring" -version = "0.17.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" -dependencies = [ - "cc", - "cfg-if", - "getrandom", - "libc", - "spin", - "untrusted", - "windows-sys 0.52.0", -] - [[package]] name = "rustc-demangle" version = "0.1.24" @@ -1597,68 +2148,13 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.6.0", + "bitflags", "errno", "libc", "linux-raw-sys", "windows-sys 0.52.0", ] -[[package]] -name = "rustls" -version = "0.23.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" -dependencies = [ - "log", - "once_cell", - "ring", - "rustls-pki-types", - "rustls-webpki", - "subtle", - "zeroize", -] - -[[package]] -name = "rustls-native-certs" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a88d6d420651b496bdd98684116959239430022a115c1240e6c3993be0b15fba" -dependencies = [ - "openssl-probe", - "rustls-pemfile", - "rustls-pki-types", - "schannel", - "security-framework", -] - -[[package]] -name = "rustls-pemfile" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" -dependencies = [ - "base64 0.22.1", - "rustls-pki-types", -] - -[[package]] -name = "rustls-pki-types" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" - -[[package]] -name = "rustls-webpki" -version = "0.102.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" -dependencies = [ - "ring", - "rustls-pki-types", - "untrusted", -] - [[package]] name = "rustversion" version = "1.0.17" @@ -1671,183 +2167,12 @@ version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" -[[package]] -name = "salvo" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5595bf239a9bebe5c29acb4cfbebe6d167fe630bb817761afbac62a1b200cace" -dependencies = [ - "salvo-jwt-auth", - "salvo-proxy", - "salvo_core", - "salvo_extra", -] - -[[package]] -name = "salvo-jwt-auth" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee08271643b18fc4040277a5036e6af1e0f1a44aa5b48a390861176e36077159" -dependencies = [ - "base64 0.22.1", - "bytes", - "http-body-util", - "hyper-rustls", - "hyper-util", - "jsonwebtoken", - "salvo_core", - "serde", - "serde_json", - "thiserror", - "tokio", - "tracing", -] - -[[package]] -name = "salvo-proxy" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dc8a9bc5f50bd49ac60c61d82bc99fa62bb0f1eef21cd938aa2478ad6f011b4" -dependencies = [ - "fastrand", - "futures-util", - "hyper", - "hyper-rustls", - "hyper-util", - "percent-encoding", - "reqwest", - "salvo_core", - "tokio", - "tracing", -] - -[[package]] -name = "salvo-serde-util" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff0b54996e076efff0ee7901dc6cda6dd656f35ff321d48f8d239d064161036f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.74", -] - -[[package]] -name = "salvo_core" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46a443cbc9e5f34f8e49ed9355f04286311cc6dbaf405d9b73481ed2f86c3213" -dependencies = [ - "async-trait", - "base64 0.22.1", - "bytes", - "cookie", - "enumflags2", - "form_urlencoded", - "futures-channel", - "futures-util", - "headers", - "http", - "http-body-util", - "hyper", - "hyper-rustls", - "hyper-util", - "indexmap 2.4.0", - "mime", - "mime-infer", - "multer", - "multimap", - "nix", - "parking_lot", - "percent-encoding", - "pin-project", - "rand", - "regex", - "salvo_macros", - "serde", - "serde-xml-rs", - "serde_json", - "sync_wrapper 1.0.1", - "tempfile", - "thiserror", - "tokio", - "tokio-rustls", - "tokio-util", - "tracing", -] - -[[package]] -name = "salvo_extra" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11a1d577b798b1fd642bc8d3a80b2bb9299c9236a0a2e072c597099daee28557" -dependencies = [ - "base64 0.22.1", - "etag", - "futures-util", - "hyper", - "pin-project", - "salvo_core", - "serde", - "serde_json", - "tokio", - "tokio-tungstenite", - "tracing", - "ulid", -] - -[[package]] -name = "salvo_macros" -version = "0.70.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaace51083ef2e75196bb5917b03a81ceda63932ee3aa8c9571b2683b68ff29d" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "regex", - "salvo-serde-util", - "syn 2.0.74", -] - -[[package]] -name = "schannel" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "scopeguard" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "security-framework" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" -dependencies = [ - "bitflags 2.6.0", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "2.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "semver" version = "1.0.23" @@ -1856,30 +2181,27 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.207" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5665e14a49a4ea1b91029ba7d3bca9f299e1f7cfa194388ccc20f14743e784f2" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] -name = "serde-xml-rs" -version = "0.6.0" +name = "serde_bytes" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb3aa78ecda1ebc9ec9847d5d3aba7d618823446a049ba2491940506da6e2782" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ - "log", "serde", - "thiserror", - "xml-rs", ] [[package]] name = "serde_derive" -version = "1.0.207" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aea2634c86b0e8ef2cfdc0c340baede54ec27b1e46febd7f80dffb2aa44a00e" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", @@ -1910,6 +2232,28 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "sha1" version = "0.10.6" @@ -1918,7 +2262,20 @@ checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", ] [[package]] @@ -1929,7 +2286,17 @@ checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if", "cpufeatures", - "digest", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", ] [[package]] @@ -1939,25 +2306,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] -name = "signature" -version = "2.2.0" +name = "signal-hook-registry" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ - "rand_core", + "libc", ] [[package]] -name = "simple_asn1" -version = "0.6.2" +name = "signature" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" -dependencies = [ - "num-bigint", - "num-traits", - "thiserror", - "time", -] +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" + +[[package]] +name = "siphasher" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38b58827f4464d87d377d175e90bf58eb00fd8716ff0a62f80356b5e61555d0d" [[package]] name = "slab" @@ -1985,26 +2352,118 @@ dependencies = [ ] [[package]] -name = "spin" -version = "0.9.8" +name = "solana-program" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "spki" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +checksum = "51237f3618428e8b9dd1e5c3d89b8f44f00dbcb88a7ad577ebdfdfac51501c61" dependencies = [ - "base64ct", - "der", + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-serialize", + "base64 0.22.1", + "bincode", + "bitflags", + "blake3", + "borsh 0.10.3", + "borsh 1.5.1", + "bs58", + "bv", + "bytemuck", + "bytemuck_derive", + "console_error_panic_hook", + "console_log", + "curve25519-dalek", + "getrandom 0.2.15", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "memoffset", + "num-bigint", + "num-derive", + "num-traits", + "parking_lot", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "sha2 0.10.8", + "sha3", + "solana-sdk-macro", + "thiserror", + "wasm-bindgen", ] [[package]] -name = "str-buf" -version = "3.0.3" +name = "solana-sdk" +version = "2.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ceb97b7225c713c2fd4db0153cb6b3cab244eb37900c3f634ed4d43310d8c34" +checksum = "da640d96314707ba69feb3c0b1c5fdefb418c5d5e684fe5a9a27b8daae8c18b5" +dependencies = [ + "bincode", + "bitflags", + "borsh 1.5.1", + "bs58", + "bytemuck", + "bytemuck_derive", + "byteorder", + "chrono", + "derivation-path", + "digest 0.10.7", + "ed25519-dalek", + "ed25519-dalek-bip32", + "generic-array", + "getrandom 0.1.16", + "hmac 0.12.1", + "itertools 0.12.1", + "js-sys", + "lazy_static", + "libsecp256k1", + "log", + "memmap2", + "num_enum", + "pbkdf2", + "qstring", + "rand 0.7.3", + "rand 0.8.5", + "rustc_version", + "rustversion", + "serde", + "serde_bytes", + "serde_derive", + "serde_json", + "serde_with", + "sha2 0.10.8", + "sha3", + "siphasher", + "solana-program", + "solana-sdk-macro", + "thiserror", + "uriparse", + "wasm-bindgen", +] + +[[package]] +name = "solana-sdk-macro" +version = "2.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45b6e930455ef68cf15e5a22a0e0c207e67c3d70978a565e0a64f568c8a24129" +dependencies = [ + "bs58", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.74", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" @@ -2034,6 +2493,18 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.74", +] + [[package]] name = "sync_wrapper" version = "0.1.2" @@ -2046,27 +2517,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" -[[package]] -name = "system-configuration" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "system-configuration-sys", -] - -[[package]] -name = "system-configuration-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" -dependencies = [ - "core-foundation-sys", - "libc", -] - [[package]] name = "tabled" version = "0.16.0" @@ -2179,7 +2629,9 @@ dependencies = [ "bytes", "libc", "mio", + "parking_lot", "pin-project-lite", + "signal-hook-registry", "socket2", "tokio-macros", "windows-sys 0.52.0", @@ -2196,27 +2648,6 @@ dependencies = [ "syn 2.0.74", ] -[[package]] -name = "tokio-native-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-rustls" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" -dependencies = [ - "rustls", - "rustls-pki-types", - "tokio", -] - [[package]] name = "tokio-stream" version = "0.1.15" @@ -2229,18 +2660,6 @@ dependencies = [ "tokio-util", ] -[[package]] -name = "tokio-tungstenite" -version = "0.23.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6989540ced10490aaf14e6bad2e3d33728a2813310a0c71d1574304c49631cd" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite", -] - [[package]] name = "tokio-util" version = "0.7.11" @@ -2254,6 +2673,15 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +dependencies = [ + "serde", +] + [[package]] name = "toml_datetime" version = "0.6.8" @@ -2262,9 +2690,9 @@ checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap 2.4.0", "toml_datetime", @@ -2282,8 +2710,8 @@ dependencies = [ "axum", "base64 0.22.1", "bytes", - "h2", - "http", + "h2 0.4.5", + "http 1.1.0", "http-body", "http-body-util", "hyper", @@ -2325,7 +2753,7 @@ dependencies = [ "indexmap 1.9.3", "pin-project", "pin-project-lite", - "rand", + "rand 0.8.5", "slab", "tokio", "tokio-util", @@ -2352,6 +2780,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2383,46 +2812,12 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" -[[package]] -name = "tungstenite" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e2ce1e47ed2994fd43b04c8f618008d4cabdd5ee34027cf14f9d918edd9c8" -dependencies = [ - "byteorder", - "bytes", - "log", - "rand", - "thiserror", - "utf-8", -] - [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" -[[package]] -name = "ulid" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f903f293d11f31c0c29e4148f6dc0d033a7f80cebc0282bea147611667d289" -dependencies = [ - "getrandom", - "rand", - "web-time", -] - -[[package]] -name = "unicase" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] - [[package]] name = "unicode-bidi" version = "0.3.15" @@ -2451,21 +2846,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" [[package]] -name = "universal-hash" -version = "0.5.1" +name = "uriparse" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea" +checksum = "0200d0fc04d809396c2ad43f3c95da3582a2556eba8d453c1087f4120ee352ff" dependencies = [ - "crypto-common", - "subtle", + "fnv", + "lazy_static", ] -[[package]] -name = "untrusted" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" - [[package]] name = "url" version = "2.5.2" @@ -2477,18 +2866,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "utf-8" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "version_check" version = "0.9.5" @@ -2504,6 +2881,12 @@ dependencies = [ "try-lock", ] +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -2536,18 +2919,6 @@ dependencies = [ "wasm-bindgen-shared", ] -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - [[package]] name = "wasm-bindgen-macro" version = "0.2.93" @@ -2577,19 +2948,6 @@ version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" -[[package]] -name = "wasm-streams" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65dc4c90b63b118468cf747d8bf3566c1913ef60be765b5730ead9e0a3ba129" -dependencies = [ - "futures-util", - "js-sys", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - [[package]] name = "web-sys" version = "0.3.70" @@ -2600,32 +2958,13 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "web-time" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - [[package]] name = "windows-sys" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.6", + "windows-targets", ] [[package]] @@ -2634,22 +2973,7 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets 0.52.6", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] @@ -2658,46 +2982,28 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.6", - "windows_aarch64_msvc 0.52.6", - "windows_i686_gnu 0.52.6", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.6", - "windows_x86_64_gnu 0.52.6", - "windows_x86_64_gnullvm 0.52.6", - "windows_x86_64_msvc 0.52.6", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - [[package]] name = "windows_i686_gnu" version = "0.52.6" @@ -2710,48 +3016,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - [[package]] name = "windows_x86_64_msvc" version = "0.52.6" @@ -2760,35 +3042,13 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "xml-rs" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "539a77ee7c0de333dcc6da69b177380a0b81e0dacfa4f7344c465a36871ee601" - -[[package]] -name = "xxhash-rust" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a5cbf750400958819fb6178eaa83bee5cd9c29a26a40cc241df8c70fdd46984" - [[package]] name = "zerocopy" version = "0.7.35" @@ -2812,6 +3072,48 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.8.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.74", +] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/Cargo.toml b/Cargo.toml index 3116191..a5df5d8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,16 +4,17 @@ version = "0.1.0" edition = "2021" [dependencies] +actix-web = "4.9.0" async-stream = "0.3.5" dashmap = "6.0.1" -ed25519-dalek = { version = "2.1.1", features = ["rand_core", "serde"] } hex = "0.4.3" prost = "0.13.1" prost-types = "0.13.1" rand = "0.8.5" -salvo = { version = "0.70.0", features = ["affix"] } +serde = { version = "1.0.210", features = ["derive"] } +solana-sdk = "2.0.9" tabled = "0.16.0" -tokio = { version = "1.39.2", features = ["macros"] } +tokio = { version = "1.39.2", features = ["fs", "macros", "rt-multi-thread"] } tokio-stream = { version = "0.1.15", features = ["sync"] } tonic = "0.12.1" diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000..01959db --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +reorder_impl_items = true +use_small_heuristics = "Max" +merge_imports = true diff --git a/src/datastore.rs b/src/datastore.rs index ee35284..63b3c1c 100644 --- a/src/datastore.rs +++ b/src/datastore.rs @@ -1,16 +1,18 @@ -use crate::grpc::challenge::NodeUpdate; -use crate::persistence::FileManager; +use crate::{grpc::challenge::NodeUpdate, persistence::FileManager}; use dashmap::{DashMap, DashSet}; -use ed25519_dalek::{Signer, SigningKey, VerifyingKey, PUBLIC_KEY_LENGTH}; -use rand::rngs::OsRng; -use std::time::Duration; -use std::time::SystemTime; -use std::time::UNIX_EPOCH; +use solana_sdk::{ + pubkey::{ParsePubkeyError, Pubkey}, + signature::{keypair::Keypair, Signer}, +}; +use std::{ + str::FromStr, + time::{Duration, SystemTime, UNIX_EPOCH}, +}; use tabled::{Table, Tabled}; #[derive(Clone, PartialEq, Debug)] pub struct NodeInfo { - pub pubkey: VerifyingKey, + pub pubkey: Pubkey, pub updated_at: SystemTime, pub public: bool, } @@ -19,9 +21,10 @@ pub struct NodeInfo { pub struct Store { nodes: DashMap, conns: DashSet, - keys: DashMap, + keys: DashMap, persistence: FileManager, } +#[derive(Debug)] pub enum SigningError { CorruptedKey, KeyNotFound, @@ -33,8 +36,8 @@ impl From for SigningError { } } -impl From for SigningError { - fn from(_: ed25519_dalek::ed25519::Error) -> Self { +impl From for SigningError { + fn from(_: ParsePubkeyError) -> Self { Self::CorruptedKey } } @@ -91,23 +94,14 @@ impl Store { public: bool, } let mut output = vec![]; - for (ip, node_info) in self - .nodes - .iter() - .map(|n| (n.key().clone(), n.value().clone())) - { - let pubkey = hex::encode(node_info.pubkey.as_bytes()); + for (ip, node_info) in self.nodes.iter().map(|n| (n.key().clone(), n.value().clone())) { + let pubkey = node_info.pubkey.to_string(); let age = SystemTime::now() .duration_since(node_info.updated_at) .unwrap_or(Duration::ZERO) .as_secs(); let public = node_info.public; - output.push(OutputRow { - ip, - pubkey, - age, - public, - }); + output.push(OutputRow { ip, pubkey, age, public }); } Table::new(output).to_string() } @@ -122,32 +116,18 @@ impl Store { timestamp: String, } let mut output = vec![]; - for (ip, keypair, timestamp) in self - .persistence - .get_page_of_20(offset) - .await - .unwrap() - .iter() - .map(|n| { + for (ip, keypair, timestamp) in + self.persistence.get_page_of_20(offset).await.unwrap().iter().map(|n| { ( n.ip.to_string(), - n.keypair.clone(), - n.joined_at - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs() - .to_string(), + Keypair::from_bytes(&n.keypair.to_bytes()).unwrap(), + n.joined_at.duration_since(UNIX_EPOCH).unwrap().as_secs().to_string(), ) }) { let id = offset; - let pubkey = hex::encode(keypair.verifying_key().as_bytes()); - output.push(OutputRow { - id, - ip, - pubkey, - timestamp, - }); + let pubkey = keypair.pubkey().to_string(); + output.push(OutputRow { id, ip, pubkey, timestamp }); offset += 1; } Table::new(output).to_string() @@ -158,13 +138,10 @@ impl Store { message: &str, key_id: u64, ) -> Result { - let crate::persistence::Node{keypair, ..} = + let crate::persistence::Node { keypair, .. } = self.persistence.get_node_by_id(key_id).await?; - - // let signature = format!("{:?}", signing_key.sign(message.as_bytes())); - let signature = hex::encode(keypair.sign(message.as_bytes()).to_bytes()); - - Ok(signature) + let signature = keypair.sign_message(message.as_bytes()); + Ok(signature.to_string()) } pub async fn sign_message_with_key( @@ -172,31 +149,26 @@ impl Store { message: &str, pubkey: &str, ) -> Result { - let mut pubkey_bytes = [0u8; PUBLIC_KEY_LENGTH]; - hex::decode_to_slice(pubkey, &mut pubkey_bytes)?; - let pubkey = VerifyingKey::from_bytes(&pubkey_bytes)?; + let pubkey = Pubkey::from_str(&pubkey)?; - let signing_key = match self.get_privkey(&pubkey).await { + let keypair = match self.get_keypair(&pubkey).await { Some(k) => k, None => return Err(SigningError::KeyNotFound), }; - - // let signature = format!("{:?}", signing_key.sign(message.as_bytes())); - let signature = hex::encode(signing_key.sign(message.as_bytes()).to_bytes()); - - Ok(signature) + let signature = keypair.sign_message(message.as_bytes()); + Ok(signature.to_string()) } - pub async fn add_key(&self, pubkey: VerifyingKey, privkey: SigningKey) { - self.keys.insert(pubkey, privkey); + pub async fn add_key(&self, pubkey: Pubkey, keypair: Keypair) { + self.keys.insert(pubkey, keypair); } - pub async fn remove_key(&self, pubkey: &VerifyingKey) { + pub async fn remove_key(&self, pubkey: &Pubkey) { self.keys.remove(pubkey); } - async fn get_privkey(&self, pubkey: &VerifyingKey) -> Option { - self.keys.get(pubkey).map(|k| k.value().clone()) + async fn get_keypair(&self, pubkey: &Pubkey) -> Option { + self.keys.get(pubkey).map(|k| Keypair::from_bytes(&k.to_bytes()).unwrap()) } /// This returns true if NodeInfo got modified. @@ -204,15 +176,14 @@ impl Store { /// On a side note, there are two types of people in this world: /// 1. Those that can extrapolate... WAT? pub async fn process_node_update(&self, node: NodeUpdate) -> bool { - let key_bytes = match hex::decode(node.keypair.clone()) { - Ok(k) => k, - Err(_) => return false, - }; - let privkey = SigningKey::from_bytes(match &key_bytes.as_slice().try_into() { - Ok(p) => p, - Err(_) => return false, - }); - let pubkey = privkey.verifying_key(); + // solana-sdk is great; it panics if the base58 string is corrupted + // we wrap this in catch_unwind() to make sure it doesn't crash the app + let keypair = + match std::panic::catch_unwind(|| Keypair::from_base58_string(&node.keypair.clone())) { + Ok(k) => k, + Err(_) => return false, + }; + let pubkey = keypair.pubkey(); // TODO: check this suggestion // let updated_at_std = node @@ -223,19 +194,13 @@ impl Store { let updated_at_std: SystemTime = match node.updated_at { Some(ts) => { let duration = Duration::new(ts.seconds as u64, ts.nanos as u32); - UNIX_EPOCH - .checked_add(duration) - .unwrap_or(SystemTime::now()) + UNIX_EPOCH.checked_add(duration).unwrap_or(SystemTime::now()) } None => SystemTime::now(), }; - self.add_key(pubkey, privkey.clone()).await; - let node_info = NodeInfo { - pubkey, - updated_at: updated_at_std, - public: node.public, - }; + self.add_key(pubkey, Keypair::from_bytes(&keypair.to_bytes()).unwrap()).await; + let node_info = NodeInfo { pubkey, updated_at: updated_at_std, public: node.public }; if let Some(mut old_node_info) = self.update_node(node.ip.clone(), node_info.clone()).await { if !node_info.public { @@ -249,7 +214,7 @@ impl Store { false => false, } } else { - if let Ok(persistence_node) = (node.ip.as_str(), privkey, updated_at_std).try_into() { + if let Ok(persistence_node) = (node.ip.as_str(), keypair, updated_at_std).try_into() { if let Err(e) = self.persistence.append_node(persistence_node).await { println!("Could not save data to disk: {e}."); } @@ -271,10 +236,8 @@ impl Store { pub async fn remove_inactive_nodes(&self) { let mut dangling_pubkeys = Vec::new(); self.nodes.retain(|_, v| { - let age = SystemTime::now() - .duration_since(v.updated_at) - .unwrap_or(Duration::ZERO) - .as_secs(); + let age = + SystemTime::now().duration_since(v.updated_at).unwrap_or(Duration::ZERO).as_secs(); if age > 120 { dangling_pubkeys.push(v.pubkey.clone()); false @@ -290,10 +253,10 @@ impl Store { pub async fn get_localhost(&self) -> NodeUpdate { // TODO trigger reset_localhost_keys on error instead of expects let node = self.nodes.get("localhost").expect("no localhost node"); - let key = self.keys.get(&node.pubkey).expect("no localhost key"); + let keypair = self.keys.get(&node.pubkey).expect("no localhost key"); NodeUpdate { ip: "localhost".to_string(), - keypair: hex::encode(key.value().as_bytes()), + keypair: keypair.to_base58_string(), updated_at: Some(prost_types::Timestamp::from(node.value().updated_at)), public: false, } @@ -301,56 +264,39 @@ impl Store { /// refreshes the keys of the node and returns a protobuf for the network pub async fn reset_localhost_keys(&self) -> NodeUpdate { - let mut csprng = OsRng; - let keypair_raw = SigningKey::generate(&mut csprng); - let keypair = hex::encode(keypair_raw.as_bytes()); - let pubkey = keypair_raw.verifying_key(); + let keypair_raw = Keypair::new(); + let keypair = keypair_raw.to_base58_string(); + let pubkey = keypair_raw.pubkey(); let ip = "localhost".to_string(); let updated_at = SystemTime::now(); let public = false; - self.add_key(pubkey, keypair_raw.clone()).await; - if let Some(old_data) = self - .update_node( - ip.clone(), - NodeInfo { - pubkey, - updated_at, - public, - }, - ) - .await + self.add_key(pubkey, keypair_raw).await; + if let Some(old_data) = + self.update_node(ip.clone(), NodeInfo { pubkey, updated_at, public }).await { self.remove_key(&old_data.pubkey).await; }; let updated_at = Some(prost_types::Timestamp::from(updated_at)); - NodeUpdate { - ip, - keypair, - updated_at, - public, - } + NodeUpdate { ip, keypair, updated_at, public } } pub async fn get_full_node_list(&self) -> Vec { self.nodes .iter() .filter_map(|node| { - self.keys - .get(&node.value().pubkey) - .map(|signing_key| NodeUpdate { - ip: node.key().to_string(), - keypair: hex::encode(signing_key.as_bytes()), - updated_at: Some(prost_types::Timestamp::from(node.value().updated_at)), - public: node.value().public, - }) + self.keys.get(&node.value().pubkey).map(|keypair| NodeUpdate { + ip: node.key().to_string(), + keypair: keypair.to_base58_string(), + updated_at: Some(prost_types::Timestamp::from(node.value().updated_at)), + public: node.value().public, + }) }) .collect() } // returns a random node that does not have an active connection pub async fn get_random_node(&self) -> Option { - use rand::rngs::OsRng; - use rand::RngCore; + use rand::{rngs::OsRng, RngCore}; let len = self.nodes.len(); if len == 0 { return None; @@ -367,13 +313,12 @@ impl Store { #[cfg(test)] mod tests { - use super::*; - use dashmap::DashMap; - use ed25519_dalek::SigningKey; - use rand::rngs::OsRng; use std::time::{SystemTime, UNIX_EPOCH}; - use tokio::fs::File; - use tokio::io::AsyncWriteExt; + + use dashmap::DashMap; + use tokio::{fs::File, io::AsyncWriteExt}; + + use super::*; async fn setup_file_manager(function: &str) -> std::io::Result { let _ = tokio::fs::create_dir_all(".tmp").await; @@ -386,14 +331,11 @@ mod tests { #[test] fn node_info_creation() { - let keypair = SigningKey::generate(&mut OsRng); - let node_info = NodeInfo { - pubkey: keypair.verifying_key(), - updated_at: SystemTime::now(), - public: true, - }; + let keypair = Keypair::new(); + let node_info = + NodeInfo { pubkey: keypair.pubkey(), updated_at: SystemTime::now(), public: true }; - assert_eq!(node_info.pubkey, keypair.verifying_key()); + assert_eq!(node_info.pubkey, keypair.pubkey()); assert!(node_info.updated_at >= UNIX_EPOCH); assert!(node_info.public); } @@ -426,18 +368,18 @@ mod tests { #[tokio::test] async fn sign_message_with_key() { - let keypair = SigningKey::generate(&mut OsRng); - let pubkey_hex = hex::encode(keypair.verifying_key().as_bytes()); + let keypair = Keypair::new(); + let pubkey_string = keypair.pubkey().to_string(); let store = Store { nodes: DashMap::new(), conns: DashSet::new(), keys: DashMap::new(), persistence: setup_file_manager("sign_message_with_key").await.unwrap(), }; - store.keys.insert(keypair.verifying_key(), keypair); + store.keys.insert(keypair.pubkey(), keypair); let message = "Test message"; - let result = store.sign_message_with_key(message, &pubkey_hex).await; + let result = store.sign_message_with_key(message, &pubkey_string).await; assert!(result.is_ok()); if let Ok(signature) = result { @@ -447,15 +389,12 @@ mod tests { #[tokio::test] async fn process_node_update() { - let keypair = SigningKey::generate(&mut OsRng); + let keypair = Keypair::new(); let node_update = NodeUpdate { ip: "127.0.0.1".to_string(), - keypair: hex::encode(keypair.as_bytes()), + keypair: keypair.to_base58_string(), updated_at: Some(prost_types::Timestamp { - seconds: SystemTime::now() - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs() as i64, + seconds: SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_secs() as i64, nanos: 0, }), public: true, @@ -476,12 +415,9 @@ mod tests { #[tokio::test] async fn get_full_node_list() { - let keypair = SigningKey::generate(&mut OsRng); - let node_info = NodeInfo { - pubkey: keypair.verifying_key(), - updated_at: SystemTime::now(), - public: true, - }; + let keypair = Keypair::new(); + let node_info = + NodeInfo { pubkey: keypair.pubkey(), updated_at: SystemTime::now(), public: true }; let store = Store { nodes: DashMap::new(), @@ -491,13 +427,13 @@ mod tests { }; store.nodes.insert("127.0.0.1".to_string(), node_info); - store.keys.insert(keypair.verifying_key(), keypair.clone()); + store.keys.insert(keypair.pubkey(), Keypair::from_bytes(&keypair.to_bytes()).unwrap()); let node_list = store.get_full_node_list().await; assert_eq!(node_list.len(), 1); assert_eq!(node_list[0].ip, "127.0.0.1"); - assert_eq!(node_list[0].keypair, hex::encode(keypair.as_bytes())); + assert_eq!(node_list[0].keypair, keypair.to_base58_string()); assert!(node_list[0].public); } } diff --git a/src/http_server.rs b/src/http_server.rs index 9dbfe5e..9203ea2 100644 --- a/src/http_server.rs +++ b/src/http_server.rs @@ -1,9 +1,11 @@ use crate::datastore::{SigningError, Store}; +use actix_web::error::ResponseError; +use actix_web::http::StatusCode; +use actix_web::{web, App, HttpResponse, HttpServer, Responder, Result}; +use serde::Deserialize; +use std::fmt; use std::sync::Arc; -use salvo::affix; -use salvo::prelude::*; - const HOMEPAGE: &str = r#"Welcome, beloved hacker! I am a node that is part of the DeTEE Hacker Challenge network. @@ -33,6 +35,7 @@ If you manage to steal a key, contact us at https://detee.cloud Good luck! "#; +#[derive(Debug)] enum HTTPError { NoKeyID, NoPubkey, @@ -40,42 +43,53 @@ enum HTTPError { Store(SigningError), } -#[async_trait] -impl Writer for HTTPError { - async fn write(self, _req: &mut Request, _depot: &mut Depot, res: &mut Response) { - res.status_code(StatusCode::BAD_REQUEST); - match self { - HTTPError::NoKeyID => res.render("key ID must be specified as a get param"), - HTTPError::NoPubkey => res.render("pubkey must be specified as GET param"), - HTTPError::NoMessage => res.render("something must be specified as GET param"), - HTTPError::Store(e) => res.render(format!("{e}")), - }; +impl fmt::Display for HTTPError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match *self { + HTTPError::NoKeyID => write!(f, "Key ID must be specified as a query param"), + HTTPError::NoPubkey => write!(f, "Pubkey must be specified as a query param"), + HTTPError::NoMessage => write!(f, "Something must be specified as a query param"), + HTTPError::Store(ref err) => write!(f, "{}", err), + } } } -#[handler] -async fn homepage() -> String { - HOMEPAGE.to_string() +impl ResponseError for HTTPError { + fn status_code(&self) -> StatusCode { + StatusCode::BAD_REQUEST + } + + fn error_response(&self) -> HttpResponse { + HttpResponse::BadRequest().body(self.to_string()) + } } -#[handler] -async fn memory_list(depot: &mut Depot) -> String { - let ds = depot.obtain::>().unwrap(); - ds.tabled_memory_list().await // TODO: make this paginated +#[derive(Deserialize)] +struct SignQuery { + pubkey: Option, + something: Option, + key: Option, + page: Option, } -#[handler] -async fn memory_sign(req: &mut Request, depot: &mut Depot) -> Result { - let ds = depot.obtain::>().unwrap(); - let pubkey = match req.query::("pubkey") { - Some(k) => k, - None => return Err(HTTPError::NoPubkey), - }; +async fn homepage() -> impl Responder { + HttpResponse::Ok().body(HOMEPAGE) +} - let something = match req.query::("something") { - Some(k) => k, - None => return Err(HTTPError::NoMessage), - }; +async fn memory_list(store: web::Data>) -> impl Responder { + let ds = store.get_ref(); + let list = ds.tabled_memory_list().await; // TODO: make paginated + HttpResponse::Ok().body(list) +} + +async fn memory_sign( + store: web::Data>, + req: web::Query, +) -> Result { + let ds = store.get_ref(); + + let pubkey = req.pubkey.clone().ok_or(HTTPError::NoPubkey)?; + let something = req.something.clone().ok_or(HTTPError::NoMessage)?; match ds.sign_message_with_key(&something, &pubkey).await { Ok(s) => Ok(s), @@ -83,29 +97,21 @@ async fn memory_sign(req: &mut Request, depot: &mut Depot) -> Result Result { - let ds = depot.obtain::>().unwrap(); - let page = match req.query::("page") { - Some(n) => n, - None => 0, - }; - - Ok(ds.tabled_disk_list(page).await) +async fn disk_list(store: web::Data>, req: web::Query) -> impl Responder { + let ds = store.get_ref(); + let page = req.page.unwrap_or(0); + let list = ds.tabled_disk_list(page).await; + HttpResponse::Ok().body(list) } -#[handler] -async fn disk_sign(req: &mut Request, depot: &mut Depot) -> Result { - let ds = depot.obtain::>().unwrap(); - let key = match req.query::("key") { - Some(k) => k, - None => return Err(HTTPError::NoKeyID), - }; +async fn disk_sign( + store: web::Data>, + req: web::Query, +) -> Result { + let ds = store.get_ref(); - let something = match req.query::("something") { - Some(k) => k, - None => return Err(HTTPError::NoMessage), - }; + let key = req.key.ok_or(HTTPError::NoKeyID)?; + let something = req.something.clone().ok_or(HTTPError::NoMessage)?; match ds.disk_sign_message_with_key(&something, key).await { Ok(s) => Ok(s), @@ -114,20 +120,24 @@ async fn disk_sign(req: &mut Request, depot: &mut Depot) -> Result) { - let acceptor = TcpListener::new("0.0.0.0:31372").bind().await; - let router = Router::new() - .hoop(affix::inject(ds)) - .get(homepage) - .push( - Router::with_path("memory") - .get(memory_list) - .push(Router::with_path("sign").get(memory_sign)), - ) - .push( - Router::with_path("disk") - .get(disk_list) - .push(Router::with_path("sign").get(disk_sign)), - ); - println!("{:?}", router); - Server::new(acceptor).serve(router).await; + HttpServer::new(move || { + App::new() + .app_data(web::Data::new(ds.clone())) + .route("/", web::get().to(homepage)) + .service( + web::scope("/memory") + .route("", web::get().to(memory_list)) + .route("/sign", web::get().to(memory_sign)), + ) + .service( + web::scope("/disk") + .route("", web::get().to(disk_list)) + .route("/sign", web::get().to(disk_sign)), + ) + }) + .bind("0.0.0.0:31372") + .unwrap() + .run() + .await + .unwrap(); } diff --git a/src/persistence.rs b/src/persistence.rs index 3397b15..a943c08 100644 --- a/src/persistence.rs +++ b/src/persistence.rs @@ -1,14 +1,17 @@ #![allow(dead_code)] -use ed25519_dalek::SigningKey; -use ed25519_dalek::KEYPAIR_LENGTH; -use std::net::AddrParseError; -use std::net::Ipv4Addr; -use std::time::{Duration, SystemTime, UNIX_EPOCH}; -use tokio::fs::File; -use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom}; -use tokio::sync::Mutex; +use solana_sdk::signer::keypair::Keypair; +use std::{ + net::{AddrParseError, Ipv4Addr}, + time::{Duration, SystemTime, UNIX_EPOCH}, +}; +use tokio::{ + fs::File, + io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom}, + sync::Mutex, +}; const DATA_SIZE: usize = 76; +const KEYPAIR_LENGTH: usize = 64; pub enum Error { CorruptedIP, @@ -20,21 +23,25 @@ impl From for Error { } } -#[derive(Clone)] pub struct Node { pub ip: Ipv4Addr, - pub keypair: SigningKey, + pub keypair: Keypair, pub joined_at: SystemTime, } -impl TryFrom<(&str, SigningKey, SystemTime)> for Node { +impl Clone for Node { + fn clone(&self) -> Self { + let cloned_keypair = Keypair::from_bytes(&self.keypair.to_bytes()).unwrap(); + + Node { ip: self.ip, keypair: cloned_keypair, joined_at: self.joined_at } + } +} + +impl TryFrom<(&str, Keypair, SystemTime)> for Node { type Error = Error; - fn try_from(value: (&str, SigningKey, SystemTime)) -> Result { - Ok(Self { - ip: value.0.parse()?, - keypair: value.1, - joined_at: value.2, - }) + + fn try_from(value: (&str, Keypair, SystemTime)) -> Result { + Ok(Self { ip: value.0.parse()?, keypair: value.1, joined_at: value.2 }) } } @@ -43,21 +50,16 @@ impl Node { self.ip.to_string() } - fn signing_key(&self) -> SigningKey { - self.keypair.clone() + fn signing_key(&self) -> Keypair { + Keypair::from_bytes(&self.keypair.to_bytes()).unwrap() } fn to_bytes(self) -> [u8; DATA_SIZE] { let mut result = [0; DATA_SIZE]; result[0..4].copy_from_slice(&self.ip.octets()); - result[4..68].copy_from_slice(&self.keypair.to_keypair_bytes()); + result[4..68].copy_from_slice(&self.keypair.to_bytes()); result[68..DATA_SIZE].copy_from_slice( - &self - .joined_at - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs() - .to_le_bytes(), + &self.joined_at.duration_since(UNIX_EPOCH).unwrap().as_secs().to_le_bytes(), ); result } @@ -66,15 +68,11 @@ impl Node { let ip: [u8; 4] = bytes[0..4].try_into().unwrap(); let ip: Ipv4Addr = ip.into(); let keypair: [u8; KEYPAIR_LENGTH] = bytes[4..68].try_into().unwrap(); - let keypair: SigningKey = SigningKey::from_keypair_bytes(&keypair).unwrap(); + let keypair: Keypair = Keypair::from_bytes(&keypair).unwrap(); let joined_at: [u8; 8] = bytes[68..DATA_SIZE].try_into().unwrap(); let joined_at: u64 = u64::from_le_bytes(joined_at); let joined_at = SystemTime::UNIX_EPOCH + Duration::from_secs(joined_at); - Self { - ip, - keypair, - joined_at, - } + Self { ip, keypair, joined_at } } } @@ -85,9 +83,7 @@ pub struct FileManager { impl FileManager { pub async fn init(path: &str) -> std::io::Result { let file = File::options().read(true).append(true).open(path).await?; - Ok(Self { - file: Mutex::new(file), - }) + Ok(Self { file: Mutex::new(file) }) } pub async fn append_node(&self, node: Node) -> std::io::Result<()> { @@ -100,10 +96,7 @@ impl FileManager { pub async fn get_node_by_id(&self, id: u64) -> std::io::Result { let mut file = self.file.lock().await; - file.seek(SeekFrom::Start( - id.wrapping_mul(DATA_SIZE.try_into().unwrap_or(0)), - )) - .await?; + file.seek(SeekFrom::Start(id.wrapping_mul(DATA_SIZE.try_into().unwrap_or(0)))).await?; let mut node_bytes = [0; DATA_SIZE]; file.read_exact(&mut node_bytes).await?; Ok(Node::from_bytes(node_bytes)) @@ -113,11 +106,7 @@ impl FileManager { /// Specify offset (the number of nodes to skip). pub async fn get_page_of_20(&self, offset: u64) -> std::io::Result> { let mut file = self.file.lock().await; - file.seek(SeekFrom::Start( - offset - .wrapping_mul(DATA_SIZE.try_into().unwrap_or(0)), - )) - .await?; + file.seek(SeekFrom::Start(offset.wrapping_mul(DATA_SIZE.try_into().unwrap_or(0)))).await?; let mut nodes = Vec::new(); let mut count = 0; loop { @@ -139,12 +128,9 @@ impl FileManager { mod tests { use super::*; - use ed25519_dalek::SigningKey; - use rand::rngs::OsRng; use rand::Rng; use std::io::Result; - use tokio::fs::remove_file; - use tokio::io::AsyncWriteExt; + use tokio::{fs::remove_file, io::AsyncWriteExt}; const TEST_FILE_PREFIX: &str = ".tmp/test_"; fn get_test_file_name(function: &str) -> String { @@ -162,11 +148,11 @@ mod tests { #[test] fn node_round_trip() { - let keypair = SigningKey::generate(&mut OsRng); + let keypair = Keypair::new(); let original_node = Node { ip: "192.168.1.1".parse().unwrap(), - keypair: keypair.clone(), + keypair: Keypair::from_bytes(&keypair.to_bytes()).unwrap(), joined_at: SystemTime::now(), }; @@ -174,21 +160,10 @@ mod tests { let restored_node = Node::from_bytes(node_bytes); assert_eq!(original_node.ip_as_string(), restored_node.ip_as_string()); + assert_eq!(original_node.keypair.to_bytes(), restored_node.keypair.to_bytes()); assert_eq!( - original_node.keypair.to_keypair_bytes(), - restored_node.keypair.to_keypair_bytes() - ); - assert_eq!( - original_node - .joined_at - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs(), - restored_node - .joined_at - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs() + original_node.joined_at.duration_since(UNIX_EPOCH).unwrap().as_secs(), + restored_node.joined_at.duration_since(UNIX_EPOCH).unwrap().as_secs() ); } @@ -204,12 +179,12 @@ mod tests { } fn get_random_node() -> Node { - let keypair = SigningKey::generate(&mut OsRng); + let keypair = Keypair::new(); let mut rng = rand::thread_rng(); let ipv4 = Ipv4Addr::new(rng.gen(), rng.gen(), rng.gen(), rng.gen()); Node { ip: ipv4, - keypair: keypair.clone(), + keypair: Keypair::from_bytes(&keypair.to_bytes()).unwrap(), joined_at: SystemTime::now(), } } @@ -225,11 +200,7 @@ mod tests { assert_eq!(node.keypair, retrieved_node.keypair); assert_eq!( node.joined_at.duration_since(UNIX_EPOCH).unwrap().as_secs(), - retrieved_node - .joined_at - .duration_since(UNIX_EPOCH) - .unwrap() - .as_secs() + retrieved_node.joined_at.duration_since(UNIX_EPOCH).unwrap().as_secs() ); remove_file(get_test_file_name(function_name)).await?; Ok(()) @@ -248,10 +219,7 @@ mod tests { manager.append_node(node3.clone()).await.unwrap(); let retrieved_node2 = manager.get_node_by_id(1).await?; assert_eq!(node1.ip_as_string(), retrieved_node1.ip_as_string()); - assert_eq!( - node1.keypair.to_keypair_bytes(), - retrieved_node1.keypair.to_keypair_bytes() - ); + assert_eq!(node1.keypair.to_bytes(), retrieved_node1.keypair.to_bytes()); assert_eq!(node2.ip_as_string(), retrieved_node2.ip_as_string()); assert_eq!(node2.keypair, retrieved_node2.keypair); let retrieved_node3 = manager.get_node_by_id(2).await?;