diff --git a/Cargo.lock b/Cargo.lock index 86cc4fa..d167f8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -114,9 +114,9 @@ dependencies = [ [[package]] name = "allocator-api2" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45862d1c77f2228b9e10bc609d5bc203d86ebc9b87ad8d5d5167a6c9abf739d9" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "alloy-consensus" @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.13" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3aeeb5825c2fc8c2662167058347cd0cafc3cb15bcb5cdb1758a63c2dca0409e" +checksum = "9db948902dfbae96a73c2fbf1f7abec62af034ab883e4c777c3fd29702bd6e2c" dependencies = [ "alloy-rlp", "arbitrary", @@ -193,7 +193,7 @@ dependencies = [ "proptest-derive", "rand", "ruint", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "serde", "sha3 0.10.8", "tiny-keccak", @@ -218,7 +218,7 @@ checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -493,7 +493,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -505,7 +505,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -563,7 +563,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -598,7 +598,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -896,7 +896,7 @@ dependencies = [ [[package]] name = "bls" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "alloy-primitives", "arbitrary", @@ -982,9 +982,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" dependencies = [ "serde", ] @@ -1027,9 +1027,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd9de9f2205d5ef3fd67e685b0df337994ddd4495e2a28d185500d0e1edfea47" +checksum = "f34d93e62b03caf570cccc334cbc6c2fceca82f39211051345108adcba3eebdc" dependencies = [ "jobserver", "libc", @@ -1136,7 +1136,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1165,7 +1165,7 @@ dependencies = [ [[package]] name = "clap_utils" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "alloy-primitives", "clap", @@ -1228,7 +1228,7 @@ dependencies = [ [[package]] name = "compare_fields" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "itertools 0.10.5", ] @@ -1245,7 +1245,7 @@ dependencies = [ [[package]] name = "compare_fields_derive" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "quote", "syn 1.0.109", @@ -1262,9 +1262,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.13.2" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487981fa1af147182687064d0a2c336586d337a606595ced9ffb0c685c250c73" +checksum = "4b0485bab839b018a8f1723fc5391819fea5f8f0f32288ef8a735fd096b6160c" dependencies = [ "cfg-if", "cpufeatures", @@ -1536,7 +1536,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1584,7 +1584,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1606,7 +1606,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1766,7 +1766,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1777,7 +1777,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -1798,7 +1798,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "unicode-xid", ] @@ -1836,7 +1836,7 @@ dependencies = [ [[package]] name = "directory" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "clap", "clap_utils 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -1962,7 +1962,7 @@ dependencies = [ "parking_lot 0.12.3", "rand", "smallvec", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tracing", "uint 0.10.0", @@ -1995,7 +1995,7 @@ dependencies = [ "parking_lot 0.12.3", "rand", "smallvec", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tracing", "uint 0.10.0", @@ -2010,7 +2010,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2171,7 +2171,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2213,12 +2213,12 @@ dependencies = [ [[package]] name = "errno" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2300,7 +2300,7 @@ dependencies = [ [[package]] name = "eth2_config" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "paste", "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -2322,7 +2322,7 @@ dependencies = [ [[package]] name = "eth2_interop_keypairs" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "bls 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "ethereum_hashing", @@ -2390,7 +2390,7 @@ dependencies = [ [[package]] name = "eth2_network_config" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "bytes", "discv5 0.9.0", @@ -2557,7 +2557,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -2605,9 +2605,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.2" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ "event-listener 5.3.1", "pin-project-lite", @@ -2794,7 +2794,7 @@ dependencies = [ [[package]] name = "fixed_bytes" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "alloy-primitives", "safe_arith 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -2960,7 +2960,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3098,7 +3098,7 @@ checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3140,7 +3140,7 @@ dependencies = [ [[package]] name = "gossipsub" version = "0.5.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "async-channel", "asynchronous-codec", @@ -3351,7 +3351,7 @@ dependencies = [ "ipnet", "once_cell", "rand", - "socket2 0.5.7", + "socket2 0.5.8", "thiserror 1.0.69", "tinyvec", "tokio", @@ -3552,7 +3552,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tower-service", "tracing", @@ -3759,7 +3759,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -3866,7 +3866,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" dependencies = [ - "parity-scale-codec 3.7.0", + "parity-scale-codec 3.6.12", ] [[package]] @@ -3904,14 +3904,14 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] name = "indexmap" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "arbitrary", "equivalent", @@ -3948,7 +3948,7 @@ dependencies = [ [[package]] name = "int_to_bytes" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "bytes", ] @@ -3979,7 +3979,7 @@ version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" dependencies = [ - "socket2 0.5.7", + "socket2 0.5.8", "widestring 1.1.0", "windows-sys 0.48.0", "winreg", @@ -4043,10 +4043,11 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +checksum = "a865e038f7f6ed956f788f0d7d60c541fff74c7bd74272c5d4cf15c63743e705" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -4143,7 +4144,7 @@ dependencies = [ [[package]] name = "kzg" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "arbitrary", "c-kzg", @@ -4193,9 +4194,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.166" +version = "0.2.167" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2ccc108bbc0b1331bd061864e7cd823c0cab660bbe6970e66e2c0614decde36" +checksum = "09d6582e104315a817dff97f75133544b2e094ee22447d2acf4a74e189ba06fc" [[package]] name = "libflate" @@ -4420,7 +4421,7 @@ dependencies = [ "libp2p-swarm", "rand", "smallvec", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tracing", "void", @@ -4541,7 +4542,7 @@ dependencies = [ "rand", "ring 0.17.8", "rustls 0.23.19", - "socket2 0.5.7", + "socket2 0.5.8", "thiserror 1.0.69", "tokio", "tracing", @@ -4580,7 +4581,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -4595,7 +4596,7 @@ dependencies = [ "libc", "libp2p-core", "libp2p-identity", - "socket2 0.5.7", + "socket2 0.5.8", "tokio", "tracing", ] @@ -4783,7 +4784,7 @@ dependencies = [ [[package]] name = "lighthouse_network" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -4793,7 +4794,6 @@ dependencies = [ "dirs 3.0.2", "discv5 0.9.0", "either", - "error-chain", "ethereum_ssz", "ethereum_ssz_derive", "fnv", @@ -4842,7 +4842,7 @@ dependencies = [ [[package]] name = "lighthouse_version" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "git-version", "target_info", @@ -4921,7 +4921,7 @@ dependencies = [ [[package]] name = "logging" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "chrono", "metrics 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -4969,7 +4969,7 @@ dependencies = [ [[package]] name = "lru_cache" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "fnv", ] @@ -5045,7 +5045,7 @@ dependencies = [ [[package]] name = "merkle_proof" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "alloy-primitives", "ethereum_hashing", @@ -5087,7 +5087,7 @@ dependencies = [ [[package]] name = "metrics" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "prometheus", ] @@ -5148,11 +5148,10 @@ dependencies = [ [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi 0.3.9", "libc", "wasi", "windows-sys 0.52.0", @@ -5537,7 +5536,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5637,16 +5636,15 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.7.0" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8be4817d39f3272f69c59fe05d0535ae6456c2dc2fa1ba02910296c7e0a5c590" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ "arrayvec", "bitvec 1.0.1", "byte-slice-cast", "impl-trait-for-tuples", "parity-scale-codec-derive 3.7.0", - "rustversion", "serde", ] @@ -5671,7 +5669,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5819,7 +5817,7 @@ checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -5834,6 +5832,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der 0.7.9", + "pkcs8 0.10.2", + "spki 0.7.3", +] + [[package]] name = "pkcs8" version = "0.9.0" @@ -5931,7 +5940,7 @@ dependencies = [ [[package]] name = "pretty_reqwest_error" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "reqwest", "sensitive_url 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", @@ -6051,7 +6060,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6082,7 +6091,7 @@ checksum = "6ff7ff745a347b87471d859a377a9a404361e7efc2a971d73424a6d183c0fc77" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -6174,9 +6183,9 @@ dependencies = [ "pin-project-lite", "quinn-proto", "quinn-udp", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "rustls 0.23.19", - "socket2 0.5.7", + "socket2 0.5.8", "thiserror 2.0.3", "tokio", "tracing", @@ -6192,7 +6201,7 @@ dependencies = [ "getrandom", "rand", "ring 0.17.8", - "rustc-hash 2.0.0", + "rustc-hash 2.1.0", "rustls 0.23.19", "rustls-pki-types", "slab", @@ -6211,7 +6220,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2 0.5.7", + "socket2 0.5.8", "tracing", "windows-sys 0.59.0", ] @@ -6556,6 +6565,26 @@ dependencies = [ "archery", ] +[[package]] +name = "rsa" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47c75d7c5c6b673e58bf54d8544a9f432e3a925b0e80f7cd3602ab5c50c55519" +dependencies = [ + "const-oid", + "digest 0.10.7", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8 0.10.2", + "rand_core", + "signature 2.2.0", + "spki 0.7.3", + "subtle", + "zeroize", +] + [[package]] name = "rtnetlink" version = "0.13.1" @@ -6588,7 +6617,7 @@ dependencies = [ "fastrlp", "num-bigint", "num-traits", - "parity-scale-codec 3.7.0", + "parity-scale-codec 3.6.12", "primitive-types 0.12.2", "proptest", "rand", @@ -6647,9 +6676,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc-hash" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" [[package]] name = "rustc-hex" @@ -6842,7 +6871,7 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#75a5 [[package]] name = "safe_arith" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" [[package]] name = "salsa20" @@ -6861,7 +6890,7 @@ checksum = "346a3b32eba2640d17a9cb5927056b08f3de90f65b72fe09402c2ad07d684d0b" dependencies = [ "cfg-if", "derive_more 1.0.0", - "parity-scale-codec 3.7.0", + "parity-scale-codec 3.6.12", "scale-info-derive", ] @@ -6874,7 +6903,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7016,7 +7045,7 @@ dependencies = [ [[package]] name = "sensitive_url" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "serde", "url", @@ -7049,7 +7078,7 @@ checksum = "ad1e866f866923f252f05c889987993144fb74e722403468a4ebd70c3cd756c0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7082,7 +7111,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7441,9 +7470,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", "windows-sys 0.52.0", @@ -7485,6 +7514,9 @@ dependencies = [ name = "ssv_types" version = "0.1.0" dependencies = [ + "base64 0.22.1", + "derive_more 1.0.0", + "rsa", "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] @@ -7634,7 +7666,7 @@ dependencies = [ [[package]] name = "swap_or_not_shuffle" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "alloy-primitives", "ethereum_hashing", @@ -7654,9 +7686,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.89" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d46482f1c1c87acd84dea20c1bf5ebff4c757009ed6bf19cfd36fb10e92c4e" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -7683,7 +7715,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7763,7 +7795,7 @@ dependencies = [ [[package]] name = "task_executor" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "async-channel", "futures", @@ -7801,9 +7833,9 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" +checksum = "5352447f921fda68cf61b4101566c0bdb5104eff6804d0678e5227580ab6a4e9" dependencies = [ "rustix 0.38.41", "windows-sys 0.59.0", @@ -7821,7 +7853,7 @@ dependencies = [ [[package]] name = "test_random_derive" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "quote", "syn 1.0.109", @@ -7853,7 +7885,7 @@ checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7864,7 +7896,7 @@ checksum = "f077553d607adc1caf65430528a576c757a71ed73944b66ebb58ef2bbd243568" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -7982,7 +8014,7 @@ dependencies = [ "mio", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.7", + "socket2 0.5.8", "tokio-macros", "windows-sys 0.52.0", ] @@ -8005,7 +8037,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -8168,7 +8200,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -8194,9 +8226,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", @@ -8249,7 +8281,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -8336,7 +8368,7 @@ dependencies = [ [[package]] name = "types" version = "0.2.1" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -8520,7 +8552,7 @@ dependencies = [ [[package]] name = "unused_port" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=unstable#720f59602100664455ac88556606899d7a4836c3" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#c042dc14d74352512b7632e0ee6ec07f1aa26b3a" dependencies = [ "lru_cache 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "parking_lot 0.12.3", @@ -8705,9 +8737,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +checksum = "d15e63b4482863c109d70a7b8706c1e364eb6ea449b201a76c5b89cedcec2d5c" dependencies = [ "cfg-if", "once_cell", @@ -8716,36 +8748,37 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +checksum = "8d36ef12e3aaca16ddd3f67922bc63e48e953f126de60bd33ccc0101ef9998cd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.45" +version = "0.4.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +checksum = "9dfaf8f50e5f293737ee323940c7d8b08a66a95a419223d9f41610ca08b0833d" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +checksum = "705440e08b42d3e4b36de7d66c944be628d579796b8090bfa3471478a2260051" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -8753,22 +8786,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +checksum = "98c9ae5a76e46f4deecd0f0255cc223cfa18dc9b261213b8aa0c7b36f61b3f1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.95" +version = "0.2.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" +checksum = "6ee99da9c5ba11bd675621338ef6fa52296b76b83305e9b6e5c77d4c286d6d49" [[package]] name = "wasm-streams" @@ -8785,9 +8818,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.72" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +checksum = "a98bc3c33f0fe7e59ad7cd041b89034fa82a7c2d4365ca538dda6cdaf513863c" dependencies = [ "js-sys", "wasm-bindgen", @@ -9266,7 +9299,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -9288,7 +9321,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -9308,7 +9341,7 @@ checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", "synstructure", ] @@ -9329,7 +9362,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] @@ -9351,7 +9384,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.89", + "syn 2.0.90", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 68a0629..dd01915 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,6 +52,8 @@ tokio = { version = "1.39.2", features = [ ] } tracing = "0.1.40" tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] } +rsa = "0.9.7" +base64 = "0.22.1" [profile.maxperf] inherits = "release" diff --git a/anchor/common/ssv_types/Cargo.toml b/anchor/common/ssv_types/Cargo.toml index dfde9c1..c1c35dc 100644 --- a/anchor/common/ssv_types/Cargo.toml +++ b/anchor/common/ssv_types/Cargo.toml @@ -6,3 +6,6 @@ authors = ["Sigma Prime "] [dependencies] types = { workspace = true} +rsa = { workspace = true } +derive_more = { workspace = true } +base64 = { workspace = true } diff --git a/anchor/common/ssv_types/src/committee.rs b/anchor/common/ssv_types/src/committee.rs index 2ac9c1f..89f9594 100644 --- a/anchor/common/ssv_types/src/committee.rs +++ b/anchor/common/ssv_types/src/committee.rs @@ -1,23 +1,65 @@ -use crate::{Operator, OperatorID, OperatorPublicKey}; +use crate::util::parse_rsa; +use crate::{Operator, OperatorId}; +use derive_more::{Deref, From}; +use rsa::RsaPublicKey; +use std::cmp::Eq; +use std::fmt::Debug; +use std::hash::Hash; use types::Domain; /// Unique identifier for a committee. -pub type CommitteeID = u64; +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, From, Deref)] +pub struct CommitteeId(u64); -/// Member of a SSV Committee. A `CommitteeMember` is just an operator that is part of the committee +/// Member of a SSV Committee. A CommitteeMember is just an operator that is part of the committee /// a validator has chosen to distribute its keyshares to. #[derive(Debug, Clone)] pub struct CommitteeMember { - // Unique identifier for the operator - pub operator_id: OperatorID, - // Unique identifier for the committee this member is a part of - pub committee_id: CommitteeID, - // Base-64 encoded PEM RSA public key of the operator - pub share_public_key: OperatorPublicKey, - // Number of nodes that are faulty/malicious in the committee + /// Unique identifier for the operator + pub operator_id: OperatorId, + /// Unique identifier for the committee this member is a part of + pub committee_id: CommitteeId, + /// Base-64 encoded PEM RSA public key of the operator + pub operator_public_key: RsaPublicKey, + /// Number of nodes that are faulty/malicious in the committee pub faulty: u64, - // All of the operators that are a part of this committee + /// All of the operators that are a part of this committee pub members: Vec, - // Signature domain + /// Signature domain pub domain: Domain, } + +impl CommitteeMember { + /// Creates a new committee member from a PEM-encoded public key string + pub fn new( + pem_data: &str, + operator_id: OperatorId, + committee_id: CommitteeId, + domain: Domain, + ) -> Result { + let rsa_pubkey = parse_rsa(pem_data)?; + Ok(Self::new_with_pubkey( + rsa_pubkey, + operator_id, + committee_id, + domain, + )) + } + + /// Creates a new committee member from an existing RSA public key + pub fn new_with_pubkey( + rsa_pubkey: RsaPublicKey, + operator_id: OperatorId, + committee_id: CommitteeId, + domain: Domain, + ) -> Self { + Self { + operator_id, + committee_id, + operator_public_key: rsa_pubkey, + faulty: 0, + members: Vec::new(), + domain, + } + } +} diff --git a/anchor/common/ssv_types/src/lib.rs b/anchor/common/ssv_types/src/lib.rs index 099c297..397e357 100644 --- a/anchor/common/ssv_types/src/lib.rs +++ b/anchor/common/ssv_types/src/lib.rs @@ -1,6 +1,7 @@ -pub use committee::{CommitteeID, CommitteeMember}; -pub use operator::{Operator, OperatorID, OperatorPublicKey}; +pub use committee::{CommitteeId, CommitteeMember}; +pub use operator::{Operator, OperatorId}; pub use share::SSVShare; mod committee; mod operator; mod share; +mod util; diff --git a/anchor/common/ssv_types/src/operator.rs b/anchor/common/ssv_types/src/operator.rs index b5f4c10..70b9629 100644 --- a/anchor/common/ssv_types/src/operator.rs +++ b/anchor/common/ssv_types/src/operator.rs @@ -1,14 +1,54 @@ -/// Unique identifier for an Operator -pub type OperatorID = u64; +use crate::util::parse_rsa; +use derive_more::{Deref, From}; +use rsa::RsaPublicKey; +use std::cmp::Eq; +use std::fmt::Debug; +use std::hash::Hash; -/// Operator RSA public key -pub type OperatorPublicKey = [u8; 459]; +/// Unique identifier for an Operator. +#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash, From, Deref)] +pub struct OperatorId(u64); /// Client responsible for maintaining the overall health of the network. #[derive(Debug, Clone)] pub struct Operator { - // ID to uniquely identify this operator - pub id: OperatorID, - // Base-64 encoded PEM RSA public key - pub public_key: OperatorPublicKey, + /// ID to uniquely identify this operator + pub id: OperatorId, + /// Base-64 encoded PEM RSA public key + pub public_key: RsaPublicKey, +} + +impl Operator { + /// Creates a new operator from its OperatorId and PEM-encoded public key string + pub fn new(pem_data: &str, operator_id: OperatorId) -> Result { + let rsa_pubkey = parse_rsa(pem_data)?; + Ok(Self::new_with_pubkey(rsa_pubkey, operator_id)) + } + + // Creates a new operator from an existing RSA public key and OperatorId + pub fn new_with_pubkey(rsa_pubkey: RsaPublicKey, operator_id: OperatorId) -> Self { + Self { + id: operator_id, + public_key: rsa_pubkey, + } + } +} + +#[cfg(test)] +mod operator_tests { + use super::*; + + #[test] + fn operator_from_pubkey_and_id() { + // Random valid operator public key and id: https://explorer.ssv.network/operators/1141 + let pem_data = "LS0tLS1CRUdJTiBSU0EgUFVCTElDIEtFWS0tLS0tCk1JSUJJakFOQmdrcWhraUc5dzBCQVFFRkFBT0NBUThBTUlJQkNnS0NBUUVBbFFmQVIzMEd4bFpacEwrNDByU0IKTEpSYlkwY2laZDBVMXhtTlp1bFB0NzZKQXJ5d2lia0Y4SFlQV2xkM3dERVdWZXZjRzRGVVBSZ0hDM1MrTHNuMwpVVC9TS280eE9nNFlnZ0xqbVVXQysyU3ZGRFhXYVFvdFRXYW5UU0drSEllNGFnTVNEYlUzOWhSMWdOSTJhY2NNCkVCcjU2eXpWcFMvKytkSk5xU002S1FQM3RnTU5ia2IvbEtlY0piTXM0ZWNRMTNkWUQwY3dFNFQxcEdTYUdhcEkKbFNaZ2lYd0cwSGFNTm5GUkt0OFlkZjNHaTFMRlh3Zlo5NHZFRjJMLzg3RCtidjdkSFVpSGRjRnh0Vm0rVjVvawo3VFptcnpVdXB2NWhKZ3lDVE9zc0xHOW1QSGNORnhEVDJ4NUJKZ2FFOVpJYnMrWVZ5a1k3UTE4VEhRS2lWcDFaCmp3SURBUUFCCi0tLS0tRU5EIFJTQSBQVUJMSUMgS0VZLS0tLS0K"; + let operator_id = 1141; + + let operator = Operator::new(pem_data, operator_id.into()); + assert!(operator.is_ok()); + + if let Ok(op) = operator { + assert_eq!(op.id.0, operator_id); + } + } } diff --git a/anchor/common/ssv_types/src/share.rs b/anchor/common/ssv_types/src/share.rs index 75e5ba7..0c76628 100644 --- a/anchor/common/ssv_types/src/share.rs +++ b/anchor/common/ssv_types/src/share.rs @@ -1,17 +1,19 @@ -use crate::CommitteeID; +use crate::CommitteeId; use std::time::SystemTime; use types::{Address, Domain, Graffiti, PublicKey}; type ValidatorIndex = usize; -/// Share of a key that a operator owns and accompanying metadata +/// Share of a key that a operator owns and its accompanying metadata. #[derive(Debug, Clone)] pub struct SSVShare { + // A single share of a validator private key. pub share: Share, + // Miscellaneous metadata relevant to the share pub metadata: Metadata, } -/// One of N shares of a split validator key +/// One of N shares of a split validator key. #[derive(Debug, Clone)] pub struct Share { /// Index of the validator @@ -30,16 +32,16 @@ pub struct Share { pub graffiti: Graffiti, } -/// A operator who holds a portion of the share +/// A operator who holds a portion of the share. #[derive(Debug, Clone)] pub struct ShareMember { /// Unique identifier for the operator - pub operator: CommitteeID, + pub operator: CommitteeId, /// The public key for this members share pub share_public_key: PublicKey, } -/// General metadata +/// General metadata. #[derive(Debug, Clone)] pub struct Metadata { /// The owner of the validator diff --git a/anchor/common/ssv_types/src/util.rs b/anchor/common/ssv_types/src/util.rs new file mode 100644 index 0000000..4de4381 --- /dev/null +++ b/anchor/common/ssv_types/src/util.rs @@ -0,0 +1,29 @@ +use base64::prelude::*; +use rsa::pkcs8::DecodePublicKey; +use rsa::RsaPublicKey; + +// Parse from a RSA public key string into the associated RSA representation +pub fn parse_rsa(pem_data: &str) -> Result { + // First decode the base64 data + let pem_decoded = BASE64_STANDARD + .decode(pem_data) + .map_err(|e| format!("Unable to decode base64 pem data: {}", e))?; + + // Convert the decoded data to a string + let mut pem_string = String::from_utf8(pem_decoded) + .map_err(|e| format!("Unable to convert decoded pem data into a string: {}", e))?; + + // Fix the header - replace PKCS1 header with PKCS8 header + pem_string = pem_string + .replace( + "-----BEGIN RSA PUBLIC KEY-----", + "-----BEGIN PUBLIC KEY-----", + ) + .replace("-----END RSA PUBLIC KEY-----", "-----END PUBLIC KEY-----"); + + // Parse the PEM string into an RSA public key using PKCS8 format + let rsa_pubkey = RsaPublicKey::from_public_key_pem(&pem_string) + .map_err(|e| format!("Failed to parse RSA public key: {}", e))?; + + Ok(rsa_pubkey) +}