diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 004cc533..7fb54ff9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,6 +23,9 @@ jobs: run: | rustup target add wasm32-unknown-unknown + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: Build working-directory: ${{ matrix.pkg }} run: cargo build @@ -46,6 +49,9 @@ jobs: run: | rustup target add wasm32-unknown-unknown + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: Clippy working-directory: ${{ matrix.pkg }} run: RUSTFLAGS="-Dwarnings" cargo clippy diff --git a/Cargo.lock b/Cargo.lock index 34ada426..76a52f42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,43 +10,44 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aead" -version = "0.3.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ "generic-array 0.14.6", ] [[package]] name = "aead" -version = "0.4.3" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +checksum = "5c192eb8f11fc081b0fe4259ba5af04217d4e0faddd02417310a927911abd7c8" dependencies = [ + "crypto-common", "generic-array 0.14.6", ] [[package]] name = "aes" -version = "0.6.0" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "aes-soft", - "aesni", - "cipher 0.2.5", + "cfg-if", + "cipher 0.3.0", + "cpufeatures", + "opaque-debug 0.3.0", ] [[package]] name = "aes" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +checksum = "433cfd6710c9986c576a25ca913c39d66a6474107b406f34f91d4a8923395241" dependencies = [ "cfg-if", - "cipher 0.3.0", + "cipher 0.4.3", "cpufeatures", - "opaque-debug 0.3.0", ] [[package]] @@ -59,28 +60,22 @@ dependencies = [ "aes 0.7.5", "cipher 0.3.0", "ctr 0.8.0", - "ghash", + "ghash 0.4.4", "subtle", ] [[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher 0.2.5", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aesni" -version = "0.10.0" +name = "aes-gcm" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" +checksum = "82e1366e0c69c9f927b1fa5ce2c7bf9eafc8f9268c0b9800729e8b267612447c" dependencies = [ - "cipher 0.2.5", - "opaque-debug 0.3.0", + "aead 0.5.1", + "aes 0.8.2", + "cipher 0.4.3", + "ctr 0.9.2", + "ghash 0.5.0", + "subtle", ] [[package]] @@ -89,9 +84,9 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", "once_cell", - "version_check", + "version_check 0.9.4", ] [[package]] @@ -112,15 +107,6 @@ dependencies = [ "libc", ] -[[package]] -name = "ansi_term" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" -dependencies = [ - "winapi", -] - [[package]] name = "anyhow" version = "1.0.59" @@ -145,15 +131,6 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" -[[package]] -name = "ascii-canvas" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8824ecca2e851cec16968d54a01dd372ef8f95b244fb84b84e70128be347c3c6" -dependencies = [ - "term", -] - [[package]] name = "asn1_der" version = "0.7.5" @@ -197,9 +174,9 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0da5b41ee986eed3f524c380e6d64965aea573882a8907682ad100f7859305ca" +checksum = "f1b6f5d7df27bd294849f8eec66ecfc63d11814df7a4f5d74168a2394467b776" dependencies = [ "async-channel", "async-executor", @@ -212,16 +189,16 @@ dependencies = [ [[package]] name = "async-io" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83e21f3a490c72b3b0cf44962180e60045de2925d8dff97918f7ee43c8f637c7" +checksum = "e8121296a9f05be7f34aa4196b1747243b3b62e048bb7906f644f3fbfc490cf7" dependencies = [ - "autocfg 1.1.0", + "async-lock", + "autocfg", "concurrent-queue", "futures-lite", "libc", "log", - "once_cell", "parking", "polling", "slab", @@ -232,11 +209,12 @@ dependencies = [ [[package]] name = "async-lock" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e97a171d191782fba31bb902b14ad94e24a68145032b7eedf871ab0bc0d077b6" +checksum = "c8101efe8695a6c17e02911402145357e718ac92d3ff88ae8419e84b1707b685" dependencies = [ "event-listener", + "futures-lite", ] [[package]] @@ -271,7 +249,7 @@ dependencies = [ "log", "memchr", "once_cell", - "pin-project-lite", + "pin-project-lite 0.2.9", "pin-utils", "slab", "wasm-bindgen-futures", @@ -306,9 +284,9 @@ checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.57" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" dependencies = [ "proc-macro2", "quote", @@ -331,7 +309,7 @@ dependencies = [ "futures-sink", "futures-util", "memchr", - "pin-project-lite", + "pin-project-lite 0.2.9", ] [[package]] @@ -340,7 +318,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] [[package]] @@ -360,15 +338,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "autocfg" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dde43e75fd43e8a1bf86103336bc699aa8d17ad1be60c76c0bdfd4828e19b78" -dependencies = [ - "autocfg 1.1.0", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -377,9 +346,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "aws-config" -version = "0.9.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da63196d2d0dd38667b404459a35d32562a8d83c1f46c5b789ab89ab176fd53" +checksum = "b309b2154d224728d845a958c580834f24213037ed61b195da80c0b0fc7469fa" dependencies = [ "aws-http", "aws-sdk-sso", @@ -396,6 +365,7 @@ dependencies = [ "http", "hyper", "ring", + "time 0.3.16", "tokio", "tower", "tracing", @@ -404,11 +374,12 @@ dependencies = [ [[package]] name = "aws-endpoint" -version = "0.9.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5279590d48e92b287f864e099c7e851af03a5e184a57cec0959872cee297c7a0" +checksum = "76f35c8f5877ad60db4f0d9dcdfbcb2233a8cc539f9e568df39ee0581ec62e89" dependencies = [ "aws-smithy-http", + "aws-smithy-types", "aws-types", "http", "regex", @@ -417,24 +388,27 @@ dependencies = [ [[package]] name = "aws-http" -version = "0.9.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7046bdd807c70caf28d6dbc69b9d6d8dda1728577866d3ff3862de585b8b0eb" +checksum = "2f5422c9632d887968ccb66e2871a6d190d6104e276034912bee72ef58a5d890" dependencies = [ "aws-smithy-http", "aws-smithy-types", "aws-types", + "bytes", "http", + "http-body", "lazy_static", "percent-encoding", + "pin-project-lite 0.2.9", "tracing", ] [[package]] name = "aws-sdk-dynamodb" -version = "0.9.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "762a92e68a3a99d43593ff9b4c00dac630c1e5cfd04ed15e33f235c9c9125a09" +checksum = "0d757928810bbc52fe8bc3005689fb2465d4d62c280054693ec6d0162ce33bbc" dependencies = [ "aws-endpoint", "aws-http", @@ -455,15 +429,16 @@ dependencies = [ [[package]] name = "aws-sdk-s3" -version = "0.9.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4fd99b22cbdb894925468005ad55defcfe0ce294fadcc5f7be9d9119646b0de" +checksum = "a4d31765abb258c501d5572ebce43dee524b4b3b6256cb8b4c78534898dc205b" dependencies = [ "aws-endpoint", "aws-http", "aws-sig-auth", "aws-sigv4", "aws-smithy-async", + "aws-smithy-checksums", "aws-smithy-client", "aws-smithy-eventstream", "aws-smithy-http", @@ -472,17 +447,19 @@ dependencies = [ "aws-smithy-xml", "aws-types", "bytes", + "bytes-utils", "http", - "md5", + "http-body", "tokio-stream", "tower", + "tracing", ] [[package]] name = "aws-sdk-sso" -version = "0.9.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96f9038b498944025a39e426ae38f64e3e8481a9d675469580e1de7397b46ed5" +checksum = "e2cc8b50281e1350d0b5c7207c2ce53c6721186ad196472caff4f20fa4b42e96" dependencies = [ "aws-endpoint", "aws-http", @@ -502,9 +479,9 @@ dependencies = [ [[package]] name = "aws-sdk-sts" -version = "0.9.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e717e67debcd7f9d87563d08e7d40e3c5c28634a8badc491650d5ad2305befd3" +checksum = "d6179f13c9fbab3226860f377354dece860e34ff129b69c7c1b0fa828d1e9c76" dependencies = [ "aws-endpoint", "aws-http", @@ -524,24 +501,23 @@ dependencies = [ [[package]] name = "aws-sig-auth" -version = "0.9.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0e6e4ba09f502057ad6a4ebf3627f9dae8402e366cf7b36ca1c09cbff8b5834" +checksum = "b16f4d70c9c865af392eb40cacfe2bec3fa18f651fbdf49919cfc1dda13b189e" dependencies = [ "aws-sigv4", "aws-smithy-eventstream", "aws-smithy-http", "aws-types", "http", - "thiserror", "tracing", ] [[package]] name = "aws-sigv4" -version = "0.9.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea07a5a108ee538793d681d608057218df95c5575f6c0699a1973c27a09334b2" +checksum = "8d33790cecae42b999d197074c8a19e9b96b9e346284a6f93989e7489c9fa0f5" dependencies = [ "aws-smithy-eventstream", "aws-smithy-http", @@ -553,27 +529,48 @@ dependencies = [ "percent-encoding", "regex", "ring", - "time 0.3.14", + "time 0.3.16", "tracing", ] [[package]] name = "aws-smithy-async" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66ab5373d24e1651860240f122a8d956f7a2094d4553c78979617a7fac640030" +checksum = "bc604f278bae64bbd15854baa9c46ed69a56dfb0669d04aab80974749f2d6599" dependencies = [ "futures-util", - "pin-project-lite", + "pin-project-lite 0.2.9", "tokio", "tokio-stream", ] +[[package]] +name = "aws-smithy-checksums" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b402da39bc5aae618b70a9b8d828acad21fe4a3a73b82c0205b89db55d71ce8" +dependencies = [ + "aws-smithy-http", + "aws-smithy-types", + "bytes", + "crc32c", + "crc32fast", + "hex", + "http", + "http-body", + "md-5 0.10.5", + "pin-project-lite 0.2.9", + "sha1", + "sha2 0.10.6", + "tracing", +] + [[package]] name = "aws-smithy-client" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88e8a92747322eace67f666402a5949da27675f60a2b9098b84b63edef8e6980" +checksum = "ec39585f8274fa543ad5c63cc09cbd435666be16b2cf99e4e07be5cf798bc050" dependencies = [ "aws-smithy-async", "aws-smithy-http", @@ -584,10 +581,9 @@ dependencies = [ "http", "http-body", "hyper", - "hyper-rustls", + "hyper-rustls 0.22.1", "lazy_static", - "pin-project 1.0.12", - "pin-project-lite", + "pin-project-lite 0.2.9", "tokio", "tower", "tracing", @@ -595,9 +591,9 @@ dependencies = [ [[package]] name = "aws-smithy-eventstream" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775b1de8d55fd1cda393c3d81cb5c3dc0e1cac38170883049e2d7a8e16cefad1" +checksum = "98c2a7b9490fd2bc7af3a1c486ae921102d7234d1fa5e7d91039068e7af48a01" dependencies = [ "aws-smithy-types", "bytes", @@ -606,9 +602,9 @@ dependencies = [ [[package]] name = "aws-smithy-http" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579d0c2ae96c700499c5330f082c4170b0535835f01eb845056324aa0abd04b4" +checksum = "014a0ef5c4508fc2f6a9d3925c214725af19f020ea388db48e20196cc4cc9d6d" dependencies = [ "aws-smithy-eventstream", "aws-smithy-types", @@ -620,77 +616,78 @@ dependencies = [ "hyper", "once_cell", "percent-encoding", - "pin-project 1.0.12", + "pin-project-lite 0.2.9", "tokio", - "tokio-util 0.6.10", + "tokio-util", "tracing", ] [[package]] name = "aws-smithy-http-tower" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "101a2e213acebe624cfb9bfc944de5e33c849e0df0f09c3d3aa3b54368dbe7af" +checksum = "deecb478dc3cc40203e0e97ac0fb92947e0719754bbafd0026bdc49318e2fd03" dependencies = [ "aws-smithy-http", "bytes", "http", "http-body", - "pin-project 1.0.12", + "pin-project-lite 0.2.9", "tower", "tracing", ] [[package]] name = "aws-smithy-json" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd21f28535a2538b77274aa590abfb6d37aece3281dfc4c9411c1625d3b9239e" +checksum = "6593456af93c4a39724f7dc9d239833102ab96c1d1e94c35ea79f0e55f9fd54c" dependencies = [ "aws-smithy-types", ] [[package]] name = "aws-smithy-query" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5a2c90311b0d20cf23212a15961cad2b76480863b1f7ce0608d9ece8dacdfb" +checksum = "b803460b71645dfa9f6be47c4f00f91632f01e5bb01f9dc43890cd6cba983f08" dependencies = [ "aws-smithy-types", - "urlencoding 1.3.3", + "urlencoding", ] [[package]] name = "aws-smithy-types" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962f2da621cd29f272636eebce39ca321c91e02bbb7eb848c4587ac14933d339" +checksum = "e93b0c93a3b963da946a0b8ef3853a7252298eb75cdbfb21dad60f5ed0ded861" dependencies = [ "itoa", "num-integer", "ryu", - "time 0.3.14", + "time 0.3.16", ] [[package]] name = "aws-smithy-xml" -version = "0.39.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829c7efd92b7a6d0536ceb48fd93a289ddf8763c67bffe875d82eae3f9886546" +checksum = "36b9efb4855b4acb29961a776d45680f3cbdd7c4783cbbae078da54c342575dd" dependencies = [ - "thiserror", "xmlparser", ] [[package]] name = "aws-types" -version = "0.9.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68159725aa77553dbc6028f36d8378563cd45b18ef9cf03d1515ac469efacf13" +checksum = "93f3f349b39781849261db1c727369923bb97007cf7bd0deb3a6e9e461c8d38f" dependencies = [ "aws-smithy-async", "aws-smithy-client", + "aws-smithy-http", "aws-smithy-types", + "http", "rustc_version", "tracing", "zeroize", @@ -716,9 +713,15 @@ checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" [[package]] name = "base64" -version = "0.13.0" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64ct" +version = "1.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" [[package]] name = "bech32" @@ -742,19 +745,10 @@ dependencies = [ ] [[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" +name = "bitfield" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "46afbd2983a5d5a7bd740ccb198caf5b82f45c40c09c0eed36052d91cb92e719" [[package]] name = "bitflags" @@ -762,18 +756,6 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" -[[package]] -name = "bitvec" -version = "0.19.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55f93d0ef3363c364d5976646a38f04cf67cfe1d4c8d160cdea02cab2c116b33" -dependencies = [ - "funty", - "radium 0.5.3", - "tap", - "wyz", -] - [[package]] name = "bitvec" version = "0.20.4" @@ -781,7 +763,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7774144344a4faa177370406a7ff5f1da24303817368584c6206c8303eb07848" dependencies = [ "funty", - "radium 0.6.2", + "radium", "tap", "wyz", ] @@ -817,17 +799,6 @@ dependencies = [ "constant_time_eq", ] -[[package]] -name = "blake2s_simd" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" -dependencies = [ - "arrayref", - "arrayvec 0.5.2", - "constant_time_eq", -] - [[package]] name = "blake2s_simd" version = "1.0.0" @@ -885,12 +856,12 @@ dependencies = [ [[package]] name = "block-modes" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +checksum = "2cb03d1bed155d89dce0f845b7899b18a9a163e148fd004e1c28421a783e2d8e" dependencies = [ "block-padding 0.2.1", - "cipher 0.2.5", + "cipher 0.3.0", ] [[package]] @@ -924,12 +895,12 @@ dependencies = [ [[package]] name = "blowfish" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32fa6a061124e37baba002e496d203e23ba3d7b73750be82dbfbc92913048a5b" +checksum = "fe3ff3fc1de48c1ac2e3341c4df38b0d1bfb8fdf04632a187c8b75aaa319a7ab" dependencies = [ "byteorder", - "cipher 0.2.5", + "cipher 0.3.0", "opaque-debug 0.3.0", ] @@ -943,26 +914,20 @@ dependencies = [ ] [[package]] -name = "buffered-reader" -version = "1.1.3" +name = "buf_redux" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f82920285502602088677aeb65df0909b39c347b38565e553ba0363c242f65" +checksum = "b953a6887648bb07a535631f2bc00fbdb2a2216f135552cb3f534ed136b9c07f" dependencies = [ - "flate2", - "libc", + "memchr", + "safemem", ] [[package]] name = "bumpalo" -version = "3.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ad822118d20d2c234f427000d5acc36eabe1e29a348c89b63dd60b13f28e5d" - -[[package]] -name = "byte-slice-cast" -version = "1.2.1" +version = "3.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c5fdd0166095e1d463fc6cc01aa8ce547ad77a4e84d42eb6762b084e28067e" +checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "byte-tools" @@ -981,9 +946,6 @@ name = "bytes" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec8a7b6a70fde80372154c65702f00a0f56f3e1c36abbc6c440484be248856db" -dependencies = [ - "serde", -] [[package]] name = "bytes-utils" @@ -997,20 +959,20 @@ dependencies = [ [[package]] name = "cacaos" -version = "0.4.0" -source = "git+https://github.com/spruceid/cacao-rs#066d57282757487a37c8b4d94700b9ed49eb01ed" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92680fcbb8e24eaa4640c6deca0042db02da17c8b92fde62a0c517bcb6769d7d" dependencies = [ "async-trait", - "ethers-core", "hex", "http", - "iri-string 0.4.1", + "iri-string 0.6.0", "libipld", "serde", - "serde_with", + "serde_with 2.0.1", "siwe", "thiserror", - "time 0.3.14", + "time 0.3.16", "url", ] @@ -1032,9 +994,9 @@ dependencies = [ [[package]] name = "cached" -version = "0.34.1" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f5cd208ba696f870238022d81ca1d80ed9d696fd62341c747f2d8f6ecdd9fe" +checksum = "72b4147cd94d5fbdc2ab71b11d50a2f45493625576b3bb70257f59eedea69f3d" dependencies = [ "async-trait", "async_once", @@ -1042,6 +1004,7 @@ dependencies = [ "cached_proc_macro_types", "futures", "hashbrown 0.12.3", + "instant", "lazy_static", "once_cell", "thiserror", @@ -1050,9 +1013,9 @@ dependencies = [ [[package]] name = "cached_proc_macro" -version = "0.12.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bce0f37f9b77c6b93cdf3f060c89adca303d2ab052cacb3c3d1ab543e8cecd2f" +checksum = "751f7f4e7a091545e7f6c65bacc404eaee7e87bfb1f9ece234a1caa173dc16f2" dependencies = [ "cached_proc_macro_types", "darling 0.13.4", @@ -1068,12 +1031,12 @@ checksum = "3a4f925191b4367301851c6d99b09890311d74b0d43f274c0b34c86d308a3663" [[package]] name = "capgrok" -version = "0.2.2" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab4b6ebc13190cd16ffe4e289f1b8667cc1f6caac781586054d4beff411e7a2a" +checksum = "17b1f49d14a68f6b30e935586d15bc1fae6444c8e42cd222d4b68cf16406eecb" dependencies = [ "base64 0.12.3", - "iri-string 0.4.1", + "iri-string 0.6.0", "serde", "serde_json", "siwe", @@ -1082,20 +1045,29 @@ dependencies = [ [[package]] name = "cast5" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1285caf81ea1f1ece6b24414c521e625ad0ec94d880625c20f2e65d8d3f78823" +checksum = "f69790da27038b52ffcf09e7874e1aae353c674d65242549a733ad9372e7281f" dependencies = [ "byteorder", - "cipher 0.2.5", + "cipher 0.3.0", "opaque-debug 0.3.0", ] [[package]] name = "cc" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" +checksum = "581f5dba903aac52ea3feb5ec4810848460ee833876f1f9b0fdeab1f19091574" + +[[package]] +name = "cfb-mode" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "750dfbb1b1f84475c1a92fed10fa5e76cb11adc0cda5225f137c5cac84e80860" +dependencies = [ + "cipher 0.3.0", +] [[package]] name = "cfg-if" @@ -1152,30 +1124,37 @@ checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ "core2", "multibase 0.9.1", - "multihash 0.16.3", + "multihash", "serde", "serde_bytes", - "unsigned-varint 0.7.1", + "unsigned-varint", ] [[package]] name = "cipher" -version = "0.2.5" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" dependencies = [ "generic-array 0.14.6", ] [[package]] name = "cipher" -version = "0.3.0" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +checksum = "d1873270f8f7942c191139cb8a40fd228da6c3fd2fc376d7e92d47aa14aeb59e" dependencies = [ - "generic-array 0.14.6", + "crypto-common", + "inout", ] +[[package]] +name = "circular" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fc239e0f6cb375d2402d48afb92f76f5404fd1df208a41930ec81eda078bea" + [[package]] name = "clear_on_drop" version = "0.2.5" @@ -1186,13 +1165,22 @@ dependencies = [ ] [[package]] -name = "cmac" -version = "0.5.1" +name = "cmake" +version = "0.1.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db34956e100b30725f2eb215f90d4871051239535632f84fea3bc92722c66b7c" +dependencies = [ + "cc", +] + +[[package]] +name = "codespan-reporting" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d4de4f7724e5fe70addfb2bd37c2abd2f95084a429d7773b0b9645499b4272" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" dependencies = [ - "crypto-mac 0.10.1", - "dbl", + "termcolor", + "unicode-width", ] [[package]] @@ -1212,21 +1200,15 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279bc8fc53f788a75c7804af68237d1fce02cde1e275a886a4b320604dc2aeda" - -[[package]] -name = "const-oid" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6f2aa4d0537bcc1c74df8755072bd31c1ef1a3a1b85a68e8404a8c353b7b8b" +checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" [[package]] name = "const-oid" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4c78c047431fee22c1a7bb92e00ad095a02a983affe4d8a72e2a2c62c1b94f3" +checksum = "722e23542a15cea1f65d4a1419c4cfd7a26706c70871a13a04238ca3f40f1661" [[package]] name = "constant_time_eq" @@ -1236,20 +1218,20 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "cookie" -version = "0.16.0" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d4706de1b0fa5b132270cddffa8585166037822e260a944fe161acd137ca05" +checksum = "344adc371239ef32293cb1c4fe519592fcf21206c79c02854320afcdf3ab4917" dependencies = [ - "aes-gcm", - "base64 0.13.0", + "aes-gcm 0.10.1", + "base64 0.13.1", "hkdf", - "hmac 0.12.1", + "hmac", "percent-encoding", "rand 0.8.5", "sha2 0.10.6", "subtle", - "time 0.3.14", - "version_check", + "time 0.3.16", + "version_check 0.9.4", ] [[package]] @@ -1286,6 +1268,21 @@ dependencies = [ "libc", ] +[[package]] +name = "crc24" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd121741cf3eb82c08dd3023eb55bf2665e5f60ec20f89760cf836ae4562e6a0" + +[[package]] +name = "crc32c" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfea2db42e9927a3845fb268a10a72faed6d416065f77873f05e411457c363e" +dependencies = [ + "rustc_version", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -1307,26 +1304,24 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.10" +version = "0.9.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" +checksum = "f916dfc5d356b0ed9dae65f1db9fc9770aa2851d2662b988ccf4fe3516e86348" dependencies = [ - "autocfg 1.1.0", + "autocfg", "cfg-if", "crossbeam-utils", "memoffset", - "once_cell", "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.11" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" dependencies = [ "cfg-if", - "once_cell", ] [[package]] @@ -1337,21 +1332,19 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.2.11" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83bd3bb4314701c568e340cd8cf78c975aa0ca79e03d3f6d1677d5b0c9c0c03" +checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" dependencies = [ "generic-array 0.14.6", - "rand_core 0.6.4", "subtle", - "zeroize", ] [[package]] name = "crypto-bigint" -version = "0.3.2" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03c6a1d5fa1de37e071642dfa44ec552ca5b299adb128fab16138e24b548fd21" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ "generic-array 0.14.6", "rand_core 0.6.4", @@ -1366,58 +1359,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array 0.14.6", + "rand_core 0.6.4", "typenum", ] -[[package]] -name = "crypto-mac" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff07008ec701e8028e2ceb8f83f0e4274ee62bd2dbdc4fefff2e9a91824081a" -dependencies = [ - "cipher 0.2.5", - "generic-array 0.14.6", - "subtle", -] - -[[package]] -name = "crypto-mac" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1d1a86f49236c215f271d40892d5fc950490551400b02ef360692c29815c714" -dependencies = [ - "generic-array 0.14.6", - "subtle", -] - [[package]] name = "ct-logs" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1a816186fa68d9e426e3cb4ae4dff1fcd8e4a2c34b781bf7a822574a0d0aac8" dependencies = [ - "sct", + "sct 0.6.1", ] [[package]] name = "ctor" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdffe87e1d521a10f9696f833fe502293ea446d7f256c06128293a4119bdf4cb" +checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote", "syn", ] -[[package]] -name = "ctr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" -dependencies = [ - "cipher 0.2.5", -] - [[package]] name = "ctr" version = "0.8.0" @@ -1428,14 +1392,12 @@ dependencies = [ ] [[package]] -name = "cuckoofilter" -version = "0.5.0" +name = "ctr" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "byteorder", - "fnv", - "rand 0.7.3", + "cipher 0.4.3", ] [[package]] @@ -1465,17 +1427,61 @@ dependencies = [ ] [[package]] -name = "darling" -version = "0.10.2" +name = "cxx" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +checksum = "6b7d4e43b25d3c994662706a1d4fcfc32aaa6afd287502c111b237093bb23f3a" dependencies = [ - "darling_core 0.10.2", - "darling_macro 0.10.2", + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", ] [[package]] -name = "darling" +name = "cxx-build" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84f8829ddc213e2c1368e51a2564c552b65a8cb6a28f31e576270ac81d5e5827" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e72537424b474af1460806647c41d4b6d35d09ef7fe031c5c2fa5766047cc56a" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "309e4fb93eed90e1e14bea0da16b209f81813ba9fc7830c20ed151dd7bc0a4d7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core 0.10.2", + "darling_macro 0.10.2", +] + +[[package]] +name = "darling" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" @@ -1484,6 +1490,16 @@ dependencies = [ "darling_macro 0.13.4", ] +[[package]] +name = "darling" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0dd3cd20dc6b5a876612a6e5accfe7f3dd883db6d07acfbf14c128f61550dfa" +dependencies = [ + "darling_core 0.14.2", + "darling_macro 0.14.2", +] + [[package]] name = "darling_core" version = "0.10.2" @@ -1512,6 +1528,20 @@ dependencies = [ "syn", ] +[[package]] +name = "darling_core" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn", +] + [[package]] name = "darling_macro" version = "0.10.2" @@ -1534,6 +1564,17 @@ dependencies = [ "syn", ] +[[package]] +name = "darling_macro" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" +dependencies = [ + "darling_core 0.14.2", + "quote", + "syn", +] + [[package]] name = "data-encoding" version = "2.3.2" @@ -1561,50 +1602,55 @@ dependencies = [ ] [[package]] -name = "dbl" -version = "0.3.2" +name = "der" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd2735a791158376708f9347fe8faba9667589d82427ef3aed6794a8981de3d9" +checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" dependencies = [ - "generic-array 0.14.6", + "const-oid 0.7.1", + "crypto-bigint 0.3.2", + "pem-rfc7468", ] [[package]] name = "der" -version = "0.3.5" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eeb9d92785d1facb50567852ce75d0858630630e7eabea59cf7eb7474051087" +checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" dependencies = [ - "const-oid 0.5.2", - "typenum", + "const-oid 0.9.0", + "zeroize", ] [[package]] -name = "der" -version = "0.4.5" +name = "derive_builder" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b71cca7d95d7681a4b3b9cdf63c8dbc3730d0584c2c74e31416d64a90493f4" +checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" dependencies = [ - "const-oid 0.6.2", + "darling 0.10.2", + "derive_builder_core 0.9.0", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "der" -version = "0.5.1" +name = "derive_builder" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6919815d73839e7ad218de758883aae3a257ba6759ce7a9992501efbb53d705c" +checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" dependencies = [ - "const-oid 0.7.1", + "derive_builder_macro", ] [[package]] -name = "derive_builder" +name = "derive_builder_core" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2658621297f2cf68762a6f7dc0bb7e1ff2cfd6583daef8ee0fed6f7ec468ec0" +checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" dependencies = [ "darling 0.10.2", - "derive_builder_core", "proc-macro2", "quote", "syn", @@ -1612,24 +1658,34 @@ dependencies = [ [[package]] name = "derive_builder_core" -version = "0.9.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2791ea3e372c8495c0bc2033991d76b512cd799d07491fbd6890124db9458bef" +checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" dependencies = [ - "darling 0.10.2", + "darling 0.14.2", "proc-macro2", "quote", "syn", ] +[[package]] +name = "derive_builder_macro" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" +dependencies = [ + "derive_builder_core 0.11.2", + "syn", +] + [[package]] name = "des" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b24e7c748888aa2fa8bce21d8c64a52efc810663285315ac7476f7197a982fae" +checksum = "ac41dd49fb554432020d52c875fc290e110113f864c6b1b525cd62c7e7747a5d" dependencies = [ "byteorder", - "cipher 0.2.5", + "cipher 0.3.0", "opaque-debug 0.3.0", ] @@ -1669,7 +1725,7 @@ dependencies = [ [[package]] name = "did-ethr" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "chrono", @@ -1685,7 +1741,7 @@ dependencies = [ [[package]] name = "did-ion" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "anyhow", "async-trait", @@ -1707,12 +1763,12 @@ dependencies = [ [[package]] name = "did-method-key" version = "0.1.3" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "multibase 0.8.0", "serde_json", - "simple_asn1 0.5.4", + "simple_asn1", "ssi-crypto", "ssi-dids", "ssi-jwk", @@ -1722,7 +1778,7 @@ dependencies = [ [[package]] name = "did-onion" version = "0.1.2" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "http", @@ -1735,7 +1791,7 @@ dependencies = [ [[package]] name = "did-pkh" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "bech32", @@ -1752,7 +1808,7 @@ dependencies = [ [[package]] name = "did-tz" version = "0.1.2" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "anyhow", "async-trait", @@ -1772,7 +1828,7 @@ dependencies = [ [[package]] name = "did-web" version = "0.1.2" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "http", @@ -1784,27 +1840,22 @@ dependencies = [ [[package]] name = "did-webkey" version = "0.1.1" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "anyhow", "async-trait", "hex", "http", + "pgp", "reqwest", - "sequoia-openpgp", "serde", "serde_json", "sshkeys", "ssi-dids", + "ssi-jwk", "ssi-ssh", ] -[[package]] -name = "diff" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56254986775e3233ffa9c4d7d3faaf6d36a2c09d30b20687e9f88bc8bafc16c8" - [[package]] name = "digest" version = "0.8.1" @@ -1834,73 +1885,21 @@ dependencies = [ "subtle", ] -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "dtoa" -version = "1.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6053ff46b5639ceb91756a85a4c8914668393a03170efd79c8884a529d80656" - -[[package]] -name = "dyn-clone" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" - -[[package]] -name = "eax" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1f76e7a5e594b299a0fa9a99de627530725e341df41376aa342aecb2c5eb76e" -dependencies = [ - "aead 0.3.2", - "cipher 0.2.5", - "cmac", - "ctr 0.6.0", - "subtle", -] - -[[package]] -name = "ecdsa" -version = "0.11.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34d33b390ab82f2e1481e331dbd0530895640179d2128ef9a79cc690b78d1eba" -dependencies = [ - "der 0.3.5", - "elliptic-curve 0.9.12", - "hmac 0.11.0", - "signature", -] +checksum = "f8a6eee2d5d0d113f015688310da018bd1d864d86bd567c8fca9c266889e1bfa" [[package]] name = "ecdsa" -version = "0.12.4" +version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43ee23aa5b4f68c7a092b5c3beb25f50c406adc75e2363634f242f28ab255372" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der 0.4.5", - "elliptic-curve 0.10.6", - "hmac 0.11.0", + "der 0.6.0", + "elliptic-curve", + "rfc6979", "signature", ] @@ -1935,60 +1934,24 @@ checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] name = "elliptic-curve" -version = "0.9.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c13e9b0c3c4170dcc2a12783746c4205d98e18957f57854251eea3f9750fe005" -dependencies = [ - "bitvec 0.20.4", - "ff 0.9.0", - "generic-array 0.14.6", - "group 0.9.0", - "pkcs8 0.6.1", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "elliptic-curve" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beca177dcb8eb540133e7680baff45e7cc4d93bf22002676cec549f82343721b" -dependencies = [ - "crypto-bigint 0.2.11", - "ff 0.10.1", - "generic-array 0.14.6", - "group 0.10.0", - "pkcs8 0.7.6", - "rand_core 0.6.4", - "subtle", - "zeroize", -] - -[[package]] -name = "elliptic-curve" -version = "0.11.12" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25b477563c2bfed38a3b7a60964c49e058b2510ad3f12ba3483fd8f62c2306d6" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ "base16ct", - "crypto-bigint 0.3.2", - "der 0.5.1", + "crypto-bigint 0.4.9", + "der 0.6.0", + "digest 0.10.5", + "ff", "generic-array 0.14.6", + "group", + "pkcs8 0.9.0", "rand_core 0.6.4", + "sec1", "subtle", "zeroize", ] -[[package]] -name = "ena" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7402b94a93c24e742487327a7cd839dc9d36fec9de9fb25b09f2dae459f36c3" -dependencies = [ - "log", -] - [[package]] name = "encoding_rs" version = "0.8.31" @@ -2000,81 +1963,35 @@ dependencies = [ [[package]] name = "enum-as-inner" -version = "0.4.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21cdad81446a7f7dc43f6a77409efeb9733d2fa65553efef6018ef257c959b73" +checksum = "c9720bba047d567ffc8a3cba48bf19126600e249ab7f128e9233e6376976a116" dependencies = [ - "heck 0.4.0", + "heck", "proc-macro2", "quote", "syn", ] [[package]] -name = "ethabi" -version = "15.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76ef192b63e8a44b3d08832acebbb984c3fba154b5c26f70037c860202a0d4b" -dependencies = [ - "anyhow", - "ethereum-types", - "hex", - "serde", - "serde_json", - "sha3 0.9.1", - "thiserror", - "uint", -] - -[[package]] -name = "ethbloom" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb684ac8fa8f6c5759f788862bb22ec6fe3cb392f6bfd08e3c64b603661e3f8" -dependencies = [ - "crunchy", - "fixed-hash", - "impl-rlp", - "impl-serde", - "tiny-keccak", -] - -[[package]] -name = "ethereum-types" -version = "0.12.1" +name = "errno" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05136f7057fe789f06e6d41d07b34e6f70d8c86e5693b60f97aaa6553553bdaf" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" dependencies = [ - "ethbloom", - "fixed-hash", - "impl-rlp", - "impl-serde", - "primitive-types 0.10.1", - "uint", + "errno-dragonfly", + "libc", + "winapi", ] [[package]] -name = "ethers-core" -version = "0.6.3" +name = "errno-dragonfly" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f15e1a2a54bc6bc3f8ea94afafbb374264f8322fcacdae06fefda80a206739ac" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" dependencies = [ - "arrayvec 0.7.2", - "bytes", - "ecdsa 0.12.4", - "elliptic-curve 0.11.12", - "ethabi", - "generic-array 0.14.6", - "hex", - "k256", - "once_cell", - "rand 0.8.5", - "rlp", - "rlp-derive", - "serde", - "serde_json", - "thiserror", - "tiny-keccak", + "cc", + "libc", ] [[package]] @@ -2100,20 +2017,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a4d941a5b7c2a75222e2d44fcdf634a67133d9db31e177ae5ff6ecda852bfe" -dependencies = [ - "bitvec 0.20.4", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "ff" -version = "0.10.1" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0f40b2dcd8bc322217a5f6559ae5f9e9d1de202a2ecee2e9eafcbece7562a4f" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" dependencies = [ "rand_core 0.6.4", "subtle", @@ -2121,28 +2027,16 @@ dependencies = [ [[package]] name = "figment" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e3bd154d9ae2f1bb0ada5b7eebd56529513efa5de7d2fc8c6adf33bc43260cf" +checksum = "4e56602b469b2201400dec66a66aec5a9b8761ee97cd1b8c96ab2483fcc16cc9" dependencies = [ "atomic", "pear", "serde", "toml", "uncased", - "version_check", -] - -[[package]] -name = "filetime" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94a7bbaa59354bc20dd75b67f23e2797b4490e9d6928203fb105c79e448c86c" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "windows-sys", + "version_check 0.9.4", ] [[package]] @@ -2151,18 +2045,9 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfcf0ed7fe52a17a03854ec54a9f76d6d84508d1c0e66bc1793301c73fc8493c" dependencies = [ - "byteorder", - "rand 0.8.5", - "rustc-hex", "static_assertions", ] -[[package]] -name = "fixedbitset" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" - [[package]] name = "fixedbitset" version = "0.4.2" @@ -2176,6 +2061,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f82b0f4c27ad9f8bfd1f3208d882da2b09c301bc1c828fd3a00d0216d2fbbff6" dependencies = [ "crc32fast", + "libz-sys", "miniz_oxide", ] @@ -2219,12 +2105,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "fuchsia-cprng" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" - [[package]] name = "funty" version = "1.1.0" @@ -2233,9 +2113,9 @@ checksum = "fed34cd105917e91daa4da6b3728c47b068749d6a62c59811f06ed2ac71d9da7" [[package]] name = "futures" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f21eda599937fba36daeb58a22e8f5cee2d14c4a17b5b7739c7c8e5e3b8230c" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" dependencies = [ "futures-channel", "futures-core", @@ -2248,9 +2128,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bdd20c28fadd505d0fd6712cdfcb0d4b5648baf45faef7f852afb2399bb050" +checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", "futures-sink", @@ -2258,15 +2138,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e5aa3de05362c3fb88de6531e6296e85cde7739cccad4b9dfeeb7f6ebce56bf" +checksum = "04909a7a7e4633ae6c4a9ab280aeb86da1236243a77b694a49eacd659a4bd3ac" [[package]] name = "futures-executor" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ff63c23854bee61b6e9cd331d523909f238fc7636290b96826e9cfa5faa00ab" +checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" dependencies = [ "futures-core", "futures-task", @@ -2276,9 +2156,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbf4d2a7a308fd4578637c0b17c7e1c7ba127b8f6ba00b29f717e9655d85eb68" +checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] name = "futures-lite" @@ -2291,32 +2171,43 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite", + "pin-project-lite 0.2.9", "waker-fn", ] [[package]] name = "futures-macro" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd15d1c7456c04dbdf7e88bcd69760d74f3a798d6444e16974b505b0e62f17" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "futures-rustls" +version = "0.22.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2411eed028cdf8c8034eaf21f9915f956b6c3abec4d4c7949ee67f0721127bd" +dependencies = [ + "futures-io", + "rustls 0.20.7", + "webpki 0.22.0", +] + [[package]] name = "futures-sink" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b20ba5a92e727ba30e72834706623d94ac93a725410b6a6b6fbc1b07f7ba56" +checksum = "39c15cf1a4aa79df40f1bb462fb39676d0ad9e366c2a33b590d7c66f4f81fcf9" [[package]] name = "futures-task" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6508c467c73851293f390476d4491cf4d227dbabcd4170f3bb6044959b294f1" +checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" [[package]] name = "futures-timer" @@ -2326,9 +2217,9 @@ checksum = "e64b03909df88034c26dc1547e8970b91f98bdb65165d6a4e9110d94263dbb2c" [[package]] name = "futures-util" -version = "0.3.24" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44fb6cb1be61cc1d2e43b262516aafcf63b241cffdb1d3fa115f91d9c7b09c90" +checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ "futures-channel", "futures-core", @@ -2337,7 +2228,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite", + "pin-project-lite 0.2.9", "pin-utils", "slab", ] @@ -2361,7 +2252,7 @@ dependencies = [ "libc", "log", "rustversion", - "windows", + "windows 0.32.0", ] [[package]] @@ -2380,7 +2271,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", - "version_check", + "version_check 0.9.4", ] [[package]] @@ -2390,17 +2281,15 @@ 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.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eb1a864a501629691edf6c15a593b7a51eebaa1e8468e9ddc623de7c9b58ec6" +checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", "js-sys", @@ -2416,7 +2305,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" dependencies = [ "opaque-debug 0.3.0", - "polyval", + "polyval 0.5.3", +] + +[[package]] +name = "ghash" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +dependencies = [ + "opaque-debug 0.3.0", + "polyval 0.6.0", ] [[package]] @@ -2439,31 +2338,20 @@ dependencies = [ [[package]] name = "group" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3c1e8b4f1ca07e6605ea1be903a5f6956aec5c8a67fd44d56076631675ed8" -dependencies = [ - "ff 0.9.0", - "rand_core 0.6.4", - "subtle", -] - -[[package]] -name = "group" -version = "0.10.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c363a5301b8f153d80747126a04b3c82073b9fe3130571a9d170cacdeaf7912" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" dependencies = [ - "ff 0.10.1", + "ff", "rand_core 0.6.4", "subtle", ] [[package]] name = "h2" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca32592cf21ac7ccab1825cd87f6c9b3d9022c44d086172ed0966bec8af30be" +checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" dependencies = [ "bytes", "fnv", @@ -2474,16 +2362,10 @@ dependencies = [ "indexmap", "slab", "tokio", - "tokio-util 0.7.4", + "tokio-util", "tracing", ] -[[package]] -name = "hash_hasher" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74721d007512d0cb3338cd20f0654ac913920061a4c4d0d8708edb3f2a698c0c" - [[package]] name = "hashbrown" version = "0.11.2" @@ -2505,7 +2387,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3e372db8e5c0d213e0cd0b9be18be2aca3d44cf2fe30a9d46a65581cd454584" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bitflags", "bytes", "headers-core", @@ -2524,15 +2406,6 @@ dependencies = [ "http", ] -[[package]] -name = "heck" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] - [[package]] name = "heck" version = "0.4.0" @@ -2555,22 +2428,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] -name = "hkdf" -version = "0.12.3" +name = "hex_fmt" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" -dependencies = [ - "hmac 0.12.1", -] +checksum = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" [[package]] -name = "hmac" -version = "0.11.0" +name = "hkdf" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" dependencies = [ - "crypto-mac 0.11.1", - "digest 0.9.0", + "hmac", ] [[package]] @@ -2612,7 +2481,7 @@ checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", "http", - "pin-project-lite", + "pin-project-lite 0.2.9", ] [[package]] @@ -2629,9 +2498,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.20" +version = "0.14.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +checksum = "abfba89e19b959ca163c7752ba59d737c1ceea53a5d31a149c805446fc958064" dependencies = [ "bytes", "futures-channel", @@ -2643,7 +2512,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project-lite", + "pin-project-lite 0.2.9", "socket2", "tokio", "tower-service", @@ -2661,11 +2530,24 @@ dependencies = [ "futures-util", "hyper", "log", - "rustls", + "rustls 0.19.1", "rustls-native-certs", "tokio", - "tokio-rustls", - "webpki", + "tokio-rustls 0.22.0", + "webpki 0.21.4", +] + +[[package]] +name = "hyper-rustls" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87c48c02e0dc5e3b849a2041db3029fd066650f8f717c07bf8ed78ccb895cac" +dependencies = [ + "http", + "hyper", + "rustls 0.20.7", + "tokio", + "tokio-rustls 0.23.4", ] [[package]] @@ -2683,26 +2565,26 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.48" +version = "0.1.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a0714f28b1ee39ccec0770ccb544eb02c9ef2c82bb096230eefcffa6468b0" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" dependencies = [ "android_system_properties", "core-foundation-sys", + "iana-time-zone-haiku", "js-sys", - "once_cell", "wasm-bindgen", "winapi", ] [[package]] -name = "idea" -version = "0.3.0" +name = "iana-time-zone-haiku" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdd4b114cf2265123bbdc5d32a39f96a343fbdf141267d2b5232b7e14caacb3" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" dependencies = [ - "cipher 0.2.5", - "opaque-debug 0.3.0", + "cxx", + "cxx-build", ] [[package]] @@ -2743,41 +2625,21 @@ dependencies = [ ] [[package]] -name = "impl-codec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "161ebdfec3c8e3b52bf61c4f3550a1eea4f9579d10dc1b936f3171ebdcd6c443" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-rlp" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" -dependencies = [ - "rlp", -] - -[[package]] -name = "impl-serde" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4551f042f3438e64dbd6226b20527fc84a6e1fe65688b58746a2f53623f25f5c" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" +name = "if-watch" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +checksum = "065c008e570a43c00de6aed9714035e5ea6a498c255323db9091722af6ee67dd" dependencies = [ - "proc-macro2", - "quote", - "syn", + "async-io", + "core-foundation", + "fnv", + "futures", + "if-addrs", + "ipnet", + "log", + "rtnetlink", + "system-configuration", + "windows 0.34.0", ] [[package]] @@ -2786,7 +2648,7 @@ version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ - "autocfg 1.1.0", + "autocfg", "hashbrown 0.12.3", "serde", ] @@ -2797,6 +2659,15 @@ version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c8fae54786f62fb2918dcfae3d568594e50eb9b5c25bf04371af6fe7516452fb" +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array 0.14.6", +] + [[package]] name = "instant" version = "0.1.12" @@ -2812,6 +2683,12 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" +[[package]] +name = "io-lifetimes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" + [[package]] name = "ipconfig" version = "0.3.0" @@ -2824,71 +2701,6 @@ dependencies = [ "winreg 0.7.0", ] -[[package]] -name = "ipfs" -version = "0.2.1" -source = "git+https://github.com/spruceid/rust-ipfs?branch=feat/update-libipld#f4883c2ca38ce0f8f9ab4ee7f7d6443433013548" -dependencies = [ - "anyhow", - "async-stream", - "async-trait", - "base64 0.13.0", - "byteorder", - "bytes", - "either", - "fs2", - "futures", - "hash_hasher", - "ipfs-bitswap", - "ipfs-unixfs", - "libipld", - "libp2p", - "once_cell", - "serde", - "serde_json", - "sled", - "thiserror", - "tokio", - "tokio-stream", - "tokio-util 0.6.10", - "tracing", - "tracing-futures", - "trust-dns-resolver", - "void", -] - -[[package]] -name = "ipfs-bitswap" -version = "0.1.0" -source = "git+https://github.com/spruceid/rust-ipfs?branch=feat/update-libipld#f4883c2ca38ce0f8f9ab4ee7f7d6443433013548" -dependencies = [ - "fnv", - "futures", - "hash_hasher", - "libipld", - "libp2p-core", - "libp2p-swarm", - "multihash 0.11.4", - "prost 0.9.0", - "prost-build 0.8.0", - "thiserror", - "tokio", - "tracing", - "unsigned-varint 0.7.1", -] - -[[package]] -name = "ipfs-unixfs" -version = "0.2.0" -source = "git+https://github.com/spruceid/rust-ipfs?branch=feat/update-libipld#f4883c2ca38ce0f8f9ab4ee7f7d6443433013548" -dependencies = [ - "either", - "filetime", - "libipld", - "quick-protobuf", - "sha2 0.9.9", -] - [[package]] name = "ipnet" version = "2.5.0" @@ -2907,34 +2719,34 @@ dependencies = [ [[package]] name = "iri-string" -version = "0.4.1" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0f7638c1e223529f1bfdc48c8b133b9e0b434094d1d28473161ee48b235f78" +checksum = "bf071934ee7ee97e52fa1868a9540a7885eab75926bd70794030304a9797cea1" + +[[package]] +name = "iri-string" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d0586ad318a04c73acdbad33f67969519b5452c80770c4c72059a686da48a7e" dependencies = [ - "nom 7.1.1", + "memchr", "serde", ] -[[package]] -name = "iri-string" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf071934ee7ee97e52fa1868a9540a7885eab75926bd70794030304a9797cea1" - [[package]] name = "itertools" -version = "0.10.4" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bf247779e67a9082a4790b45e71ac7cfd1321331a5c856a74a9faebdab78d0" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] [[package]] name = "itoa" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8af84674fe1f223a982c933a0ee1086ac4d4052aa0fb8060c12c6ad838e754" +checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" [[package]] name = "js-sys" @@ -2979,15 +2791,15 @@ dependencies = [ [[package]] name = "k256" -version = "0.9.6" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "903ae2481bcdfdb7b68e0a9baa4b7c9aff600b9ae2e8e5bb5833b8c91ab851ea" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa 0.12.4", - "elliptic-curve 0.10.6", - "sha2 0.9.9", - "sha3 0.9.1", + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", + "sha3 0.10.6", ] [[package]] @@ -3002,7 +2814,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae0386ec98c26dd721aaa3412bf3a817156ff3ee7cb6959503f8d1095f4ccc51" dependencies = [ - "primitive-types 0.9.1", + "primitive-types", "tiny-keccak", ] @@ -3017,43 +2829,42 @@ dependencies = [ "aws-sdk-s3", "aws-smithy-http", "aws-types", - "base64 0.13.0", + "base64 0.13.1", "bincode", "bs58", - "cached 0.34.1", - "ethers-core", + "cached 0.40.0", + "derive_builder 0.11.2", "futures", "hex", "hyper", - "ipfs", "iri-string 0.5.6", "kepler-lib", "lazy_static", "libipld", "libp2p", - "nom 6.1.2", "opentelemetry", "opentelemetry-jaeger", "percent-encoding", + "pin-project", "prometheus", "regex", "reqwest", "rocket", "serde", "serde_json", - "serde_with", + "serde_with 1.14.0", "sled", - "tempdir", + "tempfile", "thiserror", - "time 0.3.14", + "time 0.3.16", "tokio", "tokio-stream", - "tokio-util 0.6.10", + "tokio-util", "tracing", "tracing-log", "tracing-opentelemetry", "tracing-subscriber", - "urlencoding 2.1.2", + "urlencoding", "uuid", "void", ] @@ -3063,7 +2874,7 @@ name = "kepler-lib" version = "0.1.0" dependencies = [ "async-trait", - "base64 0.13.0", + "base64 0.13.1", "cacaos", "capgrok", "did-ethr", @@ -3074,12 +2885,12 @@ dependencies = [ "did-tz", "did-web", "did-webkey", - "iri-string 0.5.6", + "iri-string 0.6.0", "lazy_static", "libipld", "serde", "serde_json", - "serde_with", + "serde_with 1.14.0", "ssi", "thiserror", "tokio", @@ -3090,16 +2901,16 @@ dependencies = [ name = "kepler-sdk" version = "0.1.0" dependencies = [ - "base64 0.13.0", - "chrono", + "base64 0.13.1", "hex", "http", - "iri-string 0.4.1", + "iri-string 0.6.0", "kepler-lib", "serde", "serde_json", - "serde_with", + "serde_with 1.14.0", "thiserror", + "time 0.3.16", "tokio", "tracing", ] @@ -3112,7 +2923,7 @@ dependencies = [ "kepler-sdk", "serde", "serde_json", - "serde_with", + "serde_with 1.14.0", "wasm-bindgen", "wasm-bindgen-futures", ] @@ -3126,34 +2937,6 @@ dependencies = [ "log", ] -[[package]] -name = "lalrpop" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b30455341b0e18f276fa64540aff54deafb54c589de6aca68659c63dd2d5d823" -dependencies = [ - "ascii-canvas", - "atty", - "bit-set", - "diff", - "ena", - "itertools", - "lalrpop-util", - "petgraph 0.6.2", - "regex", - "regex-syntax", - "string_cache", - "term", - "tiny-keccak", - "unicode-xid", -] - -[[package]] -name = "lalrpop-util" -version = "0.19.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf796c978e9b4d983414f4caedc9273aa33ee214c5b887bd55fde84c85d2dc4" - [[package]] name = "langtag" version = "0.2.0" @@ -3169,30 +2952,17 @@ dependencies = [ "spin 0.5.2", ] -[[package]] -name = "lexical-core" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" -dependencies = [ - "arrayvec 0.5.2", - "bitflags", - "cfg-if", - "ryu", - "static_assertions", -] - [[package]] name = "libc" -version = "0.2.132" +version = "0.2.137" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5" +checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" [[package]] name = "libipld" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb2f6a99d838dcb1cc18361c79e827b76e91987227406e705d07cbef51ab7be" +checksum = "ac9c3aa309c260aa2f174bac968901eddc546e9d85950c28eae6a7bec402f926" dependencies = [ "async-trait", "cached 0.30.0", @@ -3204,16 +2974,16 @@ dependencies = [ "libipld-macro", "libipld-pb", "log", - "multihash 0.16.3", + "multihash", "parking_lot 0.12.1", "thiserror", ] [[package]] name = "libipld-cbor" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46b3bbc4f35b8f25eb140d183f33d4610a1eb6531b312f01161fa06693f8c28a" +checksum = "8dd1ab68c9d26f20c7d0dfea6eecbae8c00359875210001b33ca27d4a02f3d09" dependencies = [ "byteorder", "libipld-core", @@ -3222,9 +2992,9 @@ dependencies = [ [[package]] name = "libipld-cbor-derive" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6ec17d094f4f62e33e201ded63d911fd0bff3b12121ddc50d611e967f7e6824" +checksum = "69ec2f49393a1347a2d95ebcb248ff75d0d47235919b678036c010a8cd927375" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3235,49 +3005,49 @@ dependencies = [ [[package]] name = "libipld-core" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbdd758764f9680a818af33c31db733eb7c45224715d8816b9dcf0548c75f7c5" +checksum = "d44790246ec6b7314cba745992c23d479d018073e66d49ae40ae1b64e5dd8eb5" dependencies = [ "anyhow", "cid", "core2", "multibase 0.9.1", - "multihash 0.16.3", + "multihash", "serde", "thiserror", ] [[package]] name = "libipld-json" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415427568962961e21009eb92fd6052de95174423cff9d3c583491858e060f4e" +checksum = "18aa481a87f084d98473dd9ece253a9569c762b75f6bbba8217d54e48c9d63b3" dependencies = [ "libipld-core", - "multihash 0.16.3", + "multihash", "serde", "serde_json", ] [[package]] name = "libipld-macro" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c4cb1056262ef4056ad9e5fb41f252c45f55009888e21b7837ac051f38814a" +checksum = "852c011562ae5059b67c3a917f9f5945af5a68df8e39ede4444fff33274d25e2" dependencies = [ "libipld-core", ] [[package]] name = "libipld-pb" -version = "0.13.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b851a08aeff23e1e8df42081ef22052a838e8e39b769fcb7867d2fadd834d2d" +checksum = "c003be513496578115256a1b4ac7b80d4ece2462c9869dfb736fd30d8bb1d1c0" dependencies = [ "libipld-core", - "prost 0.9.0", - "prost-build 0.9.0", + "prost 0.10.4", + "prost-build 0.10.4", "thiserror", ] @@ -3289,20 +3059,21 @@ checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565" [[package]] name = "libp2p" -version = "0.43.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e8570e25fa03d4385405dbeaf540ba00e3ee50942f03d84e1a8928a029f35f9" +checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" dependencies = [ - "atomic", "bytes", "futures", "futures-timer", - "getrandom 0.2.7", + "getrandom 0.2.8", "instant", "lazy_static", + "libp2p-autonat", "libp2p-core", + "libp2p-dcutr", "libp2p-dns", - "libp2p-floodsub", + "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-metrics", @@ -3313,19 +3084,39 @@ dependencies = [ "libp2p-swarm", "libp2p-swarm-derive", "libp2p-tcp", + "libp2p-wasm-ext", + "libp2p-websocket", "libp2p-yamux", "multiaddr", "parking_lot 0.12.1", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", "smallvec", ] +[[package]] +name = "libp2p-autonat" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a72e3fc1050ee2a206e30bf81d946df6ddb7b6930ae599027e3272d9035b157" +dependencies = [ + "async-trait", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-request-response", + "libp2p-swarm", + "log", + "prost 0.11.0", + "prost-build 0.11.1", + "rand 0.8.5", +] + [[package]] name = "libp2p-core" -version = "0.32.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5b02602099fb75cb2d16f9ea860a320d6eb82ce41e95ab680912c454805cd5" +checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" dependencies = [ "asn1_der", "bs58", @@ -3338,78 +3129,114 @@ dependencies = [ "lazy_static", "log", "multiaddr", - "multihash 0.16.3", + "multihash", "multistream-select", "parking_lot 0.12.1", - "pin-project 1.0.12", - "prost 0.9.0", - "prost-build 0.9.0", + "pin-project", + "prost 0.11.0", + "prost-build 0.11.1", "rand 0.8.5", - "ring", "rw-stream-sink", "sha2 0.10.6", "smallvec", "thiserror", - "unsigned-varint 0.7.1", + "unsigned-varint", "void", "zeroize", ] +[[package]] +name = "libp2p-dcutr" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "380846ac24e641d38bfdb317cd77cbbb923527ce2eb8f71bce0b107c7249e2a9" +dependencies = [ + "asynchronous-codec", + "bytes", + "either", + "futures", + "futures-timer", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "prost 0.11.0", + "prost-build 0.11.1", + "prost-codec", + "thiserror", + "void", +] + [[package]] name = "libp2p-dns" -version = "0.32.1" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "066e33e854e10b5c93fc650458bf2179c7e0d143db260b0963e44a94859817f1" +checksum = "2322c9fb40d99101def6a01612ee30500c89abbbecb6297b3cd252903a4c1720" dependencies = [ "futures", "libp2p-core", "log", + "parking_lot 0.12.1", "smallvec", "trust-dns-resolver", ] [[package]] -name = "libp2p-floodsub" -version = "0.34.0" +name = "libp2p-gossipsub" +version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0b7d6c3fa2ead77a5bbeff580bd7507efcc9d7fa9d0caf873795b097d385c0" +checksum = "a7b8d02b9089241196479c6fdae22df4d4444509edb3a8e7ef388218ca9b5e3e" dependencies = [ - "cuckoofilter", + "asynchronous-codec", + "base64 0.13.1", + "byteorder", + "bytes", "fnv", "futures", + "hex_fmt", + "instant", "libp2p-core", "libp2p-swarm", "log", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.7.3", + "prometheus-client", + "prost 0.11.0", + "prost-build 0.11.1", + "rand 0.8.5", + "regex", + "sha2 0.10.6", "smallvec", + "unsigned-varint", + "wasm-timer", ] [[package]] name = "libp2p-identify" -version = "0.34.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f219b4d4660fe3a04bf5fe6b5970902b7c1918e25b2536be8c70efc480f88f8" +checksum = "dcf9a121f699e8719bda2e6e9e9b6ddafc6cff4602471d6481c1067930ccb29b" dependencies = [ + "asynchronous-codec", "futures", "futures-timer", "libp2p-core", "libp2p-swarm", "log", "lru", - "prost 0.9.0", - "prost-build 0.9.0", + "prost 0.11.0", + "prost-build 0.11.1", + "prost-codec", "smallvec", + "thiserror", + "void", ] [[package]] name = "libp2p-kad" -version = "0.35.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aead5ee2322a7b825c7633065370909c8383046f955cda5b56797e6904db7a72" +checksum = "6721c200e2021f6c3fab8b6cf0272ead8912d871610ee194ebd628cecf428f22" dependencies = [ - "arrayvec 0.5.2", + "arrayvec 0.7.2", "asynchronous-codec", "bytes", "either", @@ -3420,24 +3247,26 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.9.0", - "prost-build 0.9.0", - "rand 0.7.3", + "prost 0.11.0", + "prost-build 0.11.1", + "rand 0.8.5", "sha2 0.10.6", "smallvec", "thiserror", "uint", - "unsigned-varint 0.7.1", + "unsigned-varint", "void", ] [[package]] name = "libp2p-metrics" -version = "0.4.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29e4e5e4c5aa567fe1ee3133afe088dc2d2fd104e20c5c2c5c2649f75129677" +checksum = "9ee31b08e78b7b8bfd1c4204a9dd8a87b4fcdf6dafc57eb51701c1c264a81cb9" dependencies = [ "libp2p-core", + "libp2p-dcutr", + "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-ping", @@ -3448,9 +3277,9 @@ dependencies = [ [[package]] name = "libp2p-mplex" -version = "0.32.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "442eb0c9fff0bf22a34f015724b4143ce01877e079ed0963c722d94c07c72160" +checksum = "692664acfd98652de739a8acbb0a0d670f1d67190a49be6b4395e22c37337d89" dependencies = [ "asynchronous-codec", "bytes", @@ -3459,16 +3288,16 @@ dependencies = [ "log", "nohash-hasher", "parking_lot 0.12.1", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "unsigned-varint 0.7.1", + "unsigned-varint", ] [[package]] name = "libp2p-noise" -version = "0.35.0" +version = "0.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dd7e0c94051cda67123be68cf6b65211ba3dde7277be9068412de3e7ffd63ef" +checksum = "048155686bd81fe6cb5efdef0c6290f25ad32a0a42e8f4f72625cf6a505a206f" dependencies = [ "bytes", "curve25519-dalek 3.2.0", @@ -3476,8 +3305,8 @@ dependencies = [ "lazy_static", "libp2p-core", "log", - "prost 0.9.0", - "prost-build 0.9.0", + "prost 0.11.0", + "prost-build 0.11.1", "rand 0.8.5", "sha2 0.10.6", "snow", @@ -3488,9 +3317,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.34.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ab44a12d372d6abdd326c468c1d5b002be06fbd923c5a799d6a9d3b36646ca3" +checksum = "7228b9318d34689521349a86eb39a3c3a802c9efc99a0568062ffb80913e3f91" dependencies = [ "futures", "futures-timer", @@ -3498,15 +3327,15 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", + "rand 0.8.5", "void", ] [[package]] name = "libp2p-relay" -version = "0.7.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "517be90a2ce60b6c3bdfe88f34cc789c61dafe6f694a7b45e644af7353880fa3" +checksum = "3266c322fa094e229eb63c2644b0209a7e1db1d78ab6f03956eb3534bb514155" dependencies = [ "asynchronous-codec", "bytes", @@ -3517,22 +3346,40 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "pin-project 1.0.12", - "prost 0.9.0", - "prost-build 0.9.0", + "pin-project", + "prost 0.11.0", + "prost-build 0.11.1", + "prost-codec", "rand 0.8.5", "smallvec", "static_assertions", "thiserror", - "unsigned-varint 0.7.1", "void", ] +[[package]] +name = "libp2p-request-response" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8827af16a017b65311a410bb626205a9ad92ec0473967618425039fa5231adc1" +dependencies = [ + "async-trait", + "bytes", + "futures", + "instant", + "libp2p-core", + "libp2p-swarm", + "log", + "rand 0.8.5", + "smallvec", + "unsigned-varint", +] + [[package]] name = "libp2p-swarm" -version = "0.34.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53ab2d4eb8ef2966b10fdf859245cdd231026df76d3c6ed2cf9e418a8f688ec9" +checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" dependencies = [ "either", "fnv", @@ -3541,8 +3388,8 @@ dependencies = [ "instant", "libp2p-core", "log", - "pin-project 1.0.12", - "rand 0.7.3", + "pin-project", + "rand 0.8.5", "smallvec", "thiserror", "void", @@ -3550,24 +3397,24 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.27.2" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f693c8c68213034d472cbb93a379c63f4f307d97c06f1c41e4985de481687a5" +checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" dependencies = [ + "heck", "quote", "syn", ] [[package]] name = "libp2p-tcp" -version = "0.32.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "193447aa729c85aac2376828df76d171c1a589c9e6b58fcc7f9d9a020734122c" +checksum = "9839d96761491c6d3e238e70554b856956fca0ab60feb9de2cd08eed4473fa92" dependencies = [ "futures", "futures-timer", - "if-addrs", - "ipnet", + "if-watch", "libc", "libp2p-core", "log", @@ -3575,32 +3422,92 @@ dependencies = [ "tokio", ] +[[package]] +name = "libp2p-wasm-ext" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a17b5b8e7a73e379e47b1b77f8a82c4721e97eca01abcd18e9cd91a23ca6ce97" +dependencies = [ + "futures", + "js-sys", + "libp2p-core", + "parity-send-wrapper", + "wasm-bindgen", + "wasm-bindgen-futures", +] + +[[package]] +name = "libp2p-websocket" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3758ae6f89b2531a24b6d9f5776bda6a626b60a57600d7185d43dfa75ca5ecc4" +dependencies = [ + "either", + "futures", + "futures-rustls", + "libp2p-core", + "log", + "parking_lot 0.12.1", + "quicksink", + "rw-stream-sink", + "soketto", + "url", + "webpki-roots", +] + [[package]] name = "libp2p-yamux" -version = "0.36.0" +version = "0.41.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be902ebd89193cd020e89e89107726a38cfc0d16d18f613f4a37d046e92c7517" +checksum = "30f079097a21ad017fc8139460630286f02488c8c13b26affb46623aa20d8845" dependencies = [ "futures", "libp2p-core", + "log", "parking_lot 0.12.1", "thiserror", "yamux", ] +[[package]] +name = "libz-sys" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + [[package]] name = "linked-hash-map" version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" +[[package]] +name = "linux-raw-sys" +version = "0.0.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" + [[package]] name = "lock_api" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f80bf5aacaf25cbfc8210d1cfb718f2bf3b11c4c54e5afe36c236853a8ec390" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" dependencies = [ - "autocfg 1.1.0", + "autocfg", "scopeguard", ] @@ -3631,9 +3538,9 @@ dependencies = [ [[package]] name = "lru" -version = "0.7.8" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999beba7b6e8345721bd280141ed958096a2e4abdf74f67ff4ce49b4b54e47a" +checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ "hashbrown 0.12.3", ] @@ -3680,10 +3587,13 @@ dependencies = [ ] [[package]] -name = "md5" -version = "0.7.0" +name = "md-5" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" +checksum = "6365506850d44bff6e2fbcb5176cf63650e48bd45ef2fe2665ae1570e0f4b9ca" +dependencies = [ + "digest 0.10.5", +] [[package]] name = "memchr" @@ -3697,27 +3607,15 @@ version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] -[[package]] -name = "memsec" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac78937f19a0c7807e45a931eac41f766f210173ec664ec046d58e6d388a5cb" - [[package]] name = "mime" version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" version = "0.5.4" @@ -3729,14 +3627,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" dependencies = [ "libc", "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -3747,9 +3645,9 @@ checksum = "8c1dd912d3c7c6c6fd557d1eadfc20ef57bb0a4de572cb0e875b171571c355e4" [[package]] name = "multer" -version = "2.0.3" +version = "2.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a30ba6d97eb198c5e8a35d67d5779d6680cca35652a60ee90fc23dc431d4fde8" +checksum = "6ed4198ce7a4cbd2a57af78d28c6fbb57d81ac5f1d6ad79ac6c5587419cbdf22" dependencies = [ "bytes", "encoding_rs", @@ -3761,8 +3659,8 @@ dependencies = [ "mime", "spin 0.9.4", "tokio", - "tokio-util 0.7.4", - "version_check", + "tokio-util", + "version_check 0.9.4", ] [[package]] @@ -3775,11 +3673,11 @@ dependencies = [ "bs58", "byteorder", "data-encoding", - "multihash 0.16.3", + "multihash", "percent-encoding", "serde", "static_assertions", - "unsigned-varint 0.7.1", + "unsigned-varint", "url", ] @@ -3805,21 +3703,6 @@ dependencies = [ "data-encoding-macro", ] -[[package]] -name = "multihash" -version = "0.11.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567122ab6492f49b59def14ecc36e13e64dca4188196dd0cd41f9f3f979f3df6" -dependencies = [ - "blake2b_simd 0.5.11", - "blake2s_simd 0.5.11", - "digest 0.9.0", - "sha-1", - "sha2 0.9.9", - "sha3 0.9.1", - "unsigned-varint 0.5.1", -] - [[package]] name = "multihash" version = "0.16.3" @@ -3827,7 +3710,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c346cf9999c631f002d8f977c4eaeaa0e6386f16007202308d0b3757522c2cc" dependencies = [ "blake2b_simd 1.0.0", - "blake2s_simd 1.0.0", + "blake2s_simd", "blake3", "core2", "digest 0.10.5", @@ -3835,8 +3718,8 @@ dependencies = [ "serde", "serde-big-array", "sha2 0.10.6", - "sha3 0.10.5", - "unsigned-varint 0.7.1", + "sha3 0.10.6", + "unsigned-varint", ] [[package]] @@ -3854,48 +3737,119 @@ dependencies = [ ] [[package]] -name = "multimap" -version = "0.8.3" +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + +[[package]] +name = "multistream-select" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bc41247ec209813e2fd414d6e16b9d94297dacf3cd613fa6ef09cd4d9755c10" +dependencies = [ + "bytes", + "futures", + "log", + "pin-project", + "smallvec", + "unsigned-varint", +] + +[[package]] +name = "native-tls" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "netlink-packet-core" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "345b8ab5bd4e71a2986663e88c56856699d060e78e152e6e9d7966fcd5491297" +dependencies = [ + "anyhow", + "byteorder", + "libc", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-route" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9ea4302b9759a7a88242299225ea3688e63c85ea136371bb6cf94fd674efaab" +dependencies = [ + "anyhow", + "bitflags", + "byteorder", + "libc", + "netlink-packet-core", + "netlink-packet-utils", +] + +[[package]] +name = "netlink-packet-utils" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" +checksum = "25af9cf0dc55498b7bd94a1508af7a78706aa0ab715a73c5169273e03c84845e" +dependencies = [ + "anyhow", + "byteorder", + "paste", + "thiserror", +] [[package]] -name = "multistream-select" -version = "0.11.0" +name = "netlink-proto" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" +checksum = "65b4b14489ab424703c092062176d52ba55485a89c076b4f9db05092b7223aa6" dependencies = [ "bytes", "futures", "log", - "pin-project 1.0.12", - "smallvec", - "unsigned-varint 0.7.1", + "netlink-packet-core", + "netlink-sys", + "thiserror", + "tokio", ] [[package]] -name = "native-tls" -version = "0.2.10" +name = "netlink-sys" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +checksum = "92b654097027250401127914afb37cb1f311df6610a9891ff07a757e94199027" dependencies = [ - "lazy_static", + "async-io", + "bytes", + "futures", "libc", "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", ] [[package]] -name = "new_debug_unreachable" -version = "1.0.4" +name = "nix" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +dependencies = [ + "bitflags", + "cfg-if", + "libc", +] [[package]] name = "nohash-hasher" @@ -3905,36 +3859,22 @@ checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" [[package]] name = "nom" -version = "6.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7413f999671bd4745a7b624bd370a569fb6bc574b23c83a3c5ed2e453f3d5e2" -dependencies = [ - "bitvec 0.19.6", - "funty", - "lexical-core", - "memchr", - "version_check", -] - -[[package]] -name = "nom" -version = "7.1.1" +version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +checksum = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" dependencies = [ "memchr", - "minimal-lexical", + "version_check 0.1.5", ] [[package]] -name = "num-bigint" -version = "0.2.6" +name = "nu-ansi-term" +version = "0.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090c7f9998ee0ff65aa5b723e4009f7b217707f1fb5ea551329cc4d6231fb304" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" dependencies = [ - "autocfg 1.1.0", - "num-integer", - "num-traits", + "overload", + "winapi", ] [[package]] @@ -3943,37 +3883,47 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-integer", "num-traits", ] [[package]] name = "num-bigint-dig" -version = "0.6.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d51546d704f52ef14b3c962b5776e53d5b862e5790e40a350d366c209bd7f7a" +checksum = "566d173b2f9406afbc5510a90925d5a2cd80cae4605631f1212303df265de011" dependencies = [ - "autocfg 0.1.8", "byteorder", "lazy_static", "libm", "num-integer", "num-iter", "num-traits", - "rand 0.7.3", + "rand 0.8.5", "serde", "smallvec", "zeroize", ] +[[package]] +name = "num-derive" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "num-integer" version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-traits", ] @@ -3983,7 +3933,7 @@ version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" dependencies = [ - "autocfg 1.1.0", + "autocfg", "num-integer", "num-traits", ] @@ -3994,7 +3944,8 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ - "autocfg 1.1.0", + "autocfg", + "libm", ] [[package]] @@ -4018,9 +3969,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.14.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7254b99e31cad77da24b08ebf628882739a608578bb1bcdfc1f9c21260d7c0" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" [[package]] name = "opaque-debug" @@ -4036,9 +3987,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.41" +version = "0.10.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" +checksum = "12fc0523e3bd51a692c8850d075d74dc062ccf251c0110668cbd921917118a13" dependencies = [ "bitflags", "cfg-if", @@ -4068,20 +4019,20 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.22.0+1.1.1q" +version = "111.24.0+1.1.1s" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f31f0d509d1c1ae9cada2f9539ff8f37933831fd5098879e482aa687d659853" +checksum = "3498f259dab01178c6228c6b00dcef0ed2a2d5e20d648c017861227773ea4abd" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.75" +version = "0.9.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" +checksum = "b03b84c3b2d099b81f0953422b4d4ad58761589d0229b5506356afca05a3670a" dependencies = [ - "autocfg 1.1.0", + "autocfg", "cc", "libc", "openssl-src", @@ -4103,7 +4054,7 @@ dependencies = [ "js-sys", "lazy_static", "percent-encoding", - "pin-project 1.0.12", + "pin-project", "rand 0.8.5", "thiserror", "tokio", @@ -4161,61 +4112,27 @@ dependencies = [ ] [[package]] -name = "owning_ref" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" -dependencies = [ - "stable_deref_trait", -] - -[[package]] -name = "p256" -version = "0.8.1" +name = "overload" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f05f5287453297c4c16af5e2b04df8fd2a3008d70f252729650bc6d7ace5844" -dependencies = [ - "ecdsa 0.11.1", - "elliptic-curve 0.9.12", - "sha2 0.9.9", -] +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "p256" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d053368e1bae4c8a672953397bd1bd7183dde1c72b0b7612a15719173148d186" -dependencies = [ - "ecdsa 0.12.4", - "elliptic-curve 0.10.6", - "sha2 0.9.9", -] - -[[package]] -name = "parity-scale-codec" -version = "2.3.1" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373b1a4c1338d9cd3d1fa53b3a11bdab5ab6bd80a20f7f7becd76953ae2be909" +checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ - "arrayvec 0.7.2", - "bitvec 0.20.4", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", ] [[package]] -name = "parity-scale-codec-derive" -version = "2.3.1" +name = "parity-send-wrapper" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] +checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parking" @@ -4241,7 +4158,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" dependencies = [ "lock_api", - "parking_lot_core 0.9.3", + "parking_lot_core 0.9.4", ] [[package]] @@ -4260,17 +4177,23 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09a279cbf25cb0757810394fbc1e359949b59e348145c643a939a525692e6929" +checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-sys", + "windows-sys 0.42.0", ] +[[package]] +name = "paste" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" + [[package]] name = "pct-str" version = "1.1.0" @@ -4301,14 +4224,12 @@ dependencies = [ ] [[package]] -name = "pem" -version = "0.8.3" +name = "pem-rfc7468" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd56cbd21fea48d0c440b41cd69c589faacade08c992d9a54e471b79d0fd13eb" +checksum = "01de5d978f34aa4b2296576379fcc416034702fd94117c56ffd8a1a767cefb30" dependencies = [ - "base64 0.13.0", - "once_cell", - "regex", + "base64ct", ] [[package]] @@ -4317,86 +4238,63 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" -[[package]] -name = "pest" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb779fcf4bb850fbbb0edc96ff6cf34fd90c4b1a112ce042653280d9a7364048" -dependencies = [ - "thiserror", - "ucd-trie", -] - -[[package]] -name = "pest_derive" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502b62a6d0245378b04ffe0a7fb4f4419a4815fce813bd8a0ec89a56e07d67b1" -dependencies = [ - "pest", - "pest_generator", -] - -[[package]] -name = "pest_generator" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451e629bf49b750254da26132f1a5a9d11fd8a95a3df51d15c4abd1ba154cb6c" -dependencies = [ - "pest", - "pest_meta", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "pest_meta" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcec162c71c45e269dfc3fc2916eaeb97feab22993a21bcce4721d08cd7801a6" -dependencies = [ - "once_cell", - "pest", - "sha1", -] - -[[package]] -name = "petgraph" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" -dependencies = [ - "fixedbitset 0.2.0", - "indexmap", -] - [[package]] name = "petgraph" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" dependencies = [ - "fixedbitset 0.4.2", + "fixedbitset", "indexmap", ] [[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - -[[package]] -name = "pin-project" -version = "0.4.30" +name = "pgp" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef0f924a5ee7ea9cbcea77529dba45f8a9ba9f622419fe3386ca581a3ae9d5a" +checksum = "c0c63db779c3f090b540dfa0484f8adc2d380e3aa60cdb0f3a7a97454e22edc5" dependencies = [ - "pin-project-internal 0.4.30", + "aes 0.7.5", + "base64 0.13.1", + "bitfield", + "block-modes", + "block-padding 0.2.1", + "blowfish", + "buf_redux", + "byteorder", + "cast5", + "cfb-mode", + "chrono", + "cipher 0.3.0", + "circular", + "clear_on_drop", + "crc24", + "derive_builder 0.9.0", + "des", + "digest 0.9.0", + "ed25519-dalek", + "flate2", + "generic-array 0.14.6", + "hex", + "lazy_static", + "log", + "md-5 0.9.1", + "nom", + "num-bigint-dig", + "num-derive", + "num-traits", + "rand 0.8.5", + "ripemd160", + "rsa", + "sha-1", + "sha2 0.9.9", + "sha3 0.9.1", + "signature", + "smallvec", + "thiserror", + "twofish", + "x25519-dalek", + "zeroize", ] [[package]] @@ -4405,14 +4303,14 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" dependencies = [ - "pin-project-internal 1.0.12", + "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "0.4.30" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "851c8d0ce9bebe43790dedfc86614c23494ac9f423dd618d3a61fc693eafe61e" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", @@ -4420,15 +4318,10 @@ dependencies = [ ] [[package]] -name = "pin-project-internal" -version = "1.0.12" +name = "pin-project-lite" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] +checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" [[package]] name = "pin-project-lite" @@ -4442,39 +4335,51 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs1" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a78f66c04ccc83dd4486fd46c33896f4e17b24a7a3a6400dedc48ed0ddd72320" +dependencies = [ + "der 0.5.1", + "pkcs8 0.8.0", + "zeroize", +] + [[package]] name = "pkcs8" -version = "0.6.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9c2f795bc591cb3384cb64082a578b89207ac92bb89c9d98c1ea2ace7cd8110" +checksum = "7cabda3fb821068a9a4fab19a683eac3af12edf0f34b94a8be53c4972b8149d0" dependencies = [ - "der 0.3.5", - "spki 0.3.0", + "der 0.5.1", + "spki 0.5.4", + "zeroize", ] [[package]] name = "pkcs8" -version = "0.7.6" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee3ef9b64d26bad0536099c816c6734379e45bbd5f14798def6809e5cc350447" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der 0.4.5", - "spki 0.4.1", + "der 0.6.0", + "spki 0.6.0", ] [[package]] name = "pkg-config" -version = "0.3.25" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" +checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" [[package]] name = "polling" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "899b00b9c8ab553c743b3e11e87c5c7d423b2a2de229ba95b24a756344748011" +checksum = "ab4609a838d88b73d8238967b60dd115cc08d38e2bbaf51ee1e4b695f89122e2" dependencies = [ - "autocfg 1.1.0", + "autocfg", "cfg-if", "libc", "log", @@ -4490,7 +4395,7 @@ checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ "cpufeatures", "opaque-debug 0.3.0", - "universal-hash", + "universal-hash 0.4.1", ] [[package]] @@ -4502,20 +4407,26 @@ dependencies = [ "cfg-if", "cpufeatures", "opaque-debug 0.3.0", - "universal-hash", + "universal-hash 0.4.1", ] [[package]] -name = "ppv-lite86" -version = "0.2.16" +name = "polyval" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" +checksum = "7ef234e08c11dfcb2e56f79fd70f6f2eb7f025c0ce2333e82f4f0518ecad30c6" +dependencies = [ + "cfg-if", + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash 0.5.0", +] [[package]] -name = "precomputed-hash" -version = "0.1.1" +name = "ppv-lite86" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" +checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" [[package]] name = "primitive-types" @@ -4527,19 +4438,6 @@ dependencies = [ "uint", ] -[[package]] -name = "primitive-types" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05e4722c697a58a99d5d06a08c30821d7c082a4632198de1eaa5a6c22ef42373" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-rlp", - "impl-serde", - "uint", -] - [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -4561,7 +4459,7 @@ dependencies = [ "proc-macro2", "quote", "syn", - "version_check", + "version_check 0.9.4", ] [[package]] @@ -4572,14 +4470,14 @@ checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ "proc-macro2", "quote", - "version_check", + "version_check 0.9.4", ] [[package]] name = "proc-macro2" -version = "1.0.43" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a2ca2c61bc9f3d74d2886294ab7b9853abd9c1ad903a3ac7815c58989bb7bab" +checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" dependencies = [ "unicode-ident", ] @@ -4593,28 +4491,28 @@ dependencies = [ "proc-macro2", "quote", "syn", - "version_check", + "version_check 0.9.4", "yansi", ] [[package]] name = "procfs" -version = "0.12.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0941606b9934e2d98a3677759a971756eb821f75764d0e0d26946d08e74d9104" +checksum = "2dfb6451c91904606a1abe93e83a8ec851f45827fa84273f256ade45dc095818" dependencies = [ "bitflags", "byteorder", "hex", "lazy_static", - "libc", + "rustix", ] [[package]] name = "prometheus" -version = "0.13.2" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45c8babc29389186697fe5a2a4859d697825496b83db5d0b65271cdc0488e88c" +checksum = "449811d15fbdf5ceb5c1144416066429cf82316e2ec8ce0c1f6f8a02e7bbcf8c" dependencies = [ "cfg-if", "fnv", @@ -4629,21 +4527,21 @@ dependencies = [ [[package]] name = "prometheus-client" -version = "0.15.1" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9a896938cc6018c64f279888b8c7559d3725210d5db9a3a1ee6bc7188d51d34" +checksum = "83cd1b99916654a69008fd66b4f9397fbe08e6e51dfe23d4417acf5d3b8cb87c" dependencies = [ "dtoa", "itoa", - "owning_ref", + "parking_lot 0.12.1", "prometheus-client-derive-text-encode", ] [[package]] name = "prometheus-client-derive-text-encode" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8e12d01b9d66ad9eb4529c57666b6263fc1993cb30261d83ead658fdd932652" +checksum = "66a455fbcb954c1a7decf3c586e860fd7889cddf4b8e164be736dbac95a953cd" dependencies = [ "proc-macro2", "quote", @@ -4652,67 +4550,84 @@ dependencies = [ [[package]] name = "prost" -version = "0.8.0" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" +checksum = "71adf41db68aa0daaefc69bb30bcd68ded9b9abaad5d1fbb6304c4fb390e083e" dependencies = [ "bytes", - "prost-derive 0.8.0", + "prost-derive 0.10.1", ] [[package]] name = "prost" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +checksum = "399c3c31cdec40583bb68f0b18403400d01ec4289c383aa047560439952c4dd7" dependencies = [ "bytes", - "prost-derive 0.9.0", + "prost-derive 0.11.0", ] [[package]] name = "prost-build" -version = "0.8.0" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" +checksum = "8ae5a4388762d5815a9fc0dea33c56b021cdc8dde0c55e0c9ca57197254b0cab" dependencies = [ "bytes", - "heck 0.3.3", + "cfg-if", + "cmake", + "heck", "itertools", + "lazy_static", "log", "multimap", - "petgraph 0.5.1", - "prost 0.8.0", - "prost-types 0.8.0", + "petgraph", + "prost 0.10.4", + "prost-types 0.10.1", + "regex", "tempfile", "which", ] [[package]] name = "prost-build" -version = "0.9.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +checksum = "7f835c582e6bd972ba8347313300219fed5bfa52caf175298d860b61ff6069bb" dependencies = [ "bytes", - "heck 0.3.3", + "heck", "itertools", "lazy_static", "log", "multimap", - "petgraph 0.6.2", - "prost 0.9.0", - "prost-types 0.9.0", + "petgraph", + "prost 0.11.0", + "prost-types 0.11.1", "regex", "tempfile", "which", ] +[[package]] +name = "prost-codec" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "011ae9ff8359df7915f97302d591cdd9e0e27fbd5a4ddc5bd13b71079bb20987" +dependencies = [ + "asynchronous-codec", + "bytes", + "prost 0.11.0", + "thiserror", + "unsigned-varint", +] + [[package]] name = "prost-derive" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" +checksum = "7b670f45da57fb8542ebdbb6105a925fe571b67f9e7ed9f47a06a84e72b4e7cc" dependencies = [ "anyhow", "itertools", @@ -4723,9 +4638,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +checksum = "7345d5f0e08c0536d7ac7229952590239e77abf0a0100a1b1d890add6ea96364" dependencies = [ "anyhow", "itertools", @@ -4736,29 +4651,29 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" +checksum = "2d0a014229361011dc8e69c8a1ec6c2e8d0f2af7c91e3ea3f5b2170298461e68" dependencies = [ "bytes", - "prost 0.8.0", + "prost 0.10.4", ] [[package]] name = "prost-types" -version = "0.9.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +checksum = "4dfaa718ad76a44b3415e6c4d53b17c8f99160dcb3a99b10470fce8ad43f6e3e" dependencies = [ "bytes", - "prost 0.9.0", + "prost 0.11.0", ] [[package]] name = "protobuf" -version = "2.27.1" +version = "2.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf7e6d18738ecd0902d30d1ad232c9125985a3422929b16c65517b38adc14f96" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" [[package]] name = "quick-error" @@ -4767,12 +4682,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] -name = "quick-protobuf" -version = "0.8.0" +name = "quicksink" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ca6639207ac869e31cca06b8adbc7676278f22b321e51115766009b4f192dbb" +checksum = "77de3c815e5a160b1539c6592796801df2043ae35e123b46d73380cfa57af858" dependencies = [ - "byteorder", + "futures-core", + "futures-sink", + "pin-project-lite 0.1.12", ] [[package]] @@ -4784,31 +4701,12 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "radium" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "941ba9d78d8e2f7ce474c015eea4d9c6d25b6a3327f9832ee29a4de27f91bbb8" - [[package]] name = "radium" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.7.3" @@ -4853,21 +4751,6 @@ dependencies = [ "rand_core 0.6.4", ] -[[package]] -name = "rand_core" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b" -dependencies = [ - "rand_core 0.4.2", -] - -[[package]] -name = "rand_core" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" - [[package]] name = "rand_core" version = "0.5.1" @@ -4883,7 +4766,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", ] [[package]] @@ -4895,15 +4778,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rdrand" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -dependencies = [ - "rand_core 0.3.1", -] - [[package]] name = "redox_syscall" version = "0.2.16" @@ -4913,31 +4787,20 @@ dependencies = [ "bitflags", ] -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom 0.2.7", - "redox_syscall", - "thiserror", -] - [[package]] name = "ref-cast" -version = "1.0.9" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed13bcd201494ab44900a96490291651d200730904221832b9547d24a87d332b" +checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.9" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5234cd6063258a5e32903b53b1b6ac043a0541c8adc1f610f67b0326c7a578fa" +checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" dependencies = [ "proc-macro2", "quote", @@ -4981,11 +4844,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.11" +version = "0.11.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +checksum = "431949c384f4e2ae07605ccaa56d1d9d2ecdb5cadd4f9577ccfab29f2e5149fc" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", "bytes", "encoding_rs", "futures-core", @@ -4994,26 +4857,31 @@ dependencies = [ "http", "http-body", "hyper", + "hyper-rustls 0.23.0", "hyper-tls", "ipnet", "js-sys", - "lazy_static", "log", "mime", "native-tls", + "once_cell", "percent-encoding", - "pin-project-lite", + "pin-project-lite 0.2.9", + "rustls 0.20.7", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", "tokio", "tokio-native-tls", + "tokio-rustls 0.23.4", "tokio-socks", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", "winreg 0.10.1", ] @@ -5027,6 +4895,17 @@ dependencies = [ "quick-error", ] +[[package]] +name = "rfc6979" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88c86280f057430a52f4861551b092a01b419b8eacefc7c995eacb9dc132fe32" +dependencies = [ + "crypto-bigint 0.4.9", + "hmac", + "zeroize", +] + [[package]] name = "ring" version = "0.16.20" @@ -5053,27 +4932,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "rlp" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "999508abb0ae792aabed2460c45b89106d97fe4adac593bdaef433c2605847b5" -dependencies = [ - "bytes", - "rustc-hex", -] - -[[package]] -name = "rlp-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "rocket" version = "0.5.0-rc.2" @@ -5095,7 +4953,7 @@ dependencies = [ "multer", "num_cpus", "parking_lot 0.12.1", - "pin-project-lite", + "pin-project-lite 0.2.9", "rand 0.8.5", "ref-cast", "rocket_codegen", @@ -5104,12 +4962,12 @@ dependencies = [ "serde_json", "state", "tempfile", - "time 0.3.14", + "time 0.3.16", "tokio", "tokio-stream", - "tokio-util 0.7.4", + "tokio-util", "ubyte", - "version_check", + "version_check 0.9.4", "yansi", ] @@ -5145,44 +5003,51 @@ dependencies = [ "memchr", "pear", "percent-encoding", - "pin-project-lite", + "pin-project-lite 0.2.9", "ref-cast", "serde", "smallvec", "stable-pattern", "state", - "time 0.3.14", + "time 0.3.16", "tokio", "uncased", ] [[package]] name = "rsa" -version = "0.3.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3648b669b10afeab18972c105e284a7b953a669b0be3514c27f9b17acab2f9cd" +checksum = "4cf22754c49613d2b3b119f0e5d46e34a2c628a937e3024b8762de4e7d8c710b" dependencies = [ "byteorder", - "digest 0.9.0", - "lazy_static", + "digest 0.10.5", "num-bigint-dig", "num-integer", "num-iter", "num-traits", - "pem", - "rand 0.7.3", - "sha2 0.9.9", - "simple_asn1 0.4.1", + "pkcs1", + "pkcs8 0.8.0", + "rand_core 0.6.4", + "smallvec", "subtle", - "thiserror", "zeroize", ] [[package]] -name = "rustc-hex" -version = "2.1.0" +name = "rtnetlink" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" +checksum = "322c53fd76a18698f1c27381d58091de3a043d356aa5bd0d510608b565f469a0" +dependencies = [ + "async-global-executor", + "futures", + "log", + "netlink-packet-route", + "netlink-proto", + "nix", + "thiserror", +] [[package]] name = "rustc_version" @@ -5193,17 +5058,43 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.35.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.42.0", +] + [[package]] name = "rustls" version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", + "log", + "ring", + "sct 0.6.1", + "webpki 0.21.4", +] + +[[package]] +name = "rustls" +version = "0.20.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "539a2bfe908f471bfa933876bd1eb6a19cf2176d375f82ef7f99530a40e48c2c" +dependencies = [ "log", "ring", - "sct", - "webpki", + "sct 0.7.0", + "webpki 0.22.0", ] [[package]] @@ -5213,11 +5104,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092" dependencies = [ "openssl-probe", - "rustls", + "rustls 0.19.1", "schannel", "security-framework", ] +[[package]] +name = "rustls-pemfile" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" +dependencies = [ + "base64 0.13.1", +] + [[package]] name = "rustversion" version = "1.0.9" @@ -5226,12 +5126,12 @@ checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" [[package]] name = "rw-stream-sink" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" dependencies = [ "futures", - "pin-project 0.4.30", + "pin-project", "static_assertions", ] @@ -5247,6 +5147,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6518fc26bced4d53678a22d6e423e9d8716377def84545fe328236e3af070e7f" +[[package]] +name = "safemem" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072" + [[package]] name = "schannel" version = "0.1.20" @@ -5254,14 +5160,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" dependencies = [ "lazy_static", - "windows-sys", + "windows-sys 0.36.1", ] [[package]] name = "scoped-tls" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "scopeguard" @@ -5269,6 +5175,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "sct" version = "0.6.1" @@ -5279,6 +5191,30 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sct" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct", + "der 0.6.0", + "generic-array 0.14.6", + "pkcs8 0.9.0", + "subtle", + "zeroize", +] + [[package]] name = "security-framework" version = "2.7.0" @@ -5308,62 +5244,11 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" -[[package]] -name = "sequoia-openpgp" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee32fced98917f2c03d571658934aadae9b1527133ae9c7ac3cadb9d8252a05" -dependencies = [ - "aes 0.6.0", - "anyhow", - "base64 0.13.0", - "block-modes", - "block-padding 0.2.1", - "blowfish", - "buffered-reader", - "cast5", - "chrono", - "cipher 0.2.5", - "des", - "digest 0.9.0", - "dyn-clone", - "eax", - "ecdsa 0.11.1", - "ed25519-dalek", - "flate2", - "generic-array 0.14.6", - "getrandom 0.2.7", - "idea", - "idna 0.2.3", - "lalrpop", - "lalrpop-util", - "lazy_static", - "libc", - "md-5", - "memsec", - "num-bigint-dig", - "p256 0.8.1", - "rand 0.7.3", - "rand_core 0.6.4", - "regex", - "regex-syntax", - "ripemd160", - "rsa", - "sha-1", - "sha1collisiondetection", - "sha2 0.9.9", - "thiserror", - "twofish", - "typenum", - "x25519-dalek", - "xxhash-rust", -] - [[package]] name = "serde" -version = "1.0.144" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f747710de3dcd43b88c9168773254e809d8ddbdf9653b84e2554ab219f17860" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] @@ -5388,9 +5273,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.144" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94ed3a816fb1d101812f83e789f888322c34e291f894f19590dc310963e87a00" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -5410,9 +5295,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.85" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e55a28e3aaef9d5ce0506d0a14dbba8054ddc7e499ef522dd8b26859ec9d4a44" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -5437,10 +5322,26 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ - "base64 0.13.0", + "base64 0.13.1", + "hex", + "serde", + "serde_with_macros 1.5.2", +] + +[[package]] +name = "serde_with" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f2d60d049ea019a84dcd6687b0d1e0030fe663ae105039bdf967ed5e6a9a7" +dependencies = [ + "base64 0.13.1", + "chrono", "hex", + "indexmap", "serde", - "serde_with_macros", + "serde_json", + "serde_with_macros 2.0.1", + "time 0.3.16", ] [[package]] @@ -5455,6 +5356,18 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_with_macros" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ccadfacf6cf10faad22bbadf55986bdd0856edfb5d9210aa1dcf1f516e84e93" +dependencies = [ + "darling 0.14.2", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -5479,16 +5392,6 @@ dependencies = [ "digest 0.10.5", ] -[[package]] -name = "sha1collisiondetection" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66558a774ef5044cb4a834db5f5c7f95e139d2341d7f502fe6034afa7082461" -dependencies = [ - "digest 0.9.0", - "generic-array 0.14.6", -] - [[package]] name = "sha2" version = "0.8.2" @@ -5539,9 +5442,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2904bea16a1ae962b483322a1c7b81d976029203aea1f461e51cd7705db7ba9" +checksum = "bdf0c33fae925bdc080598b84bc15c55e7b9a4a43b3c704da051f977469691c9" dependencies = [ "digest 0.10.5", "keccak", @@ -5567,25 +5470,14 @@ dependencies = [ [[package]] name = "signature" -version = "1.3.2" +version = "1.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2807892cfa58e081aa1f1111391c7a0649d4fa127a4ffbe34bcbfb35a1171a4" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" dependencies = [ - "digest 0.9.0", + "digest 0.10.5", "rand_core 0.6.4", ] -[[package]] -name = "simple_asn1" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692ca13de57ce0613a363c8c2f1de925adebc81b04c923ac60c5488bb44abe4b" -dependencies = [ - "chrono", - "num-bigint 0.2.6", - "num-traits", -] - [[package]] name = "simple_asn1" version = "0.5.4" @@ -5593,31 +5485,39 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eb4ea60fb301dc81dfc113df680571045d375ab7345d171c5dc7d7e13107a80" dependencies = [ "chrono", - "num-bigint 0.4.3", + "num-bigint", "num-traits", "thiserror", ] -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - [[package]] name = "siwe" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf4de418b0989028f138b74db880525e1dbab7fdbeeb4ba8ad96f62bc9ed9a3" +checksum = "ec4cc2eafb2354c1aeaeac5f53b7726ca4ea5ad16314a0b5ebacb6676f599c2b" dependencies = [ "hex", "http", - "iri-string 0.4.1", + "iri-string 0.6.0", "k256", "rand 0.8.5", - "sha3 0.9.1", + "sha3 0.10.6", + "thiserror", + "time 0.3.16", +] + +[[package]] +name = "siwe-recap" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afe6254970fe99274b440ba4c5e9891550939e7a3c10274029b2e8a9ab2d5c8b" +dependencies = [ + "base64 0.12.3", + "iri-string 0.6.0", + "serde", + "serde_json", + "siwe", "thiserror", - "time 0.3.14", ] [[package]] @@ -5626,7 +5526,7 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" dependencies = [ - "autocfg 1.1.0", + "autocfg", ] [[package]] @@ -5647,9 +5547,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "snow" @@ -5657,7 +5557,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "774d05a3edae07ce6d68ea6984f3c05e9bba8927e3dd591e3b479e5b03213d0d" dependencies = [ - "aes-gcm", + "aes-gcm 0.9.4", "blake2", "chacha20poly1305", "curve25519-dalek 4.0.0-pre.1", @@ -5672,10 +5572,26 @@ dependencies = [ name = "socket2" version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "soketto" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1c5305e39e09653383c2c7244f2f78b3bcae37cf50c64cb4789c9f5096ec2" dependencies = [ - "libc", - "winapi", + "base64 0.13.1", + "bytes", + "flate2", + "futures", + "httparse", + "log", + "rand 0.8.5", + "sha-1", ] [[package]] @@ -5692,20 +5608,22 @@ checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" [[package]] name = "spki" -version = "0.3.0" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dae7e047abc519c96350e9484a96c6bf1492348af912fd3446dd2dc323f6268" +checksum = "44d01ac02a6ccf3e07db148d2be087da624fea0221a16152ed01f0496a6b0a27" dependencies = [ - "der 0.3.5", + "base64ct", + "der 0.5.1", ] [[package]] name = "spki" -version = "0.4.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c01a0c15da1b0b0e1494112e7af814a678fec9bd157881b49beac661e9b6f32" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ - "der 0.4.5", + "base64ct", + "der 0.6.0", ] [[package]] @@ -5722,10 +5640,9 @@ dependencies = [ [[package]] name = "ssi" version = "0.4.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "ssi-caips", - "ssi-contexts", "ssi-core", "ssi-crypto", "ssi-dids", @@ -5744,7 +5661,7 @@ dependencies = [ [[package]] name = "ssi-caips" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "bs58", "ssi-jwk", @@ -5754,12 +5671,12 @@ dependencies = [ [[package]] name = "ssi-contexts" version = "0.1.3" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" [[package]] name = "ssi-core" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "serde", @@ -5769,14 +5686,13 @@ dependencies = [ [[package]] name = "ssi-crypto" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "bs58", "digest 0.9.0", "k256", "keccak-hash", "ripemd160", - "serde", "sha2 0.10.6", "thiserror", "zeroize", @@ -5785,20 +5701,17 @@ dependencies = [ [[package]] name = "ssi-dids" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "anyhow", "async-std", "async-trait", "bs58", "chrono", - "derive_builder", + "derive_builder 0.9.0", "hex", - "http", "multibase 0.8.0", "percent-encoding", - "pest", - "pest_derive", "reqwest", "serde", "serde_json", @@ -5813,7 +5726,7 @@ dependencies = [ [[package]] name = "ssi-json-ld" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-std", "chrono", @@ -5833,21 +5746,22 @@ dependencies = [ [[package]] name = "ssi-jwk" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "base64 0.12.3", "blake2b_simd 0.5.11", "bs58", "ed25519-dalek", + "getrandom 0.2.8", "k256", "lazy_static", - "num-bigint 0.4.3", - "p256 0.9.0", + "num-bigint", + "p256", "rand 0.7.3", "rand 0.8.5", "rsa", "serde", - "simple_asn1 0.5.4", + "simple_asn1", "ssi-crypto", "thiserror", "zeroize", @@ -5856,20 +5770,19 @@ dependencies = [ [[package]] name = "ssi-jws" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "base64 0.12.3", - "blake2b_simd 0.5.11", + "blake2", "clear_on_drop", "ed25519-dalek", "k256", - "p256 0.9.0", - "rand 0.7.3", + "p256", + "rand 0.8.5", "rsa", "serde", "serde_json", - "sha2 0.9.9", - "ssi-core", + "sha2 0.10.6", "ssi-crypto", "ssi-jwk", "thiserror", @@ -5878,7 +5791,7 @@ dependencies = [ [[package]] name = "ssi-jwt" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "chrono", "serde", @@ -5891,17 +5804,15 @@ dependencies = [ [[package]] name = "ssi-ldp" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "bs58", "chrono", "hex", "k256", - "keccak-hash", "lazy_static", "multibase 0.8.0", - "p256 0.9.0", "serde", "serde_jcs", "serde_json", @@ -5913,15 +5824,13 @@ dependencies = [ "ssi-json-ld", "ssi-jwk", "ssi-jws", - "ssi-jwt", - "ssi-tzkey", "thiserror", ] [[package]] name = "ssi-ssh" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "sshkeys", "ssi-jwk", @@ -5931,7 +5840,7 @@ dependencies = [ [[package]] name = "ssi-tzkey" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "bs58", "ed25519-dalek", @@ -5943,14 +5852,14 @@ dependencies = [ [[package]] name = "ssi-ucan" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "base64 0.12.3", "chrono", "libipld", "serde", "serde_json", - "serde_with", + "serde_with 1.14.0", "ssi-caips", "ssi-core", "ssi-dids", @@ -5963,16 +5872,20 @@ dependencies = [ [[package]] name = "ssi-vc" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "base64 0.12.3", - "bitvec 0.20.4", + "bitvec", + "cacaos", "chrono", "flate2", + "libipld", + "multihash", "reqwest", "serde", "serde_json", + "siwe-recap", "ssi-core", "ssi-dids", "ssi-json-ld", @@ -5986,7 +5899,7 @@ dependencies = [ [[package]] name = "ssi-zcap-ld" version = "0.1.0" -source = "git+https://github.com/spruceid/ssi?branch=main#d19575d2d4251ddc200d54845a59174971964147" +source = "git+https://github.com/spruceid/ssi?branch=feat/ucan-ipld-version#e5cf96b7efd899a080b8f2cc763fc39a434ce536" dependencies = [ "async-trait", "serde", @@ -6008,12 +5921,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "stable_deref_trait" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" - [[package]] name = "state" version = "0.5.3" @@ -6029,19 +5936,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "string_cache" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213494b7a2b503146286049378ce02b482200519accc31872ee8be91fa820a08" -dependencies = [ - "new_debug_unreachable", - "once_cell", - "parking_lot 0.12.1", - "phf_shared", - "precomputed-hash", -] - [[package]] name = "strsim" version = "0.9.3" @@ -6062,9 +5956,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.100" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52205623b1b0f064a4e71182c3b18ae902267282930c6d5462c91b859668426e" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -6084,21 +5978,32 @@ dependencies = [ ] [[package]] -name = "tap" -version = "1.0.1" +name = "system-configuration" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +checksum = "d75182f12f490e953596550b65ee31bda7c8e043d9386174b353bda50838c3fd" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] [[package]] -name = "tempdir" -version = "0.3.7" +name = "system-configuration-sys" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" dependencies = [ - "rand 0.4.6", - "remove_dir_all", + "core-foundation-sys", + "libc", ] +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tempfile" version = "3.3.0" @@ -6114,30 +6019,28 @@ dependencies = [ ] [[package]] -name = "term" -version = "0.7.0" +name = "termcolor" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59df8ac95d96ff9bede18eb7300b0fda5e5d8d90960e76f8e14ae765eedbf1f" +checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" dependencies = [ - "dirs-next", - "rustversion", - "winapi", + "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c53f98874615aea268107765aa1ed8f6116782501d18e53d08b471733bea6c85" +checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8b463991b4eab2d801e724172285ec4195c650e8ec79b149e6c2a8e6dd3f783" +checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" dependencies = [ "proc-macro2", "quote", @@ -6188,21 +6091,32 @@ dependencies = [ [[package]] name = "time" -version = "0.3.14" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3f9a28b618c3a6b9251b6908e9c99e04b9e5c02e6581ccbb67d59c34ef7f9b" +checksum = "0fab5c8b9980850e06d92ddbe3ab839c062c801f3927c0fb8abd6fc8e918fbca" dependencies = [ "itoa", "libc", "num_threads", + "serde", + "time-core", "time-macros", ] +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + [[package]] name = "time-macros" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +checksum = "65bb801831d812c562ae7d2bfb531f26e66e4e1f6b17307ba4149c5064710e5b" +dependencies = [ + "time-core", +] [[package]] name = "tiny-keccak" @@ -6230,18 +6144,17 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.21.1" +version = "1.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0020c875007ad96677dcc890298f4b942882c5d4eb7cc8f439fc3bf813dc9c95" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" dependencies = [ - "autocfg 1.1.0", + "autocfg", "bytes", "libc", "memchr", "mio", "num_cpus", - "once_cell", - "pin-project-lite", + "pin-project-lite 0.2.9", "signal-hook-registry", "socket2", "tokio-macros", @@ -6275,9 +6188,20 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" dependencies = [ - "rustls", + "rustls 0.19.1", + "tokio", + "webpki 0.21.4", +] + +[[package]] +name = "tokio-rustls" +version = "0.23.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +dependencies = [ + "rustls 0.20.7", "tokio", - "webpki", + "webpki 0.22.0", ] [[package]] @@ -6294,26 +6218,12 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6edf2d6bc038a43d31353570e27270603f4648d18f5ed10c0e179abe43255af" -dependencies = [ - "futures-core", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.6.10" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" dependencies = [ - "bytes", "futures-core", - "futures-sink", - "log", - "pin-project-lite", + "pin-project-lite 0.2.9", "tokio", ] @@ -6325,8 +6235,9 @@ checksum = "0bb2e075f03b3d66d8d8785356224ba688d2906a371015e225beeb65ca92c740" dependencies = [ "bytes", "futures-core", + "futures-io", "futures-sink", - "pin-project-lite", + "pin-project-lite 0.2.9", "tokio", "tracing", ] @@ -6348,8 +6259,8 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "pin-project 1.0.12", - "pin-project-lite", + "pin-project", + "pin-project-lite 0.2.9", "tokio", "tower-layer", "tower-service", @@ -6358,9 +6269,9 @@ dependencies = [ [[package]] name = "tower-layer" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" [[package]] name = "tower-service" @@ -6370,22 +6281,22 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.36" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fce9567bd60a67d08a16488756721ba392f24f29006402881e43b19aac64307" +checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if", "log", - "pin-project-lite", + "pin-project-lite 0.2.9", "tracing-attributes", "tracing-core", ] [[package]] name = "tracing-attributes" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11c75893af559bc8e10716548bdef5cb2b983f8e637db9d0e15126b61b484ee2" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", @@ -6394,26 +6305,14 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aeea4303076558a00714b823f9ad67d58a3bbda1df83d8827d21193156e22f7" +checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", "valuable", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "futures", - "futures-task", - "pin-project 1.0.12", - "tracing", -] - [[package]] name = "tracing-log" version = "0.1.3" @@ -6451,12 +6350,12 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.15" +version = "0.3.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60db860322da191b40952ad9affe65ea23e7dd6a5c442c2c42865810c6ab8e6b" +checksum = "a6176eae26dd70d0c919749377897b54a9276bd7061339665dd68777926b5a70" dependencies = [ - "ansi_term", "matchers", + "nu-ansi-term", "once_cell", "regex", "serde", @@ -6481,9 +6380,9 @@ dependencies = [ [[package]] name = "trust-dns-proto" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c31f240f59877c3d4bb3b3ea0ec5a6a0cff07323580ff8c7a605cd7d08b255d" +checksum = "4f7f83d1e4a0e4358ac54c5c3681e5d7da5efc5a7a632c90bb6d6669ddd9bc26" dependencies = [ "async-trait", "cfg-if", @@ -6495,32 +6394,32 @@ dependencies = [ "idna 0.2.3", "ipnet", "lazy_static", - "log", "rand 0.8.5", "smallvec", "thiserror", "tinyvec", "tokio", + "tracing", "url", ] [[package]] name = "trust-dns-resolver" -version = "0.21.2" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4ba72c2ea84515690c9fcef4c6c660bb9df3036ed1051686de84605b74fd558" +checksum = "aff21aa4dcefb0a1afbfac26deb0adc93888c7d295fb63ab273ef276ba2b7cfe" dependencies = [ "cfg-if", "futures-util", "ipconfig", "lazy_static", - "log", "lru-cache", "parking_lot 0.12.1", "resolv-conf", "smallvec", "thiserror", "tokio", + "tracing", "trust-dns-proto", ] @@ -6532,12 +6431,12 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "twofish" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0028f5982f23ecc9a1bc3008ead4c664f843ed5d78acd3d213b99ff50c441bc2" +checksum = "728f6b7e784825d272fe9d2a77e44063f4197a570cbedc6fdcc90a6ddac91296" dependencies = [ "byteorder", - "cipher 0.2.5", + "cipher 0.3.0", "opaque-debug 0.3.0", ] @@ -6556,17 +6455,11 @@ dependencies = [ "serde", ] -[[package]] -name = "ucd-trie" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" - [[package]] name = "uint" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f03af7ccf01dd611cc450a0d10dbc9b745770d096473e2faf0ca6e2d66d1e0" +checksum = "a45526d29728d135c2900b0d30573fe3ee79fceb12ef534c7bb30e810a91b601" dependencies = [ "byteorder", "crunchy", @@ -6581,7 +6474,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09b01702b0fd0b3fadcf98e098780badda8742d4f4a7676615cad90e8ac73622" dependencies = [ "serde", - "version_check", + "version_check 0.9.4", ] [[package]] @@ -6592,9 +6485,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcc811dc4066ac62f84f11307873c4850cb653bfa9b1719cee2bd2204a4bc5dd" +checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" [[package]] name = "unicode-normalization" @@ -6606,10 +6499,10 @@ dependencies = [ ] [[package]] -name = "unicode-segmentation" -version = "1.10.0" +name = "unicode-width" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" [[package]] name = "unicode-xid" @@ -6628,10 +6521,14 @@ dependencies = [ ] [[package]] -name = "unsigned-varint" -version = "0.5.1" +name = "universal-hash" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fdeedbf205afadfe39ae559b75c3240f24e257d0ca27e85f85cb82aa19ac35" +checksum = "7d3160b73c9a19f7e2939a2fdad446c57c1bbbbf4d919d3213ff1267a580d8b5" +dependencies = [ + "crypto-common", + "subtle", +] [[package]] name = "unsigned-varint" @@ -6641,6 +6538,8 @@ checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" dependencies = [ "asynchronous-codec", "bytes", + "futures-io", + "futures-util", ] [[package]] @@ -6660,12 +6559,6 @@ dependencies = [ "percent-encoding", ] -[[package]] -name = "urlencoding" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a1f0175e03a0973cf4afd476bef05c26e228520400eb1fd473ad417b1c00ffb" - [[package]] name = "urlencoding" version = "2.1.2" @@ -6674,11 +6567,12 @@ checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" [[package]] name = "uuid" -version = "1.1.2" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd6469f4314d5f1ffec476e05f17cc9a78bc7a27a6a857842170bdf8d6f98d2f" +checksum = "feb41e78f93363bb2df8b0e86a2ca30eed7806ea16ea0c790d757cf93f79be83" dependencies = [ - "getrandom 0.2.7", + "getrandom 0.2.8", + "wasm-bindgen", ] [[package]] @@ -6694,7 +6588,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2209b78d1249f7e6f3293657c9779fe31ced465df091bbd433a1cf88e916ec55" dependencies = [ "ctor", - "version_check", + "version_check 0.9.4", ] [[package]] @@ -6703,6 +6597,12 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" +[[package]] +name = "version_check" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd" + [[package]] name = "version_check" version = "0.9.4" @@ -6815,6 +6715,21 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +[[package]] +name = "wasm-timer" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0ecb0db480561e9a7642b5d3e4187c128914e58aa84330b9493e3eb68c5e7f" +dependencies = [ + "futures", + "js-sys", + "parking_lot 0.11.2", + "pin-utils", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + [[package]] name = "web-sys" version = "0.3.60" @@ -6835,6 +6750,25 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.22.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +dependencies = [ + "webpki 0.22.0", +] + [[package]] name = "wepoll-ffi" version = "0.1.2" @@ -6877,6 +6811,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -6896,6 +6839,19 @@ dependencies = [ "windows_x86_64_msvc 0.32.0", ] +[[package]] +name = "windows" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45296b64204227616fdbf2614cefa4c236b98ee64dfaaaa435207ed99fe7829f" +dependencies = [ + "windows_aarch64_msvc 0.34.0", + "windows_i686_gnu 0.34.0", + "windows_i686_msvc 0.34.0", + "windows_x86_64_gnu 0.34.0", + "windows_x86_64_msvc 0.34.0", +] + [[package]] name = "windows-sys" version = "0.36.1" @@ -6909,66 +6865,153 @@ dependencies = [ "windows_x86_64_msvc 0.36.1", ] +[[package]] +name = "windows-sys" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.0", + "windows_i686_gnu 0.42.0", + "windows_i686_msvc 0.42.0", + "windows_x86_64_gnu 0.42.0", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" + [[package]] name = "windows_aarch64_msvc" version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" +[[package]] +name = "windows_aarch64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" + [[package]] name = "windows_i686_gnu" version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" +[[package]] +name = "windows_i686_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" + [[package]] name = "windows_i686_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +[[package]] +name = "windows_i686_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" + [[package]] name = "windows_i686_msvc" version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" +[[package]] +name = "windows_i686_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" + [[package]] name = "windows_i686_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +[[package]] +name = "windows_i686_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" + [[package]] name = "windows_x86_64_gnu" version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" +[[package]] +name = "windows_x86_64_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" + [[package]] name = "windows_x86_64_msvc" version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" +[[package]] +name = "windows_x86_64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" + [[package]] name = "winreg" version = "0.7.0" @@ -7010,12 +7053,6 @@ version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "114ba2b24d2167ef6d67d7d04c8cc86522b87f490025f39f0303b7db5bf5e3d8" -[[package]] -name = "xxhash-rust" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "074914ea4eec286eb8d1fd745768504f420a1f7b7919185682a4a267bed7d2e7" - [[package]] name = "yamux" version = "0.10.2" @@ -7038,9 +7075,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zeroize" -version = "1.4.3" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" dependencies = [ "zeroize_derive", ] diff --git a/Cargo.toml b/Cargo.toml index f7066d4c..152370b6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,27 +10,26 @@ license = "Apache-2.0" [dependencies] anyhow = "=1.0.59" async-recursion = "0.3" -aws-config = "0.9" -aws-sdk-dynamodb = "0.9" -aws-sdk-s3 = "0.9" -aws-types = "0.9" -aws-smithy-http = "0.39" +aws-config = "0.49" +aws-sdk-dynamodb = "0.19" +aws-sdk-s3 = "0.19" +aws-types = "0.49" +aws-smithy-http = "0.49" base64 = "0.13" bincode = "1.3" bs58 = "0.4" -cached = "0.34" -ethers-core = "0.6" -futures = { default-features = false, version = "0.3.9", features = ["alloc", "std"] } +cached = "0.40" +derive_builder = "0.11" +futures = { default-features = false, version = "0.3", features = ["alloc", "std"] } hex = "0.4" hyper = "0.14" # Prometheus server -ipfs = { git = "https://github.com/spruceid/rust-ipfs", branch = "feat/update-libipld" } iri-string = "0.5" lazy_static = "1.4.0" -libipld = "0.13" -libp2p = { default-features = false, features = ["floodsub", "identify", "kad", "tcp-tokio", "mplex", "noise", "ping", "yamux", "dns-tokio", "relay"], version = "0.43.0" } -nom = "6" +libipld = "0.14" +libp2p = { default-features = false, features = ["autonat", "websocket", "wasm-ext", "gossipsub", "identify", "kad", "tcp-tokio", "mplex", "noise", "ping", "yamux", "dns-tokio", "relay", "dcutr"], version = "0.49.0" } opentelemetry = { version = "0.17.0", features = ["rt-tokio"] } opentelemetry-jaeger = { version = "0.16.0", features = ["rt-tokio", "reqwest_collector_client"] } +pin-project = "1" prometheus = { version = "0.13.0", features = ["process"] } regex = "1.5" reqwest = { version = "0.11", features = ["json"] } @@ -40,10 +39,11 @@ serde_json = "1" serde_with = { version = "1", features = ["hex"] } sled = "0.34" thiserror = "1" +tempfile = "3" time = "0.3" tokio = { version = "1", features = ["rt", "macros", "rt-multi-thread"] } tokio-stream = { version = "0.1", features = ["fs"] } -tokio-util = "0.6.9" +tokio-util = { version = "0.7", features = ["compat"] } tracing = "0.1" tracing-log = "0.1" tracing-opentelemetry = "0.17.2" @@ -56,9 +56,6 @@ percent-encoding = "2.1" [dependencies.kepler-lib] path = "lib/" -[dev-dependencies] -tempdir = "0.3.7" - [workspace] members = [ diff --git a/lib/Cargo.toml b/lib/Cargo.toml index 6c5b3e15..2877f251 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -5,24 +5,24 @@ edition = "2021" [dependencies] async-trait = "0.1" -iri-string = "0.5" -libipld = "0.13" +iri-string = "0.6" +libipld = "0.14" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" serde_with = "1.0" thiserror = "1" base64 = "0.13" -cacaos = { git = "https://github.com/spruceid/cacao-rs" } -capgrok = "0.2" +cacaos = "0.5" +capgrok = "=0.3.0" lazy_static = "1.4" -did-method-key = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } -did-tz = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } -did-ethr = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } -did-pkh = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } -did-web = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } -did-webkey = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } -did-onion = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } -did-ion = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "main" } +did-method-key = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } +did-tz = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } +did-ethr = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } +did-pkh = { git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } +did-web = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } +did-webkey = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } +did-onion = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } +did-ion = { default-features = false, git = "https://github.com/spruceid/ssi", branch = "feat/ucan-ipld-version" } [target.'cfg(target_arch = "wasm32")'.dependencies] uuid = { version = "1", features = ["v4", "js"] } @@ -32,9 +32,9 @@ uuid = { version = "1", features = ["v4"] } [dependencies.ssi] git = "https://github.com/spruceid/ssi" -branch = "main" +branch = "feat/ucan-ipld-version" default-features = false -features = ["ed25519", "rsa"] +features = ["ed25519", "rsa", "secp256k1"] [dev-dependencies.tokio] version = "1" diff --git a/lib/src/resource.rs b/lib/src/resource.rs index cf721139..9360e49f 100644 --- a/lib/src/resource.rs +++ b/lib/src/resource.rs @@ -18,14 +18,6 @@ use std::io::{Read, Seek, Write}; use std::{convert::TryFrom, fmt, str::FromStr}; use thiserror::Error; -#[derive(Clone, Copy, Debug)] -pub enum SupportedCodecs { - Raw = 0x55, - Json = 0x0200, - MsgPack = 0x0201, - Cbor = 0x51, -} - #[derive(Clone, Hash, PartialEq, Debug, Eq, SerializeDisplay, DeserializeFromStr)] pub struct OrbitId { suffix: String, @@ -51,7 +43,7 @@ impl OrbitId { pub fn get_cid(&self) -> Cid { Cid::new_v1( - SupportedCodecs::Raw as u64, + 0x55, // raw codec Code::Blake2b256.digest(self.to_string().as_bytes()), ) } @@ -131,7 +123,7 @@ impl ResourceId { pub fn get_cid(&self) -> Cid { Cid::new_v1( - SupportedCodecs::Raw as u64, + 0x55, // raw codec Code::Blake2b256.digest(self.to_string().as_bytes()), ) } diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 58b26ae7..a57cc6d7 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -5,10 +5,10 @@ edition = "2021" [dependencies] base64 = "0.13" -chrono = { version = "0.4" } +time = "0.3" hex = "0.4" http = "0.2" -iri-string = "0.4" +iri-string = "0.6" kepler-lib = { path = "../lib" } serde = { version = "1.0", features = ["derive"] } serde_with = { version = "1" } diff --git a/sdk/src/session.rs b/sdk/src/session.rs index 13c3b747..3e3e7a83 100644 --- a/sdk/src/session.rs +++ b/sdk/src/session.rs @@ -1,10 +1,9 @@ use crate::authorization::DelegationHeaders; -use chrono::Utc; use http::uri::Authority; use kepler_lib::{ authorization::{make_invocation, InvocationError as ZcapError, KeplerInvocation}, cacaos::{ - siwe::{nonce::generate_nonce, Message, TimeStamp, Version as SIWEVersion}, + siwe::{generate_nonce, Message, TimeStamp, Version as SIWEVersion}, siwe_cacao::SIWESignature, }, capgrok::Builder, @@ -16,6 +15,7 @@ use kepler_lib::{ use serde::{Deserialize, Serialize}; use serde_with::{serde_as, DisplayFromStr}; use std::collections::HashMap; +use time::OffsetDateTime; #[serde_as] #[derive(Deserialize, Clone)] @@ -140,7 +140,7 @@ impl Session { &self.jwk, self.verification_method, // 60 seconds in the future - (Utc::now().timestamp_nanos() as f64 / 1e+9_f64) + 60.0, + (OffsetDateTime::now_utc().nanosecond() as f64 / 1e+9_f64) + 60.0, None, None, ) diff --git a/sdk/src/siwe_utils.rs b/sdk/src/siwe_utils.rs index ec7ae98a..ec6a8e58 100644 --- a/sdk/src/siwe_utils.rs +++ b/sdk/src/siwe_utils.rs @@ -1,7 +1,7 @@ use http::uri::Authority; use kepler_lib::authorization::KeplerDelegation; use kepler_lib::cacaos::{ - siwe::{nonce::generate_nonce, Message, TimeStamp, Version}, + siwe::{generate_nonce, Message, TimeStamp, Version}, siwe_cacao::{SIWESignature, SiweCacao}, }; use kepler_lib::capgrok::Builder; diff --git a/src/auth_guards.rs b/src/auth_guards.rs index 275ae164..954ec60d 100644 --- a/src/auth_guards.rs +++ b/src/auth_guards.rs @@ -2,15 +2,18 @@ use crate::authorization::{Delegation, Invocation, Verifiable}; use crate::capabilities::store::{InvokeError, ToBlock, Updates}; use crate::config; use crate::orbit::{create_orbit, load_orbit, Orbit}; -use crate::relay::RelayNode; +use crate::p2p::relay::RelayNode; use crate::routes::Metadata; +use crate::BlockStores; use anyhow::Result; -use ipfs::{Multiaddr, PeerId}; use kepler_lib::{ libipld::Cid, resource::{OrbitId, ResourceId}, }; -use libp2p::identity::ed25519::Keypair as Ed25519Keypair; +use libp2p::{ + core::{multiaddr::multiaddr, Multiaddr, PeerId}, + identity::ed25519::Keypair as Ed25519Keypair, +}; use rocket::{ futures::future::try_join_all, http::Status, @@ -71,14 +74,17 @@ pub fn check_orbit_and_service( } fn get_state(req: &Request<'_>) -> Result<(config::Config, (PeerId, Multiaddr))> { + let config = req + .rocket() + .state::() + .cloned() + .ok_or_else(|| anyhow!("Could not retrieve config"))?; + let port = config.relay.port; Ok(( - req.rocket() - .state::() - .cloned() - .ok_or_else(|| anyhow!("Could not retrieve config"))?, + config, req.rocket() .state::() - .map(|r| (r.id, r.internal())) + .map(|r| (r.id().clone(), multiaddr!(Memory(port)))) .ok_or_else(|| anyhow!("Could not retrieve relay node information"))?, )) } @@ -140,7 +146,13 @@ impl<'l> FromRequest<'l> for DelegateAuthWrapper { .map(|((orbit_id, peer), (config, relay, token))| async move { match ( peer, - load_orbit(orbit_id.get_cid(), &config, relay.clone()).await, + load_orbit( + (*orbit_id).clone(), + &config.storage.blocks, + &config.storage.indexes, + relay.clone(), + ) + .await, ) { (Some(p), Ok(None)) => { let keys = match req @@ -179,7 +191,15 @@ impl<'l> FromRequest<'l> for DelegateAuthWrapper { } }; - match create_orbit(orbit_id, &config, &[], relay.clone(), kp).await { + match create_orbit( + orbit_id, + &config.storage.blocks, + &config.storage.indexes, + relay.clone(), + kp, + ) + .await + { Ok(Some(orbit)) => Ok(orbit), Ok(None) => Err(conflict(anyhow!("Orbit already exists"))), Err(e) => Err(internal_server_error(e)), @@ -214,12 +234,12 @@ impl<'l> FromRequest<'l> for DelegateAuthWrapper { } } -pub enum InvokeAuthWrapper { - KV(Box), +pub enum InvokeAuthWrapper { + KV(Box>), Revocation, } -impl InvokeAuthWrapper { +impl InvokeAuthWrapper { pub fn prometheus_label(&self) -> &str { match self { InvokeAuthWrapper::Revocation => "revoke_delegation", @@ -228,33 +248,33 @@ impl InvokeAuthWrapper { } } -pub enum KVAction { +pub enum KVAction { Delete { - orbit: Orbit, + orbit: Orbit, key: String, auth_ref: Cid, }, Get { - orbit: Orbit, + orbit: Orbit, key: String, }, List { - orbit: Orbit, + orbit: Orbit, prefix: String, }, Metadata { - orbit: Orbit, + orbit: Orbit, key: String, }, Put { - orbit: Orbit, + orbit: Orbit, key: String, metadata: Metadata, auth_ref: Cid, }, } -impl KVAction { +impl KVAction { pub fn prometheus_label(&self) -> &str { match self { KVAction::Delete { .. } => "kv_delete", @@ -267,7 +287,7 @@ impl KVAction { } #[async_trait] -impl<'l> FromRequest<'l> for InvokeAuthWrapper { +impl<'l> FromRequest<'l> for InvokeAuthWrapper { type Error = anyhow::Error; async fn from_request(req: &'l Request<'_>) -> Outcome { @@ -298,12 +318,18 @@ impl<'l> FromRequest<'l> for InvokeAuthWrapper { let res = match target.resource.service() { None => bad_request(anyhow!("missing service in invocation target")), Some("kv") => { - let orbit = - match load_orbit(target.resource.orbit().get_cid(), &config, relay).await { - Ok(Some(o)) => o, - Ok(None) => return not_found(anyhow!("No Orbit found")), - Err(e) => return internal_server_error(e), - }; + let orbit = match load_orbit( + target.resource.orbit().clone(), + &config.storage.blocks, + &config.storage.indexes, + relay, + ) + .await + { + Ok(Some(o)) => o, + Ok(None) => return not_found(anyhow!("No Orbit found")), + Err(e) => return internal_server_error(e), + }; let auth_ref = match orbit.capabilities.invoke([token.clone()]).await { Ok(c) => c, Err(InvokeError::Unauthorized(e)) => return unauthorized(e), diff --git a/src/authorization.rs b/src/authorization.rs index 8663568a..fa4dba02 100644 --- a/src/authorization.rs +++ b/src/authorization.rs @@ -1,15 +1,15 @@ use crate::{ capabilities::store::{FromBlock, ToBlock}, - ipfs::Block, + Block, }; use anyhow::Result; -use kepler_lib::libipld::Cid; use kepler_lib::{ authorization::{ EncodingError, HeaderEncode, KeplerDelegation, KeplerInvocation, KeplerRevocation, }, cacaos::siwe::Message, capgrok::{extract_capabilities, verify_statement, Capability as SiweCap, Set}, + libipld::{multihash::Code, Cid}, resolver::DID_METHODS, resource::{KRIParseError, ResourceId}, ssi::ucan::Capability as UcanCap, @@ -139,8 +139,7 @@ pub struct Invocation { impl ToBlock for Invocation { fn to_block(&self) -> Result { - self.invocation - .to_block(libipld::multihash::Code::Blake3_256) + self.invocation.to_block(Code::Blake3_256) } } @@ -516,7 +515,7 @@ mod test { }, }; - async fn gen( + async fn _gen( iss: &JWK, aud: String, caps: Vec, @@ -532,10 +531,10 @@ mod test { .await .1 .unwrap(), - gen_ucan((iss, did), aud, caps, exp, prf).await, + _gen_ucan((iss, did), aud, caps, exp, prf).await, ) } - async fn gen_ucan( + async fn _gen_ucan( iss: (&JWK, String), audience: String, attenuation: Vec, diff --git a/src/capabilities/mod.rs b/src/capabilities/mod.rs index 5e471b27..f3636b3f 100644 --- a/src/capabilities/mod.rs +++ b/src/capabilities/mod.rs @@ -1,14 +1,8 @@ pub mod store; -use crate::orbit::AbortOnDrop; use anyhow::Result; -use ipfs::PeerId; -use kepler_lib::libipld::{cbor::DagCborCodec, codec::Decode, multibase::Base, Cid}; -use rocket::futures::{Stream, StreamExt}; -use store::{CapsMessage, Store}; - -use std::io::Cursor; -use std::sync::Arc; +use kepler_lib::libipld::Cid; +use store::Store; #[rocket::async_trait] pub trait Invoke { @@ -16,87 +10,22 @@ pub trait Invoke { } #[derive(Clone)] -pub struct Service { - pub store: Store, - _task: Arc>, +pub struct Service { + pub store: Store, } -impl std::ops::Deref for Service { - type Target = Store; +impl std::ops::Deref for Service { + type Target = Store; fn deref(&self) -> &Self::Target { &self.store } } -impl Service { - fn new(store: Store, task: AbortOnDrop<()>) -> Self { - Self { - store, - _task: Arc::new(task), - } +impl Service { + fn new(store: Store) -> Self { + Self { store } } - pub async fn start(store: Store) -> Result { - let events = store - .ipfs - .pubsub_subscribe(store.id.get_cid().to_string_of_base(Base::Base58Btc)?) - .await? - .map( - |msg| match CapsMessage::decode(DagCborCodec, &mut Cursor::new(&msg.data)) { - Ok(m) => Ok((msg.source, m)), - Err(e) => Err(anyhow!(e)), - }, - ); - let peer_id = store.ipfs.identity().await?.0.to_peer_id(); - let task = AbortOnDrop::new(tokio::spawn(caps_task(events, store.clone(), peer_id))); - store.request_heads().await?; - Ok(Service::new(store, task)) + pub async fn start(store: Store) -> Result { + Ok(Service::new(store)) } } - -async fn caps_task( - events: impl Stream> + Send, - store: Store, - peer_id: PeerId, -) { - debug!("starting caps task"); - events - .for_each_concurrent(None, |ev| async { - match ev { - Ok((p, ev)) if p == peer_id => { - debug!("{} filtered out this event from self: {:?}", p, ev) - } - Ok((_, CapsMessage::Invocation(cid))) => { - debug!("recieved invocation"); - if let Err(e) = store.try_merge_invocations([cid].into_iter()).await { - debug!("failed to apply recieved invocation {}", e); - } - } - Ok((_, CapsMessage::StateReq)) => { - if let Err(e) = store.broadcast_heads().await { - debug!( - "failed to broadcast updates in response to state request {}", - e - ); - } - } - Ok(( - _, - CapsMessage::Heads { - updates, - invocations, - }, - )) => { - if let Err(e) = store - .try_merge_heads(updates.into_iter(), invocations.into_iter()) - .await - { - debug!("failed to merge heads {}", e); - } - } - Err(e) => { - debug!("cap service task error {}", e); - } - } - }) - .await; -} diff --git a/src/capabilities/store.rs b/src/capabilities/store.rs index 1b525823..febea6ac 100644 --- a/src/capabilities/store.rs +++ b/src/capabilities/store.rs @@ -1,13 +1,12 @@ use crate::{ authorization::{CapStore, Delegation, Invocation, Revocation, Verifiable}, indexes::{AddRemoveSetStore, HeadStore}, - ipfs::{Block, Ipfs}, kv::to_block_raw, + storage::ImmutableStore, + Block, }; use anyhow::Result; -use async_recursion::async_recursion; -use futures::stream::{self, TryStreamExt}; -use kepler_lib::libipld::{cbor::DagCborCodec, multibase::Base, multihash::Code, Cid, DagCbor}; +use kepler_lib::libipld::{cbor::DagCborCodec, multihash::Code, Cid, DagCbor}; use kepler_lib::{ authorization::{KeplerDelegation, KeplerInvocation, KeplerRevocation}, cacaos::siwe_cacao::SiweCacao, @@ -29,17 +28,21 @@ pub enum InvokeError { const SERVICE_NAME: &str = "capabilities"; #[derive(Clone)] -pub struct Store { +pub struct Store { pub id: ResourceId, - pub ipfs: Ipfs, pub(crate) root: String, + blocks: B, index: AddRemoveSetStore, delegation_heads: HeadStore, invocation_heads: HeadStore, } -impl Store { - pub async fn new(oid: &OrbitId, ipfs: Ipfs, config: config::IndexStorage) -> Result { +impl Store +where + B: ImmutableStore, + B::Error: 'static, +{ + pub async fn new(oid: &OrbitId, blocks: B, config: config::IndexStorage) -> Result { let id = oid .clone() .to_resource(Some(SERVICE_NAME.to_string()), None, None); @@ -70,7 +73,7 @@ impl Store { .await?; Ok(Self { id, - ipfs, + blocks, index, delegation_heads, invocation_heads, @@ -84,7 +87,6 @@ impl Store { pub async fn transact(&self, updates: Updates) -> Result<()> { let event = self.make_event(updates).await?; self.apply(event).await?; - self.broadcast_heads().await?; Ok(()) } @@ -98,20 +100,30 @@ impl Store { delegate: event.delegate.iter().map(|d| *d.0.block.cid()).collect(), revoke: event.revoke.iter().map(|r| *r.0.block.cid()).collect(), }; + let eb_block = eb.to_block()?; - let cid = self.ipfs.put_block(eb.to_block()?).await?; + let cid = Cid::new_v1( + eb_block.cid().codec(), + self.blocks + .write(eb_block.data(), eb_block.cid().hash().code().try_into()?) + .await?, + ); // write element indexes - try_join_all(event.delegate.into_iter().map(|d| async { + try_join_all(event.delegate.into_iter().map(|d| async move { // add backlink in index self.index .set_element(&d.1.block.cid().to_bytes(), &d.0.block.cid().to_bytes()) .await?; tracing::debug!("applied delegation {:?}", d.1.block.cid()); // put delegation block (encoded ucan or cacao) - self.ipfs.put_block(d.1.block).await?; + self.blocks + .write(d.1.block.data(), d.1.block.cid().hash().code().try_into()?) + .await?; // put link block - self.ipfs.put_block(d.0.block).await?; + self.blocks + .write(d.0.block.data(), d.0.block.cid().hash().code().try_into()?) + .await?; Result::<()>::Ok(()) })) .await?; @@ -126,9 +138,13 @@ impl Store { .await?; tracing::debug!("applied revocation {:?}", r.1.block.cid()); // put revocation block (encoded ucan revocation or cacao) - self.ipfs.put_block(r.1.block).await?; + self.blocks + .write(r.1.block.data(), r.1.block.cid().hash().code().try_into()?) + .await?; // put link block - self.ipfs.put_block(r.0.block).await?; + self.blocks + .write(r.0.block.data(), r.0.block.cid().hash().code().try_into()?) + .await?; Result::<()>::Ok(()) })) .await?; @@ -181,24 +197,9 @@ impl Store { .collect::, WithBlock)>>>()?, }) .await?; - self.broadcast_heads().await?; + // self.broadcast_heads().await?; Ok(cid) } - - async fn get_invocation(&self, i: &Cid) -> Result { - let update: InvocationsBlock = self.get_obj(i).await?.base; - - Ok(Invocations { - prev: update.prev, - invoke: try_join_all(update.invoke.iter().map(|c| async { - let link: WithBlock = self.get_obj(c).await?; - let inv: WithBlock = self.get_obj(&link.base.update).await?; - Result::<(WithBlock, WithBlock)>::Ok((link, inv)) - })) - .await?, - }) - } - pub(crate) async fn apply_invocations(&self, event: Invocations) -> Result { try_join_all( event @@ -212,7 +213,13 @@ impl Store { prev: event.prev, invoke: event.invoke.iter().map(|i| *i.0.block.cid()).collect(), }; - let cid = self.ipfs.put_block(eb.to_block()?).await?; + let eb_block = eb.to_block()?; + let cid = Cid::new_v1( + eb_block.cid().codec(), + self.blocks + .write(eb_block.data(), eb_block.cid().hash().code().try_into()?) + .await?, + ); for e in event.invoke.iter() { self.index @@ -260,155 +267,27 @@ impl Store { }) } - async fn get_event(&self, e: &Cid) -> Result { - let update: EventBlock = self.get_obj(e).await?.base; - - Ok(Event { - prev: update.prev, - delegate: try_join_all(update.delegate.iter().map(|c| async { - let link: WithBlock = self.get_obj(c).await?; - let del: WithBlock = self.get_obj(&link.base.update).await?; - Result::<(WithBlock, WithBlock)>::Ok((link, del)) - })) - .await?, - revoke: try_join_all(update.revoke.iter().map(|c| async { - let link: WithBlock = self.get_obj(c).await?; - let rev: WithBlock = self.get_obj(&link.base.update).await?; - Result::<(WithBlock, WithBlock)>::Ok((link, rev)) - })) - .await?, - }) - } - - async fn get_obj(&self, c: &Cid) -> Result> + async fn get_obj(&self, c: &Cid) -> Result>> where T: FromBlock, { - WithBlock::::try_from(self.ipfs.get_block(c).await?) - } - - pub(crate) async fn broadcast_heads(&self) -> Result<()> { - let updates = self.delegation_heads.get_heads().await?.0; - let invocations = self.invocation_heads.get_heads().await?.0; - if !updates.is_empty() || !invocations.is_empty() { - debug!( - "broadcasting {} update heads and {} invocation heads on {}", - updates.len(), - invocations.len(), - self.id, - ); - self.ipfs - .pubsub_publish( - self.id - .clone() - .get_cid() - .to_string_of_base(Base::Base58Btc)?, - CapsMessage::Heads { - updates, - invocations, - } - .to_block()? - .into_inner() - .1, - ) - .await?; - } - Ok(()) - } - - pub(crate) async fn request_heads(&self) -> Result<()> { - self.ipfs - .pubsub_publish( - self.id - .clone() - .get_cid() - .to_string_of_base(Base::Base58Btc)?, - CapsMessage::StateReq.to_block()?.into_inner().1, - ) - .await?; - Ok(()) - } - - pub(crate) async fn try_merge_heads( - &self, - updates: impl Iterator + Send, - invocations: impl Iterator + Send, - ) -> Result<()> { - self.try_merge_updates(updates).await?; - self.try_merge_invocations(invocations).await?; - Ok(()) - } - - #[async_recursion] - async fn try_merge_updates( - &self, - updates: impl Iterator + Send + 'async_recursion, - ) -> Result<()> { - try_join_all(updates.map(|head| async move { - if self.delegation_heads.get_height(&head).await?.is_some() { - return Ok(()); - }; - let update = self.get_event(&head).await?; - - self.try_merge_updates( - stream::iter(update.prev.iter().map(Ok).collect::>>()) - .try_filter_map(|d| async move { - self.delegation_heads.get_height(d).await.map(|o| match o { - Some(_) => None, - None => Some(*d), - }) - }) - .try_collect::>() - .await? - .into_iter(), - ) - .await?; - - self.apply(update).await - })) - .await?; - Ok(()) - } - - #[async_recursion] - pub(crate) async fn try_merge_invocations( - &self, - invocations: impl Iterator + Send + 'async_recursion, - ) -> Result<()> { - try_join_all(invocations.map(|head| async move { - if self.invocation_heads.get_height(&head).await?.is_some() { - return Result::<()>::Ok(()); - }; - - let invs: Invocations = self.get_invocation(&head).await?; - - self.try_merge_invocations( - stream::iter(invs.prev.iter().map(Ok).collect::>>()) - .try_filter_map(|i| async move { - self.invocation_heads.get_height(i).await.map(|o| match o { - Some(_) => None, - None => Some(*i), - }) - }) - .try_collect::>() - .await? - .into_iter(), - ) - .await?; - - self.apply_invocations(invs).await?; - Ok(()) - })) - .await?; - Ok(()) + self.blocks + .read_to_vec(c.hash()) + .await? + .map(|v| Block::new(*c, v).and_then(WithBlock::try_from)) + .transpose() } } #[rocket::async_trait] -impl CapStore for Store { +impl CapStore for Store +where + B: ImmutableStore, + B::Error: 'static, +{ async fn get_cap(&self, c: &Cid) -> Result> { // annoyingly ipfs will error if it cant find something, so we probably dont want to error here - Ok(self.get_obj(c).await.ok().map(|d| d.base)) + self.get_obj(c).await.map(|o| o.map(|d| d.base)) } } @@ -616,7 +495,7 @@ mod test { // use crate::ipfs::create_ipfs; // use ipfs::Keypair; // async fn get_store(id: &OrbitId) -> Store { - // let tmp = tempdir::TempDir::new("test_streams").unwrap(); + // let tmp = tempfile::TempDir::new("test_streams").unwrap(); // let kp = Keypair::generate_ed25519(); // let (ipfs, ipfs_task, receiver) = create_ipfs(id.to_string(), &tmp.path(), kp, []) // .await diff --git a/src/cas.rs b/src/cas.rs index 6d86d627..437be14d 100644 --- a/src/cas.rs +++ b/src/cas.rs @@ -1,4 +1,3 @@ -use super::codec::SupportedCodecs; use anyhow::Result; use kepler_lib::libipld::cid::Cid; use rocket::{ @@ -30,12 +29,3 @@ impl<'r> FromFormField<'r> for CidWrap { )) } } - -#[rocket::async_trait] -pub trait ContentAddressedStorage: Send + Sync { - type Error; - async fn put(&self, content: &[u8], codec: SupportedCodecs) -> Result; - async fn get(&self, address: &Cid) -> Result>, Self::Error>; - async fn delete(&self, address: &Cid) -> Result<(), Self::Error>; - async fn list(&self) -> Result, Self::Error>; -} diff --git a/src/codec.rs b/src/codec.rs deleted file mode 100644 index 6addb25a..00000000 --- a/src/codec.rs +++ /dev/null @@ -1,55 +0,0 @@ -use rocket::{ - data::{Capped, ToByteUnit}, - form::{DataField, FromFormField, Result}, - http::ContentType, - request::{FromRequest, Outcome, Request}, -}; - -#[derive(Clone, Copy, Debug)] -pub enum SupportedCodecs { - Raw = 0x55, - Json = 0x0200, - MsgPack = 0x0201, - Cbor = 0x51, -} - -#[derive(Debug)] -pub struct PutContent { - pub codec: SupportedCodecs, - // TODO dont use a Vec, but passing the datastream results in a hang - pub content: Capped>, -} - -impl From<&ContentType> for SupportedCodecs { - fn from(c: &ContentType) -> Self { - if c.is_json() { - Self::Json - } else if c.is_msgpack() { - Self::MsgPack - } else { - Self::Raw - } - } -} - -#[rocket::async_trait] -impl<'r> FromRequest<'r> for SupportedCodecs { - type Error = anyhow::Error; - - async fn from_request(req: &'r Request<'_>) -> Outcome { - Outcome::Success(match req.content_type() { - Some(t) => Self::from(t), - None => Self::Raw, - }) - } -} - -#[rocket::async_trait] -impl<'r> FromFormField<'r> for PutContent { - async fn from_data(field: DataField<'r, '_>) -> Result<'r, Self> { - Ok(PutContent { - codec: (&field.content_type).into(), - content: field.data.open(1u8.megabytes()).into_bytes().await?, - }) - } -} diff --git a/src/config.rs b/src/config.rs index 2e8d6863..bc88bb08 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,11 @@ -use crate::allow_list::OrbitAllowListService; +use crate::{ + allow_list::OrbitAllowListService, + storage::{file_system::FileSystemConfig, s3::S3BlockConfig}, + BlockConfig, +}; use rocket::http::hyper::Uri; use serde::{Deserialize, Serialize}; -use serde_with::{serde_as, DisplayFromStr}; +use serde_with::{serde_as, DisplayFromStr, FromInto}; use std::path::PathBuf; #[derive(Serialize, Deserialize, Debug, Default, Clone, Hash, PartialEq, Eq)] @@ -37,32 +41,19 @@ pub struct OrbitsConfig { pub allowlist: Option, } +#[serde_as] #[derive(Serialize, Deserialize, Debug, Default, Clone, Hash, PartialEq, Eq)] pub struct Storage { - pub blocks: BlockStorage, + #[serde_as(as = "FromInto")] + pub blocks: BlockConfig, pub indexes: IndexStorage, } #[derive(Serialize, Deserialize, Debug, Clone, Hash, PartialEq, Eq)] #[serde(tag = "type")] pub enum BlockStorage { - Local(LocalBlockStorage), - S3(S3BlockStorage), -} - -#[derive(Serialize, Deserialize, Debug, Clone, Hash, PartialEq, Eq)] -pub struct LocalBlockStorage { - pub path: PathBuf, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, Clone, Hash, PartialEq, Eq)] -pub struct S3BlockStorage { - pub bucket: String, - #[serde_as(as = "Option")] - #[serde(default)] - pub endpoint: Option, - pub dynamodb: DynamoStorage, + Local(FileSystemConfig), + S3(S3BlockConfig), } #[derive(Serialize, Deserialize, Debug, Clone, Hash, PartialEq, Eq)] @@ -114,15 +105,7 @@ impl Default for LoggingFormat { impl Default for BlockStorage { fn default() -> BlockStorage { - BlockStorage::Local(LocalBlockStorage::default()) - } -} - -impl Default for LocalBlockStorage { - fn default() -> LocalBlockStorage { - LocalBlockStorage { - path: PathBuf::from(r"/tmp/kepler/blocks"), - } + BlockStorage::Local(FileSystemConfig::default()) } } diff --git a/src/ipfs.rs b/src/ipfs.rs deleted file mode 100644 index d643f012..00000000 --- a/src/ipfs.rs +++ /dev/null @@ -1,113 +0,0 @@ -use anyhow::Result; -use ipfs::{ - multiaddr, - p2p::{transport::TransportBuilder, TSwarm}, - Ipfs as OIpfs, IpfsOptions, Keypair, PeerId, PinMode, Types, UninitializedIpfs, -}; -use kepler_lib::libipld::{ - block::Block as OBlock, - cid::{multibase::Base, Cid}, - multihash::Code, - raw::RawCodec, - store::DefaultParams, -}; -use libp2p::{core::transport::MemoryTransport, futures::TryStreamExt}; -use std::{future::Future, sync::mpsc::Receiver}; - -use super::{cas::ContentAddressedStorage, codec::SupportedCodecs}; -use crate::{ - config, - kv::behaviour::{Behaviour, Event as BehaviourEvent}, - storage::{Repo, StorageUtils}, -}; - -pub type KeplerParams = DefaultParams; -// #[derive(Clone, Debug, Default)] -// pub struct KeplerParams; - -// impl StoreParams for KeplerParams { -// const MAX_BLOCK_SIZE: usize = 10_485_760; -// type Codecs = IpldCodec; -// type Hashes = Code; -// } - -pub type Ipfs = OIpfs; -pub type Block = OBlock; -pub type Swarm = TSwarm; - -pub async fn create_ipfs( - orbit: Cid, - config: &config::Config, - keypair: Keypair, - allowed_peers: I, -) -> Result<(Ipfs, impl Future, Receiver)> -where - I: IntoIterator + 'static, -{ - let storage_utils = StorageUtils::new(config.storage.blocks.clone()); - - let ipfs_opts = IpfsOptions { - ipfs_path: storage_utils.ipfs_path(orbit).await?, - keypair, - bootstrap: vec![], - mdns: false, - kad_protocol: Some(format!( - "/kepler/{}", - orbit.to_string_of_base(Base::Base58Btc)? - )), - listening_addrs: vec![multiaddr!(P2pCircuit)], - span: None, - }; - - let (sender, receiver) = std::sync::mpsc::sync_channel::(100); - let behaviour = Behaviour::new(sender); - - let (transport_builder, relay_behaviour) = TransportBuilder::new(ipfs_opts.keypair.clone())? - .or(MemoryTransport::default()) - .relay(); - - let transport = transport_builder - .map_auth() - .map(crate::transport::auth_mapper(allowed_peers)) - .build(); - - let (ipfs, ipfs_task) = - UninitializedIpfs::::new(ipfs_opts, transport, Some(relay_behaviour)) - .with_extended_behaviour(behaviour) - .start() - .await?; - - Ok((ipfs, ipfs_task, receiver)) -} - -#[rocket::async_trait] -impl ContentAddressedStorage for Ipfs { - type Error = anyhow::Error; - async fn put(&self, content: &[u8], _codec: SupportedCodecs) -> Result { - // TODO find a way to stream this better? (use .take with max block size?) - let block: Block = Block::encode(RawCodec, Code::Blake3_256, content)?; - let cid = self.put_block(block).await?; - self.insert_pin(&cid, true).await?; - Ok(cid) - } - async fn get(&self, address: &Cid) -> Result>, Self::Error> { - // TODO this api returns Result, with an err thrown for no block found - // until this API changes (a breaking change), we will error here when no block found - Ok(Some(self.get_block(address).await?.data().to_vec())) - } - - async fn delete(&self, address: &Cid) -> Result<(), Self::Error> { - // TODO: does not recursively remove blocks, some cleanup will need to happen. - self.remove_pin(address, true).await?; - self.remove_block(*address).await?; - Ok(()) - } - async fn list(&self) -> Result, Self::Error> { - // return a list of all CIDs which are aliased/pinned - self.list_pins(Some(PinMode::Recursive)) - .await - .map_ok(|(cid, _pin_mode)| cid) - .try_collect() - .await - } -} diff --git a/src/kv/behaviour.rs b/src/kv/behaviour.rs deleted file mode 100644 index 676acad9..00000000 --- a/src/kv/behaviour.rs +++ /dev/null @@ -1,117 +0,0 @@ -use std::{ - sync::{ - mpsc::{Receiver, SyncSender}, - Arc, - }, - task::{Context, Poll}, -}; - -use ipfs::{Multiaddr, PeerId}; -use libp2p::{ - core::{connection::ConnectionId, ConnectedPoint}, - swarm::{ - handler::DummyConnectionHandler, IntoConnectionHandler, NetworkBehaviour, - NetworkBehaviourAction, PollParameters, - }, -}; -use void::Void; - -use crate::orbit::AbortOnDrop; - -use super::Store; - -#[derive(Clone, Debug)] -pub struct Behaviour { - sender: SyncSender, -} - -impl Behaviour { - pub fn new(sender: SyncSender) -> Self { - Self { sender } - } -} - -impl NetworkBehaviour for Behaviour { - type ConnectionHandler = DummyConnectionHandler; - - type OutEvent = (); - - fn new_handler(&mut self) -> Self::ConnectionHandler { - DummyConnectionHandler::default() - } - - fn inject_event(&mut self, _peer_id: PeerId, _connection: ConnectionId, _event: Void) {} - - fn poll( - &mut self, - _cx: &mut Context<'_>, - _params: &mut impl PollParameters, - ) -> Poll> { - Poll::Pending - } - - fn inject_connection_established( - &mut self, - peer_id: &PeerId, - _connection: &ConnectionId, - _endpoint: &ConnectedPoint, - _failed_addresses: Option<&Vec>, - _other_established: usize, - ) { - if let Err(_e) = self.sender.send(Event::ConnectionEstablished(*peer_id)) { - tracing::error!("Behaviour process has shutdown.") - } - } - - fn inject_connection_closed( - &mut self, - peer_id: &PeerId, - _connection: &ConnectionId, - _endpoint: &ConnectedPoint, - _handler: ::Handler, - _remaining_established: usize, - ) { - if let Err(_e) = self.sender.send(Event::ConnectionTerminated(*peer_id)) { - tracing::error!("Behaviour process has shutdown.") - } - } -} - -#[derive(Clone, Debug)] -pub struct BehaviourProcess(Arc>); - -impl BehaviourProcess { - pub fn new(store: Store, mut receiver: Receiver) -> Self { - Self(Arc::new(AbortOnDrop::new(tokio::spawn(async move { - while let Ok(Ok((event, returned_receiver))) = - tokio::task::spawn_blocking(move || receiver.recv().map(|ev| (ev, receiver))).await - { - receiver = returned_receiver; - match event { - Event::ConnectionEstablished(peer_id) => { - if let Err(e) = store.ipfs.pubsub_add_peer(peer_id).await { - tracing::error!("failed to add new peer to allowed pubsub peers: {}", e) - } - if let Err(e) = store.request_heads().await { - tracing::error!("failed to request heads from peers: {}", e) - } - } - Event::ConnectionTerminated(peer_id) => { - if let Err(e) = store.ipfs.pubsub_remove_peer(peer_id).await { - tracing::error!( - "failed to remove disconnected peer from allowed pubsub peers: {}", - e - ) - } - } - } - } - })))) - } -} - -#[derive(Clone, Debug)] -pub enum Event { - ConnectionEstablished(PeerId), - ConnectionTerminated(PeerId), -} diff --git a/src/kv/entries.rs b/src/kv/entries.rs index 467f3285..6b8583eb 100644 --- a/src/kv/entries.rs +++ b/src/kv/entries.rs @@ -1,77 +1,8 @@ -use super::{to_block, to_block_raw}; -use crate::ipfs::{Block, Ipfs, KeplerParams}; +use super::to_block; +use crate::Block; use anyhow::Result; -use kepler_lib::libipld::{cid::Cid, store::StoreParams, DagCbor}; -use libp2p::futures::stream::BoxStream; -use std::{ - collections::BTreeMap, - io::{self, Cursor, ErrorKind, Write}, -}; - -use rocket::futures::{StreamExt, TryStreamExt}; -use rocket::tokio::io::AsyncRead; -use tokio_stream::iter; -use tokio_util::io::{ReaderStream, StreamReader}; - -pub type ObjectReader = - StreamReader, io::Error>>, Cursor>; - -pub fn read_from_store(ipfs: Ipfs, content: Vec<(Cid, u32)>) -> ObjectReader { - let chunk_stream = Box::pin( - iter(content) - .then(move |(cid, _)| get_block(ipfs.clone(), cid)) - .map_ok(Cursor::new) - .map_err(|ipfs_err| io::Error::new(ErrorKind::Other, ipfs_err)), - ); - StreamReader::new(chunk_stream) -} - -async fn get_block(ipfs: Ipfs, cid: Cid) -> Result { - ipfs.get_block(&cid).await -} - -pub async fn write_to_store(store: &Ipfs, source: R) -> anyhow::Result -where - R: AsyncRead + Unpin, -{ - let mut reader = ReaderStream::new(source); - let mut buffer: Vec = Vec::new(); - let mut content: Vec<(Cid, u32)> = Vec::new(); - while let Some(chunk) = reader.next().await.transpose()? { - buffer.write_all(&chunk)?; - while buffer.len() >= KeplerParams::MAX_BLOCK_SIZE { - flush_buffer_to_block(store, &mut buffer, &mut content).await?; - } - } - while !buffer.is_empty() { - flush_buffer_to_block(store, &mut buffer, &mut content).await?; - } - let block = to_block(&content)?; - let cid = store.put_block(block).await?; - Ok(cid) -} - -async fn flush_buffer_to_block( - store: &Ipfs, - buffer: &mut Vec, - content: &mut Vec<(Cid, u32)>, -) -> Result<(), io::Error> { - let len = KeplerParams::MAX_BLOCK_SIZE.min(buffer.len()); - if len > 0 { - let (block_data, overflow) = buffer.split_at(len); - let block = - to_block_raw(&block_data).map_err(|e| io::Error::new(ErrorKind::InvalidData, e))?; - *buffer = overflow.to_vec(); - tracing::debug!("flushing {} bytes to block {}", len, block.cid()); - let cid = store - .put_block(block) - .await - .map_err(|e| io::Error::new(ErrorKind::Other, e))?; - tracing::debug!("block {} flushed {} bytes with {}", content.len(), len, cid); - content.push((cid, len as u32)); - } - Ok(()) -} +use kepler_lib::libipld::{cid::Cid, DagCbor}; +use std::collections::BTreeMap; #[derive(DagCbor, PartialEq, Eq, Debug, Clone)] pub struct Object { @@ -127,36 +58,35 @@ impl ObjectBuilder { #[cfg(test)] mod test { - use ipfs::IpfsOptions; - use super::*; - use crate::{config, kv::DagCborCodec, tracing::tracing_try_init}; + // use super::*; + // use crate::{config, kv::DagCborCodec, tracing::tracing_try_init}; - #[tokio::test(flavor = "multi_thread")] - async fn write() -> Result<(), anyhow::Error> { - tracing_try_init(&config::Logging::default()); - let tmp = tempdir::TempDir::new("test_streams")?; - let data = vec![3u8; KeplerParams::MAX_BLOCK_SIZE * 3]; + // #[tokio::test(flavor = "multi_thread")] + // async fn write() -> Result<(), anyhow::Error> { + // tracing_try_init(&config::Logging::default()); + // let tmp = tempfile::TempDir::new("test_streams")?; + // let data = vec![3u8; 1000000000 * 3]; - let mut config = IpfsOptions::inmemory_with_generated_keys(); - config.ipfs_path = tmp.path().into(); + // let mut config = IpfsOptions::inmemory_with_generated_keys(); + // config.ipfs_path = tmp.path().into(); - let (ipfs, task) = config.create_uninitialised_ipfs()?.start().await?; - let _join_handle = tokio::spawn(task); + // let (ipfs, task) = config.create_uninitialised_ipfs()?.start().await?; + // let _join_handle = tokio::spawn(task); - let o = write_to_store(&ipfs, Cursor::new(data.clone())).await?; + // let o = write_to_store(&ipfs, Cursor::new(data.clone())).await?; - let content = ipfs - .get_block(&o) - .await? - .decode::>()?; + // let content = ipfs + // .get_block(&o) + // .await? + // .decode::>()?; - let mut read = read_from_store(ipfs, content); + // let mut read = read_from_store(ipfs, content); - let mut out = Vec::new(); - tokio::io::copy(&mut read, &mut out).await?; + // let mut out = Vec::new(); + // tokio::io::copy(&mut read, &mut out).await?; - assert_eq!(out.len(), data.len()); - Ok(()) - } + // assert_eq!(out.len(), data.len()); + // Ok(()) + // } } diff --git a/src/kv/mod.rs b/src/kv/mod.rs index b10899c8..2fd87001 100644 --- a/src/kv/mod.rs +++ b/src/kv/mod.rs @@ -1,58 +1,34 @@ use anyhow::Result; -use ipfs::PeerId; use kepler_lib::libipld::{ cbor::DagCborCodec, cid::Cid, codec::Encode, multihash::Code, raw::RawCodec, }; -use rocket::futures::{Stream, StreamExt}; use serde::{Deserialize, Serialize}; -use std::sync::Arc; -pub mod behaviour; mod entries; mod store; -use super::{ - ipfs::{Block, Ipfs}, - orbit::AbortOnDrop, -}; - -pub use entries::{Object, ObjectBuilder, ObjectReader}; -pub use store::Store; +use super::Block; -type TaskHandle = AbortOnDrop<()>; +pub use entries::{Object, ObjectBuilder}; +pub use store::{ReadResponse, Store}; #[derive(Clone)] -pub struct Service { - pub store: Store, - _task: Arc, +pub struct Service { + pub store: Store, } -impl Service { - fn new(store: Store, task: TaskHandle) -> Self { - Self { - store, - _task: Arc::new(task), - } +impl Service { + fn new(store: Store) -> Self { + Self { store } } - pub async fn start(store: Store) -> Result { - let events = store - .ipfs - .pubsub_subscribe(store.id.clone()) - .await? - .map(|msg| match bincode::deserialize(&msg.data) { - Ok(kv_msg) => Ok((msg.source, kv_msg)), - Err(e) => Err(anyhow!(e)), - }); - let peer_id = store.ipfs.identity().await?.0.to_peer_id(); - let task = AbortOnDrop::new(tokio::spawn(kv_task(events, store.clone(), peer_id))); - store.request_heads().await?; - Ok(Service::new(store, task)) + pub async fn start(store: Store) -> Result { + Ok(Self::new(store)) } } -impl std::ops::Deref for Service { - type Target = Store; +impl std::ops::Deref for Service { + type Target = Store; fn deref(&self) -> &Self::Target { &self.store } @@ -97,229 +73,3 @@ enum KVMessage { Heads(#[serde(with = "vec_cid_bin")] Vec), StateReq, } - -async fn kv_task( - events: impl Stream> + Send, - store: Store, - peer_id: PeerId, -) { - debug!("starting KV task"); - events - .for_each_concurrent(None, |ev| async { - match ev { - Ok((p, ev)) if p == peer_id => { - debug!("{} filtered out this event from self: {:?}", p, ev) - } - Ok((p, KVMessage::Heads(heads))) => { - debug!("{} received new heads from {}", peer_id, p); - // sync heads - if let Err(e) = store.try_merge_heads(heads.into_iter()).await { - error!("failed to merge heads {}", e); - }; - } - Ok((p, KVMessage::StateReq)) => { - debug!("{} requests state", p); - // send heads - if let Err(e) = store.broadcast_heads().await { - error!("failed to broadcast heads {}", e); - }; - } - Err(e) => { - error!("{}", e); - } - } - }) - .await; -} - -#[cfg(test)] -mod test { - use ipfs::{Keypair, MultiaddrWithoutPeerId, Protocol}; - - use super::*; - use crate::{config, ipfs::create_ipfs, relay::test::test_relay}; - use std::{ - collections::BTreeMap, convert::TryFrom, path::PathBuf, str::FromStr, time::Duration, - }; - - async fn create_store( - id: &Cid, - path: PathBuf, - keypair: Keypair, - allowed_peers: I, - ) -> Result<(Store, behaviour::BehaviourProcess), anyhow::Error> - where - I: IntoIterator + 'static, - { - std::fs::create_dir(path.clone())?; - let config = config::Config { - storage: config::Storage { - blocks: config::BlockStorage::Local(config::LocalBlockStorage { - path: path.clone(), - }), - indexes: config::IndexStorage::Local(config::LocalIndexStorage { - path: path.clone(), - }), - }, - ..Default::default() - }; - let (ipfs, ipfs_task, receiver) = create_ipfs(*id, &config, keypair, allowed_peers).await?; - tokio::spawn(ipfs_task); - let store = Store::new(*id, ipfs, config.storage.indexes).await?; - Ok(( - store.clone(), - behaviour::BehaviourProcess::new(store, receiver), - )) - } - - #[tokio::test(flavor = "multi_thread")] - async fn test() -> Result<(), anyhow::Error> { - let relay = test_relay().await?; - let relay_peer_id = relay.id.clone(); - let relay_internal = relay.internal(); - - let tmp = tempdir::TempDir::new("test_streams")?; - let id = - Cid::from_str("bafkreieq5jui4j25lacwomsqgjeswwl3y5zcdrresptwgmfylxo2depppq").unwrap(); - - let alice_keypair = Keypair::generate_ed25519(); - let alice_peer_id = alice_keypair.public().to_peer_id(); - let bob_keypair = Keypair::generate_ed25519(); - let bob_peer_id = bob_keypair.public().to_peer_id(); - - let (alice_store, _alice_behaviour_process) = - create_store(&id, tmp.path().join("alice"), alice_keypair, [bob_peer_id]).await?; - let (bob_store, _bob_behaviour_process) = - create_store(&id, tmp.path().join("bob"), bob_keypair, [bob_peer_id]).await?; - - let alice_service = alice_store.start_service().await?; - let bob_service = bob_store.start_service().await?; - - // Connect the peers to the relay. - alice_service - .ipfs - .connect( - MultiaddrWithoutPeerId::try_from(relay_internal.clone())? - .with(relay_peer_id.clone()), - ) - .await - .expect("alice failed to connect to relay"); - bob_service - .ipfs - .connect( - MultiaddrWithoutPeerId::try_from(relay_internal.clone())? - .with(relay_peer_id.clone()), - ) - .await - .expect("bob failed to connect to relay"); - - // Connect the peers to eachother. - bob_service - .ipfs - .connect( - MultiaddrWithoutPeerId::try_from( - relay - .external() - .with(Protocol::P2p(relay_peer_id.into())) - .with(Protocol::P2pCircuit), - )? - .with(alice_peer_id.clone()), - ) - .await - .expect("bob failed to connect to alice"); - - // TODO: Work out why there is a race condition, and fix it so we don't need this sleep between connecting and writing. - tokio::time::sleep(Duration::from_millis(50)).await; - - let json = r#"{"hello":"there"}"#; - let key1 = "my_json.json"; - let key2 = "my_dup_json.json"; - let md: BTreeMap = - [("content-type".to_string(), "application/json".to_string())] - .to_vec() - .into_iter() - .collect(); - let dab = to_block(&id).unwrap(); - let dummy_auth = *dab.cid(); - alice_service.ipfs.put_block(dab).await?; - - let kv_obj_1 = ObjectBuilder::new(key1.as_bytes().to_vec(), md.clone(), dummy_auth.clone()); - let kv_obj_2 = ObjectBuilder::new(key2.as_bytes().to_vec(), md.clone(), dummy_auth.clone()); - - type RmItem = (Vec, Option<(u64, Cid)>, Cid); - let rm: Vec = vec![]; - alice_service - .write(vec![(kv_obj_1, json.as_bytes())], rm.clone()) - .await?; - bob_service - .write(vec![(kv_obj_2, json.as_bytes())], rm) - .await?; - - { - // ensure only alice has kv_obj_1 - let o = alice_service - .get(key1) - .await? - .expect("object 1 not found for alice"); - assert_eq!(&o.key, key1.as_bytes()); - assert_eq!(&o.metadata, &md); - assert_eq!(bob_service.get(key1).await?, None, "object 1 found for bob"); - }; - { - // ensure only bob has kv_obj_2 - let o = bob_service - .get(key2) - .await? - .expect("object 2 not found for bob"); - assert_eq!(&o.key, key2.as_bytes()); - assert_eq!(&o.metadata, &md); - assert_eq!( - alice_service.get(key2).await?, - None, - "object 2 found for alice" - ); - }; - - tokio::time::sleep(Duration::from_millis(500)).await; - - assert_eq!( - bob_service - .get(key1) - .await? - .expect("object 1 not found for bob"), - alice_service - .get(key1) - .await? - .expect("object 1 not found for alice") - ); - - assert_eq!( - bob_service - .get(key2) - .await? - .expect("object 2 not found for bob"), - alice_service - .get(key2) - .await? - .expect("object 2 not found for alice") - ); - - // remove key1 - let add: Vec<(&[u8], Cid)> = vec![]; - alice_service - .index(add, vec![(key1.as_bytes().to_vec(), None, dummy_auth)]) - .await?; - - assert_eq!( - alice_service.get(key1).await?, - None, - "alice still has object 1" - ); - - std::thread::sleep(Duration::from_millis(500)); - - assert_eq!(bob_service.get(key1).await?, None, "bob still has object 1"); - - Ok(()) - } -} diff --git a/src/kv/store.rs b/src/kv/store.rs index 834eb58e..953bc52d 100644 --- a/src/kv/store.rs +++ b/src/kv/store.rs @@ -1,15 +1,17 @@ use crate::indexes::{AddRemoveSetStore, HeadStore}; -use crate::kv::entries::{read_from_store, write_to_store}; use crate::kv::{Object, ObjectBuilder, Service}; +use crate::storage::ImmutableStore; use anyhow::Result; -use async_recursion::async_recursion; -use futures::stream::{self, StreamExt, TryStreamExt}; -use kepler_lib::libipld::{cbor::DagCborCodec, cid::Cid, multibase::Base, DagCbor}; -use rocket::{futures::future::try_join_all, tokio::io::AsyncRead}; +use futures::{ + io::AsyncRead, + stream::{self, StreamExt, TryStreamExt}, +}; +use kepler_lib::libipld::{cid::Cid, multibase::Base, multihash::Code, DagCbor}; +use rocket::futures::future::try_join_all; use std::{collections::BTreeMap, convert::TryFrom}; -use tracing::{debug, instrument}; +use tracing::instrument; -use super::{to_block, Block, Ipfs, KVMessage, ObjectReader}; +use super::{to_block, Block}; use crate::config; #[derive(DagCbor)] @@ -98,21 +100,21 @@ impl Element { } #[derive(Clone)] -pub struct Store { +pub struct Store { pub id: String, - pub ipfs: Ipfs, + blocks: B, index: AddRemoveSetStore, heads: HeadStore, } -impl Store { - pub async fn new(orbit_id: Cid, ipfs: Ipfs, config: config::IndexStorage) -> Result { +impl Store { + pub async fn new(orbit_id: Cid, blocks: B, config: config::IndexStorage) -> Result { let index = AddRemoveSetStore::new(orbit_id, "kv".to_string(), config.clone()).await?; // heads tracking store let heads = HeadStore::new(orbit_id, "kv".to_string(), "heads".to_string(), config).await?; Ok(Self { id: orbit_id.to_string_of_base(Base::Base58Btc)?, - ipfs, + blocks, index, heads, }) @@ -145,27 +147,39 @@ impl Store { .await .into_iter() } +} + +pub struct ReadResponse(pub BTreeMap, pub R); +impl Store +where + B: ImmutableStore + 'static, +{ #[instrument(name = "kv::get", skip_all)] - pub async fn get>(&self, name: N) -> Result> { - let key = name; - match self.index.element(&key).await? { - Some(Element(_, cid)) => Ok( - match self - .index - .is_tombstoned(&Version(key, cid).to_bytes()) + pub async fn get(&self, name: N) -> Result> + where + N: AsRef<[u8]>, + { + match self.index.element(&name).await? { + Some(Element(_, cid)) => match self + .index + .is_tombstoned(&Version(name, cid).to_bytes()) + .await? + { + false => self + .blocks + .read_to_vec(cid.hash()) .await? - { - false => Some(self.ipfs.get_block(&cid).await?.decode()?), - _ => None, - }, - ), + .map(|v| Block::new(cid, v)?.decode()) + .transpose(), + _ => Ok(None), + }, None => Ok(None), } } #[instrument(name = "kv::read", skip_all)] - pub async fn read(&self, key: N) -> Result, ObjectReader)>> + pub async fn read(&self, key: N) -> Result>> where N: AsRef<[u8]>, { @@ -173,46 +187,36 @@ impl Store { Ok(Some(content)) => content, _ => return Ok(None), }; - match self - .ipfs - .get_block(&kv_obj.value) - .await? - .decode::>() - { - Ok(content) => Ok(Some(( - kv_obj.metadata, - read_from_store(self.ipfs.clone(), content), - ))), - Err(_) => Ok(None), + match self.blocks.read(kv_obj.value.hash()).await? { + Some(r) => Ok(Some(ReadResponse(kv_obj.metadata, r))), + None => Err(anyhow!("Indexed contents missing from block store")), } } - #[instrument(name = "kv::request_heads", skip_all)] - pub(crate) async fn request_heads(&self) -> Result<()> { - debug!("requesting heads"); - self.ipfs - .pubsub_publish(self.id.clone(), bincode::serialize(&KVMessage::StateReq)?) - .await?; - Ok(()) - } - #[instrument(name = "kv::write", skip_all)] pub async fn write( &self, add: impl IntoIterator, remove: impl IntoIterator, Cid)>, + // TODO return list of new heads to be broadcast? ) -> Result<()> where N: AsRef<[u8]>, - R: AsyncRead + Unpin, + R: AsyncRead + Send, { tracing::debug!("writing tx"); let indexes: Vec<(Vec, Cid)> = try_join_all(add.into_iter().map(|(o, r)| async { // tracing::debug!("adding {:#?}", &o.key); - let cid = write_to_store(&self.ipfs, r).await?; + // store aaalllllll the content bytes under 1 CID + let cid = Cid::new_v1(0x55, self.blocks.write(r, Code::Blake3_256).await?); let obj = o.add_content(cid); let block = obj.to_block()?; - let obj_cid = self.ipfs.put_block(block).await?; + let obj_cid = Cid::new_v1( + block.cid().codec(), + self.blocks + .write(block.data(), block.cid().hash().code().try_into()?) + .await?, + ); Ok((obj.key, obj_cid)) as Result<(Vec, Cid)> })) .await? @@ -265,28 +269,6 @@ impl Store { // apply/pin root/update heads self.apply(&(block, delta), adds.0, rmvs.0).await?; - // broadcast - self.broadcast_heads().await?; - Ok(()) - } - - #[instrument(name = "kv::broadcast_heads", skip_all)] - pub(crate) async fn broadcast_heads(&self) -> Result<()> { - let (heads, height) = self.heads.get_heads().await?; - if !heads.is_empty() { - debug!( - "broadcasting {} heads at maxheight {} on {}", - heads.len(), - height, - self.id, - ); - self.ipfs - .pubsub_publish( - self.id.clone(), - bincode::serialize(&KVMessage::Heads(heads))?, - ) - .await?; - } Ok(()) } @@ -345,64 +327,13 @@ impl Store { self.heads .new_heads([*block.cid()], delta.prev.clone()) .await?; - self.ipfs.put_block(block.clone()).await?; - - Ok(()) - } - - #[async_recursion] - pub(crate) async fn try_merge_heads( - &self, - heads: impl Iterator + Send + 'async_recursion, - ) -> Result<()> { - try_join_all(heads.map(|head| async move { - // fetch head block check block is an event - let delta_block = self.ipfs.get_block(&head).await?; - let delta: LinkedDelta = delta_block.decode()?; - - // recurse through unseen prevs first - self.try_merge_heads( - stream::iter(delta.prev.iter().map(Ok).collect::>>()) - .try_filter_map(|p| async move { - self.heads.get_height(p).await.map(|o| match o { - Some(_) => None, - None => Some(p), - }) - }) - .try_collect::>() - .await? - .into_iter(), - ) + self.blocks + .write(block.data(), block.cid().hash().code().try_into()?) .await?; - let adds: Vec<(Vec, Cid)> = - try_join_all(delta.delta.add.iter().map(|c| async move { - let obj: Object = self.ipfs.get_block(c).await?.decode()?; - Ok((obj.key, *c)) as Result<(Vec, Cid)> - })) - .await?; - - let removes: Vec<(Vec, Cid)> = - try_join_all(delta.delta.rmv.iter().map(|c| async move { - let obj: Object = self.ipfs.get_block(&c.0).await?.decode()?; - Ok((obj.key, c.0)) as Result<(Vec, Cid)> - })) - .await?; - - // TODO verify authz stuff - - self.apply(&(delta_block, delta), adds, removes).await?; - - // dispatch ipfs::sync - debug!("syncing head {}", head); - - self.ipfs.insert_pin(&head, true).await?; - Ok(()) as Result<()> - })) - .await?; Ok(()) } - pub async fn start_service(self) -> Result { + pub async fn start_service(self) -> Result> { Service::start(self).await } } diff --git a/src/lib.rs b/src/lib.rs index 650ed9e7..b3111160 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,6 +7,7 @@ extern crate anyhow; extern crate tokio; use anyhow::Result; +use kepler_lib::libipld::{block::Block as OBlock, store::DefaultParams}; use rocket::{fairing::AdHoc, figment::Figment, http::Header, Build, Rocket}; pub mod allow_list; @@ -14,40 +15,85 @@ pub mod auth_guards; pub mod authorization; pub mod capabilities; pub mod cas; -pub mod codec; pub mod config; pub mod indexes; -pub mod ipfs; pub mod kv; pub mod manifest; pub mod orbit; +pub mod p2p; pub mod prometheus; -pub mod relay; pub mod routes; pub mod storage; mod tracing; pub mod transport; +use config::{BlockStorage, Config}; use libp2p::{ + core::multiaddr::multiaddr, identity::{ed25519::Keypair as Ed25519Keypair, Keypair}, PeerId, }; -use relay::RelayNode; +use orbit::ProviderUtils; +use p2p::{ + relay::Config as RelayConfig, + transport::{Both, DnsConfig, MemoryConfig, TcpConfig, WsConfig}, +}; use routes::{delegate, invoke, open_host_key, relay_addr, util_routes::*}; use std::{collections::HashMap, sync::RwLock}; +use storage::{ + either::Either, + file_system::{FileSystemConfig, FileSystemStore}, + s3::{S3BlockConfig, S3BlockStore}, +}; + +pub type Block = OBlock; +pub type BlockStores = Either; +pub type BlockConfig = Either; + +impl Default for BlockConfig { + fn default() -> Self { + Self::B(FileSystemConfig::default()) + } +} + +impl From for BlockConfig { + fn from(c: BlockStorage) -> Self { + match c { + BlockStorage::S3(s) => Self::A(s), + BlockStorage::Local(l) => Self::B(l), + } + } +} + +impl From for BlockStorage { + fn from(c: BlockConfig) -> Self { + match c { + BlockConfig::A(a) => Self::S3(a), + BlockConfig::B(b) => Self::Local(b), + } + } +} pub async fn app(config: &Figment) -> Result> { - let kepler_config = config.extract::()?; + let kepler_config: Config = config.extract::()?; tracing::tracing_try_init(&kepler_config.log); storage::KV::healthcheck(kepler_config.storage.indexes.clone()).await?; - storage::StorageUtils::new(kepler_config.storage.blocks.clone()) - .healthcheck() - .await?; + let kp = kepler_config.storage.blocks.relay_key_pair().await?; + + let mut relay_node = RelayConfig::default().launch( + Keypair::Ed25519(kp), + // transport for memory, dns + tcp and websocket over dns + tcp + Both::, WsConfig>>>::default(), + )?; - let kp = storage::StorageUtils::relay_key_pair(kepler_config.storage.blocks).await?; - let relay_node = RelayNode::new(kepler_config.relay.port, Keypair::Ed25519(kp)).await?; + relay_node + .listen_on([ + multiaddr!(Memory(kepler_config.relay.port)), + multiaddr!(Ip4([127, 0, 0, 1]), Tcp(kepler_config.relay.port)), + ]) + .await?; let routes = routes![ healthcheck, diff --git a/src/orbit.rs b/src/orbit.rs index 10e061bd..305c23ef 100644 --- a/src/orbit.rs +++ b/src/orbit.rs @@ -1,14 +1,13 @@ use crate::{ capabilities::{store::Store as CapStore, Service as CapService}, - cas::ContentAddressedStorage, - codec::SupportedCodecs, config, - ipfs::create_ipfs, - kv::{behaviour::BehaviourProcess, Service as KVService, Store}, + kv::{Service as KVService, Store}, manifest::Manifest, + storage::{ImmutableStore, StorageConfig}, + BlockConfig, BlockStores, }; use anyhow::{anyhow, Result}; -use ipfs::{MultiaddrWithPeerId, MultiaddrWithoutPeerId}; +use derive_builder::Builder; use kepler_lib::libipld::cid::{ multihash::{Code, MultihashDigest}, Cid, @@ -16,16 +15,13 @@ use kepler_lib::libipld::cid::{ use kepler_lib::resource::OrbitId; use libp2p::{ core::Multiaddr, - identity::{ed25519::Keypair as Ed25519Keypair, Keypair}, + identity::{ed25519::Keypair as Ed25519Keypair, PublicKey}, PeerId, }; -use rocket::{futures::TryStreamExt, tokio::task::JoinHandle}; +use rocket::tokio::task::JoinHandle; use cached::proc_macro::cached; -use std::{convert::TryFrom, ops::Deref, sync::Arc}; -use tokio::spawn; - -use super::storage::StorageUtils; +use std::{convert::TryFrom, error::Error as StdError, ops::Deref}; #[derive(Debug)] pub struct AbortOnDrop(JoinHandle); @@ -50,137 +46,151 @@ impl Deref for AbortOnDrop { } } -#[derive(Clone, Debug)] -struct OrbitTasks { - _ipfs: Arc>, - _behaviour_process: BehaviourProcess, -} - -impl OrbitTasks { - fn new(ipfs_future: JoinHandle<()>, behaviour_process: BehaviourProcess) -> Self { - let ipfs = Arc::new(AbortOnDrop::new(ipfs_future)); - Self { - _ipfs: ipfs, - _behaviour_process: behaviour_process, - } - } -} - #[derive(Clone)] -pub struct Orbit { - pub service: KVService, - _tasks: OrbitTasks, +pub struct Orbit { + pub service: KVService, pub manifest: Manifest, - pub capabilities: CapService, + pub capabilities: CapService, } -impl Orbit { - async fn new( - config: &config::Config, - kp: Ed25519Keypair, - manifest: Manifest, - relay: Option<(PeerId, Multiaddr)>, - ) -> anyhow::Result { - let id = manifest.id().get_cid(); - let local_peer_id = PeerId::from_public_key(&ipfs::PublicKey::Ed25519(kp.public())); - let (ipfs, ipfs_future, receiver) = create_ipfs( - id, - config, - Keypair::Ed25519(kp), - manifest - .bootstrap_peers() - .peers - .iter() - .map(|p| p.id) - .collect::>(), - ) - .await?; +#[derive(Clone, Debug, Builder)] +pub struct OrbitPeerConfig { + #[builder(setter(into))] + identity: Ed25519Keypair, + #[builder(setter(into))] + manifest: Manifest, + #[builder(setter(into, strip_option), default)] + relay: Option<(PeerId, Multiaddr)>, + #[builder(setter(into))] + blocks: B, + #[builder(setter(into))] + index: I, +} - let ipfs_task = spawn(ipfs_future); - if let Some(r) = relay { - ipfs.connect(MultiaddrWithoutPeerId::try_from(r.1)?.with(r.0)) - .await?; +impl Orbit +where + B: ImmutableStore + Clone, +{ + async fn open(config: &OrbitPeerConfig) -> anyhow::Result> + where + C: StorageConfig, + C::Error: 'static + Sync + Send, + B::Error: 'static, + { + let id = config.manifest.id().get_cid(); + let _local_peer_id = PeerId::from_public_key(&PublicKey::Ed25519(config.identity.public())); + let _relay = &config.relay; + + let blocks = match config.blocks.open(config.manifest.id()).await? { + Some(b) => b, + None => return Ok(None), }; - - let service_store = Store::new(id, ipfs.clone(), config.storage.indexes.clone()).await?; + let service_store = Store::new(id, blocks.clone(), config.index.clone()).await?; let service = KVService::start(service_store).await?; let cap_store = - CapStore::new(manifest.id(), ipfs.clone(), config.storage.indexes.clone()).await?; + CapStore::new(config.manifest.id(), blocks.clone(), config.index.clone()).await?; let capabilities = CapService::start(cap_store).await?; - let behaviour_process = BehaviourProcess::new(service.store.clone(), receiver); + Ok(Some(Orbit { + service, + manifest: config.manifest.clone(), + capabilities, + })) + } - let tasks = OrbitTasks::new(ipfs_task, behaviour_process); + async fn create(config: &OrbitPeerConfig) -> anyhow::Result + where + C: StorageConfig, + C::Error: 'static + Sync + Send, + B::Error: 'static, + { + let id = config.manifest.id().get_cid(); + let _local_peer_id = PeerId::from_public_key(&PublicKey::Ed25519(config.identity.public())); + let _relay = &config.relay; + + let blocks = config.blocks.create(config.manifest.id()).await?; + let service_store = Store::new(id, blocks.clone(), config.index.clone()).await?; + let service = KVService::start(service_store).await?; - tokio_stream::iter( - manifest - .bootstrap_peers() - .peers - .iter() - .filter(|p| p.id != local_peer_id) - .flat_map(|peer| { - peer.addrs - .clone() - .into_iter() - .zip(std::iter::repeat(peer.id)) - }) - .map(|(addr, peer_id)| Ok(MultiaddrWithoutPeerId::try_from(addr)?.with(peer_id))), - ) - .try_for_each(|multiaddr| ipfs.connect(multiaddr)) - .await?; + let cap_store = + CapStore::new(config.manifest.id(), blocks.clone(), config.index.clone()).await?; + let capabilities = CapService::start(cap_store).await?; Ok(Orbit { service, - manifest, - _tasks: tasks, + manifest: config.manifest.clone(), capabilities, }) } +} - pub async fn connect(&self, node: MultiaddrWithPeerId) -> anyhow::Result<()> { - self.service.store.ipfs.connect(node).await - } +#[async_trait] +pub trait ProviderUtils { + type Error: StdError; + async fn exists(&self, orbit: &OrbitId) -> Result; + async fn relay_key_pair(&self) -> Result; + async fn key_pair(&self, orbit: &OrbitId) -> Result, Self::Error>; + async fn setup_orbit(&self, orbit: &OrbitId, key: &Ed25519Keypair) -> Result<(), Self::Error>; } // Using Option to distinguish when the orbit already exists from a hard error pub async fn create_orbit( id: &OrbitId, - config: &config::Config, - auth: &[u8], + store_config: &BlockConfig, + index_config: &config::IndexStorage, relay: (PeerId, Multiaddr), kp: Ed25519Keypair, -) -> Result> { - let md = match Manifest::resolve_dyn(id, None).await? { - Some(m) => m, +) -> Result>> { + match Manifest::resolve_dyn(id, None).await? { + Some(_) => {} _ => return Ok(None), }; // fails if DIR exists, this is Create, not Open - let storage_utils = StorageUtils::new(config.storage.blocks.clone()); - if storage_utils.exists(id.get_cid()).await? { + if store_config.exists(id).await? { return Ok(None); } - storage_utils.setup_orbit(id.clone(), kp, auth).await?; + store_config.setup_orbit(id, &kp).await?; + + Orbit::create( + &OrbitPeerConfigBuilder::::default() + .manifest( + Manifest::resolve_dyn(id, None) + .await? + .ok_or_else(|| anyhow!("Orbit DID Document not resolvable"))?, + ) + .identity( + store_config + .key_pair(id) + .await? + .ok_or_else(|| anyhow!("Peer Identity key could not be found"))?, + ) + .blocks(store_config.clone()) + .index(index_config.clone()) + .relay(relay.clone()) + .build()?, + ) + .await?; Ok(Some( - load_orbit(md.id().get_cid(), config, relay) + load_orbit(id.clone(), store_config, index_config, relay) .await .map(|o| o.ok_or_else(|| anyhow!("Couldn't find newly created orbit")))??, )) } pub async fn load_orbit( - id_cid: Cid, - config: &config::Config, + orbit: OrbitId, + store_config: &BlockConfig, + index_config: &config::IndexStorage, relay: (PeerId, Multiaddr), -) -> Result> { - let storage_utils = StorageUtils::new(config.storage.blocks.clone()); - if !storage_utils.exists(id_cid).await? { +) -> Result>> { + if !store_config.exists(&orbit).await? { return Ok(None); } - load_orbit_inner(id_cid, config.clone(), relay) + load_orbit_inner(orbit, store_config.clone(), index_config.clone(), relay) .await .map(Some) } @@ -189,27 +199,32 @@ pub async fn load_orbit( // 100 orbits => 600 FDs #[cached(size = 100, result = true, sync_writes = true)] async fn load_orbit_inner( - orbit: Cid, - config: config::Config, + orbit: OrbitId, + store_config: BlockConfig, + index_config: config::IndexStorage, relay: (PeerId, Multiaddr), -) -> Result { - let storage_utils = StorageUtils::new(config.storage.blocks.clone()); - let id = storage_utils - .orbit_id(orbit) - .await? - .ok_or_else(|| anyhow!("Orbit `{}` doesn't have its orbit URL stored.", orbit))?; - - let md = Manifest::resolve_dyn(&id, None) - .await? - .ok_or_else(|| anyhow!("Orbit DID Document not resolvable"))?; - - // let kp = Ed25519Keypair::decode(&mut fs::read(dir.join("kp")).await?)?; - let kp = storage_utils.key_pair(orbit).await?.unwrap(); - - debug!("loading orbit {}", &id); - - let orbit = Orbit::new(&config, kp, md, Some(relay)).await?; - Ok(orbit) +) -> Result> { + debug!("loading orbit {}", &orbit); + Orbit::open( + &OrbitPeerConfigBuilder::::default() + .manifest( + Manifest::resolve_dyn(&orbit, None) + .await? + .ok_or_else(|| anyhow!("Orbit DID Document not resolvable"))?, + ) + .identity( + store_config + .key_pair(&orbit) + .await? + .ok_or_else(|| anyhow!("Peer Identity key could not be found"))?, + ) + .blocks(store_config) + .index(index_config) + .relay(relay) + .build()?, + ) + .await? + .ok_or_else(|| anyhow!("Orbit could not be opened: not found")) } pub fn hash_same>(c: &Cid, b: B) -> Result { @@ -219,65 +234,37 @@ pub fn hash_same>(c: &Cid, b: B) -> Result { )) } -#[rocket::async_trait] -impl ContentAddressedStorage for Orbit { - type Error = anyhow::Error; - async fn put( - &self, - content: &[u8], - codec: SupportedCodecs, - ) -> Result::Error> { - self.service.ipfs.put(content, codec).await - } - async fn get( - &self, - address: &Cid, - ) -> Result>, ::Error> { - ContentAddressedStorage::get(&self.service.ipfs, address).await - } - async fn delete(&self, address: &Cid) -> Result<(), ::Error> { - self.service.ipfs.delete(address).await - } - async fn list(&self) -> Result, ::Error> { - self.service.ipfs.list().await - } -} - -impl Deref for Orbit { - type Target = Manifest; - fn deref(&self) -> &Self::Target { - &self.manifest - } -} - #[cfg(test)] mod tests { use super::*; + use crate::{ + config::{IndexStorage, LocalIndexStorage}, + BlockConfig, FileSystemConfig, + }; use kepler_lib::resolver::DID_METHODS; use kepler_lib::ssi::{ did::{Source, DIDURL}, jwk::JWK, }; use std::convert::TryInto; - use tempdir::TempDir; - - async fn op(md: Manifest) -> anyhow::Result { - let dir = TempDir::new(&md.id().get_cid().to_string()) - .unwrap() - .path() - .to_path_buf(); - let config = config::Config { - storage: config::Storage { - blocks: config::BlockStorage::Local(config::LocalBlockStorage { - path: dir.clone(), - }), - indexes: config::IndexStorage::Local(config::LocalIndexStorage { - path: dir.clone(), - }), - }, - ..Default::default() - }; - Orbit::new(&config, Ed25519Keypair::generate(), md, None).await + use tempfile::{tempdir, TempDir}; + + async fn op(md: Manifest) -> anyhow::Result<(Orbit, TempDir)> { + let dir = tempdir()?; + Ok(( + Orbit::create( + &OrbitPeerConfigBuilder::::default() + .identity(Ed25519Keypair::generate()) + .manifest(md) + .blocks(BlockConfig::B(FileSystemConfig::new(dir.path()))) + .index(IndexStorage::Local(LocalIndexStorage { + path: dir.path().into(), + })) + .build()?, + ) + .await?, + dir, + )) } #[test] @@ -297,6 +284,6 @@ mod tests { let md = Manifest::resolve_dyn(&oid, None).await.unwrap().unwrap(); - let _orbit = op(md).await.unwrap(); + let (_, _) = op(md).await.unwrap(); } } diff --git a/src/p2p/mod.rs b/src/p2p/mod.rs new file mode 100644 index 00000000..1b256444 --- /dev/null +++ b/src/p2p/mod.rs @@ -0,0 +1,73 @@ +use core::time::Duration; +use libp2p::{identify::Config as OIdentifyConfig, identity::PublicKey}; + +pub mod relay; +pub mod transport; + +pub const PROTOCOL_VERSION: &'static str = "kepler/0.1.0"; + +#[derive(Debug, Clone, Hash, PartialEq, Eq)] +pub struct IdentifyConfig { + protocol_version: String, + initial_delay: Duration, + interval: Duration, + push_listen_addr_updates: bool, + cache_size: usize, +} + +impl IdentifyConfig { + pub fn protocol_version(&mut self, i: impl Into) -> &mut Self { + self.protocol_version = i.into(); + self + } + pub fn initial_delay(&mut self, i: impl Into) -> &mut Self { + self.initial_delay = i.into(); + self + } + pub fn interval(&mut self, i: impl Into) -> &mut Self { + self.interval = i.into(); + self + } + pub fn push_listen_addr_updates(&mut self, i: impl Into) -> &mut Self { + self.push_listen_addr_updates = i.into(); + self + } + pub fn cache_size(&mut self, i: impl Into) -> &mut Self { + self.cache_size = i.into(); + self + } +} + +impl Default for IdentifyConfig { + fn default() -> Self { + Self { + protocol_version: PROTOCOL_VERSION.into(), + initial_delay: Duration::from_millis(500), + interval: Duration::from_secs(300), + push_listen_addr_updates: false, + cache_size: 0, + } + } +} + +impl IdentifyConfig { + fn to_config(self, key: PublicKey) -> OIdentifyConfig { + OIdentifyConfig::new(self.protocol_version, key) + .with_initial_delay(self.initial_delay) + .with_interval(self.interval) + .with_push_listen_addr_updates(self.push_listen_addr_updates) + .with_cache_size(self.cache_size) + } +} + +impl From for IdentifyConfig { + fn from(c: OIdentifyConfig) -> Self { + IdentifyConfig { + protocol_version: c.protocol_version, + initial_delay: c.initial_delay, + interval: c.interval, + push_listen_addr_updates: c.push_listen_addr_updates, + cache_size: c.cache_size, + } + } +} diff --git a/src/p2p/relay.rs b/src/p2p/relay.rs new file mode 100644 index 00000000..5c0ae69a --- /dev/null +++ b/src/p2p/relay.rs @@ -0,0 +1,176 @@ +use crate::p2p::{transport::IntoTransport, IdentifyConfig}; +use anyhow::Result; +use futures::{ + channel::{mpsc, oneshot}, + future::{select, Either}, + io::{AsyncRead, AsyncWrite}, + sink::SinkExt, + stream::StreamExt, +}; +use libp2p::{ + autonat::{Behaviour as AutoNat, Config as AutoNatConfig}, + core::{identity::Keypair, upgrade, Multiaddr, PeerId, Transport}, + identify::Behaviour as Identify, + identity::PublicKey, + mplex, noise, + ping::{Behaviour as Ping, Config as PingConfig}, + relay::v2::relay::{Config as RelayConfig, Relay}, + swarm::{Swarm, SwarmBuilder}, + yamux, NetworkBehaviour, +}; + +pub type RelaySwarm = Swarm; + +#[derive(Clone, Debug)] +pub struct RelayNode { + id: PeerId, + sender: mpsc::Sender, +} + +#[derive(NetworkBehaviour)] +pub struct Behaviour { + identify: Identify, + ping: Ping, + relay: Relay, + autonat: AutoNat, +} + +#[derive(Debug)] +pub enum Message { + GetAddresses(oneshot::Sender>), + ListenOn(Vec, oneshot::Sender>), +} + +impl RelayNode { + pub fn id(&self) -> &PeerId { + &self.id + } + pub async fn get_addresses(&mut self) -> Result> { + let (s, r) = oneshot::channel(); + self.sender.send(Message::GetAddresses(s)).await?; + Ok(r.await?) + } + + pub async fn listen_on(&mut self, addr: impl IntoIterator) -> Result<()> { + let (s, r) = oneshot::channel(); + self.sender + .send(Message::ListenOn(addr.into_iter().collect(), s)) + .await?; + r.await? + } +} + +#[derive(Debug, Default)] +pub struct Config { + identify: IdentifyConfig, + ping: PingConfig, + relay: RelayConfig, + autonat: AutoNatConfig, +} + +impl Config { + pub fn identify(&mut self, i: impl Into) -> &mut Self { + self.identify = i.into(); + self + } + pub fn ping(&mut self, i: impl Into) -> &mut Self { + self.ping = i.into(); + self + } + pub fn relay(&mut self, i: impl Into) -> &mut Self { + self.relay = i.into(); + self + } + pub fn autonat(&mut self, i: impl Into) -> &mut Self { + self.autonat = i.into(); + self + } + + fn build(self, pubkey: PublicKey) -> Behaviour { + let peer_id = pubkey.to_peer_id(); + Behaviour { + identify: Identify::new(self.identify.to_config(pubkey)), + ping: Ping::new(self.ping), + relay: Relay::new(peer_id, self.relay), + autonat: AutoNat::new(peer_id, self.autonat), + } + } + + pub fn launch(self, keypair: Keypair, transport: T) -> Result + where + T: IntoTransport, + T::T: 'static + Send + Unpin, + T::Error: 'static + std::error::Error + Send + Sync, + ::Output: 'static + AsyncRead + AsyncWrite + Unpin + Send, + ::Error: 'static + Send + Sync, + ::Dial: Send, + ::ListenerUpgrade: Send, + { + let local_public_key = keypair.public(); + let id = local_public_key.to_peer_id(); + let b = self.build(local_public_key); + let (sender, mut reciever) = mpsc::channel(100); + let r = RelayNode { id, sender }; + + let mut swarm = SwarmBuilder::new( + transport + .into_transport()? + .upgrade(upgrade::Version::V1) + .authenticate(noise::NoiseAuthenticated::xx(&keypair).unwrap()) + .multiplex(upgrade::SelectUpgrade::new( + yamux::YamuxConfig::default(), + mplex::MplexConfig::default(), + )) + .timeout(std::time::Duration::from_secs(20)) + .boxed(), + b, + id, + ) + .build(); + + tokio::spawn(async move { + loop { + match select(reciever.next(), swarm.next()).await { + // if the swarm or the channel are closed, close the relay + Either::Right((None, _)) | Either::Left((None, _)) => { + break; + } + // process command + Either::Left((Some(e), _)) => match e { + Message::ListenOn(a, s) => { + // try listen on each given address + match a.into_iter().try_fold(Vec::new(), |mut listeners, addr| { + match swarm.listen_on(addr) { + Ok(l) => { + listeners.push(l); + Ok(listeners) + } + Err(e) => Err((e, listeners)), + } + }) { + Ok(_) => s.send(Ok(())), + // if one fails, roll back all of them + Err((e, listeners)) => { + for l in listeners { + swarm.remove_listener(l); + } + s.send(Err(e.into())) + } + } + .map_err(|_| anyhow!("failed to return listening result"))?; + } + Message::GetAddresses(s) => { + s.send(swarm.listeners().map(|a| a.clone()).collect()) + .map_err(|_| anyhow!("failed to return listeners"))?; + } + }, + Either::Right((Some(_), _)) => { + // process swarm event + } + } + } + Result::<(), anyhow::Error>::Ok(()) + }); + Ok(r) + } +} diff --git a/src/p2p/transport.rs b/src/p2p/transport.rs new file mode 100644 index 00000000..c4b27aa9 --- /dev/null +++ b/src/p2p/transport.rs @@ -0,0 +1,226 @@ +use crate::storage::either::EitherError; +use futures::io::{AsyncRead, AsyncWrite}; +use libp2p::{ + core::transport::{dummy::DummyTransport, MemoryTransport, OrTransport, Transport}, + dns::{ResolverConfig, ResolverOpts, TokioDnsConfig as DnsTransport}, + tcp::TokioTcpTransport as TcpTransport, + wasm_ext::ExtTransport, + websocket::{tls::Config as WsTlsConfig, WsConfig as WsTransport}, +}; +use std::io::Error as IoError; + +pub trait IntoTransport { + type T: Transport; + type Error; + fn into_transport(self) -> Result; + fn and(self, other: O) -> Both + where + Self: Sized, + { + Both(self, other) + } +} + +pub use libp2p::tcp::GenTcpConfig as TcpConfig; +pub use libp2p::wasm_ext::ffi::Transport as ExtConfig; + +#[derive(Default, Debug, Clone, Hash, PartialEq, Eq)] +pub struct MemoryConfig; + +#[derive(Default, Debug, Clone, Hash, PartialEq, Eq)] +pub struct DummyConfig; + +#[derive(Default, Debug, Clone, Hash, PartialEq, Eq)] +pub struct Both(pub A, pub B); + +impl IntoTransport for Both +where + A: IntoTransport, + B: IntoTransport, +{ + type T = OrTransport; + type Error = EitherError; + fn into_transport(self) -> Result { + Ok(OrTransport::new( + self.0.into_transport().map_err(EitherError::A)?, + self.1.into_transport().map_err(EitherError::B)?, + )) + } +} + +#[derive(Clone, Debug)] +pub enum DnsResolver { + System, + Custom(CustomDnsResolver), +} + +impl Default for DnsResolver { + fn default() -> Self { + Self::System + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Default)] +pub struct CustomDnsResolver { + conf: ResolverConfig, + opts: ResolverOpts, +} + +impl CustomDnsResolver { + pub fn config(&mut self, i: impl Into) -> &mut Self { + self.conf = i.into(); + self + } + pub fn options(&mut self, i: impl Into) -> &mut Self { + self.opts = i.into(); + self + } +} + +#[derive(Debug, Clone, Default)] +pub struct DnsConfig { + resolver: DnsResolver, + base: B, +} + +impl DnsConfig { + pub fn resolver(&mut self, i: impl Into) -> &mut Self { + self.resolver = i.into(); + self + } + pub fn base(&mut self, i: impl Into) -> &mut Self { + self.base = i.into(); + self + } +} + +impl IntoTransport for DnsConfig +where + B: Default + IntoTransport, + B::T: 'static + Send + Unpin, + ::Output: 'static + AsyncRead + AsyncWrite + Send + Unpin, + ::Dial: Send, + ::Error: Send, +{ + type T = DnsTransport; + type Error = EitherError; + fn into_transport(self) -> Result { + match self.resolver { + DnsResolver::System => { + DnsTransport::system(self.base.into_transport().map_err(EitherError::B)?) + .map_err(EitherError::A) + } + DnsResolver::Custom(custom) => DnsTransport::custom( + self.base.into_transport().map_err(EitherError::B)?, + custom.conf, + custom.opts, + ) + .map_err(EitherError::A), + } + } +} + +pub const WS_MAX_DATA_SIZE: usize = 256 * 1024 * 1024; + +#[derive(Debug, Clone)] +pub struct WsConfig { + base: T, + max_redirects: u8, + max_data_size: usize, + deflate: bool, + tls: WsTlsConfig, +} + +impl WsConfig { + pub fn from_base(b: impl Into) -> Self { + Self { + base: b.into(), + max_redirects: 0, + max_data_size: WS_MAX_DATA_SIZE, + deflate: false, + tls: WsTlsConfig::client(), + } + } + pub fn base(&mut self, i: impl Into) -> &mut Self { + self.base = i.into(); + self + } + pub fn max_redirects(&mut self, i: impl Into) -> &mut Self { + self.max_redirects = i.into(); + self + } + pub fn max_data_size(&mut self, i: impl Into) -> &mut Self { + self.max_data_size = i.into(); + self + } + pub fn deflate(&mut self, i: impl Into) -> &mut Self { + self.deflate = i.into(); + self + } + pub fn tls(&mut self, i: impl Into) -> &mut Self { + self.tls = i.into(); + self + } +} + +impl Default for WsConfig +where + T: Default, +{ + fn default() -> Self { + Self::from_base(T::default()) + } +} + +impl IntoTransport for WsConfig +where + B: Default + IntoTransport, + B::T: 'static + Send + Unpin, + ::Output: 'static + AsyncRead + AsyncWrite + Send + Unpin, + ::Dial: Send, + ::Error: Send, + ::ListenerUpgrade: Send, +{ + type T = WsTransport; + type Error = B::Error; + fn into_transport(self) -> Result { + let mut ws = WsTransport::new(self.base.into_transport()?); + ws.set_max_redirects(self.max_redirects) + .set_max_data_size(self.max_data_size) + .set_tls_config(self.tls) + .use_deflate(self.deflate); + Ok(ws) + } +} + +impl IntoTransport for ExtConfig { + type T = ExtTransport; + type Error = std::convert::Infallible; + fn into_transport(self) -> Result { + Ok(Self::T::new(self)) + } +} + +impl IntoTransport for MemoryConfig { + type T = MemoryTransport; + type Error = std::convert::Infallible; + fn into_transport(self) -> Result { + Ok(Self::T::new()) + } +} + +impl IntoTransport for TcpConfig { + type T = TcpTransport; + type Error = std::convert::Infallible; + fn into_transport(self) -> Result { + Ok(Self::T::new(self)) + } +} + +impl IntoTransport for DummyConfig { + type T = DummyTransport; + type Error = std::convert::Infallible; + fn into_transport(self) -> Result { + Ok(Self::T::new()) + } +} diff --git a/src/relay.rs b/src/relay.rs deleted file mode 100644 index b2161bea..00000000 --- a/src/relay.rs +++ /dev/null @@ -1,173 +0,0 @@ -use anyhow::Result; -use ipfs::{p2p::transport::TransportBuilder, Ipfs, IpfsOptions, TestTypes, UninitializedIpfs}; -use libp2p::core::{ - identity::Keypair, multiaddr::multiaddr, transport::MemoryTransport, Multiaddr, PeerId, -}; -use rocket::tokio::spawn; - -use crate::orbit::AbortOnDrop; - -pub struct RelayNode { - pub port: u16, - pub id: PeerId, - _task: AbortOnDrop<()>, - _ipfs: Ipfs, -} - -impl RelayNode { - pub async fn new(port: u16, keypair: Keypair) -> Result { - let local_public_key = keypair.public(); - let id = local_public_key.to_peer_id(); - let relay_tcp_addr = Self::_external(port); - let relay_mem_addr = Self::_internal(port); - - let (transport_builder, relay_behaviour) = TransportBuilder::new(keypair.clone())? - .or(MemoryTransport::default()) - .relay(); - - let ipfs_opts = IpfsOptions { - ipfs_path: std::env::temp_dir(), - keypair, - bootstrap: vec![], - mdns: false, - kad_protocol: "/kepler/relay".to_string().into(), - listening_addrs: vec![relay_tcp_addr, relay_mem_addr], - span: None, - }; - - // TestTypes designates an in-memory Ipfs instance, but this peer won't store data anyway. - let (_ipfs, ipfs_task) = - UninitializedIpfs::new(ipfs_opts, transport_builder.build(), Some(relay_behaviour)) - .start() - .await?; - - tracing::debug!( - "opened relay: {} at {}, {}", - id, - Self::_internal(port), - Self::_external(port), - ); - - let task = spawn(ipfs_task); - Ok(Self { - port, - _task: AbortOnDrop::new(task), - id, - _ipfs, - }) - } - - fn _internal(port: u16) -> Multiaddr { - multiaddr!(Memory(port)) - } - - pub fn internal(&self) -> Multiaddr { - Self::_internal(self.port) - } - - fn _external(port: u16) -> Multiaddr { - multiaddr!(Ip4([127, 0, 0, 1]), Tcp(port)) - } - - pub fn external(&self) -> Multiaddr { - Self::_external(self.port) - } -} - -#[cfg(test)] -pub mod test { - use super::*; - use ipfs::{ - p2p::transport::TransportBuilder, IpfsOptions, MultiaddrWithoutPeerId, Types, - UninitializedIpfs, - }; - use libp2p::core::multiaddr::{multiaddr, Protocol}; - use std::{ - convert::TryFrom, - sync::atomic::{AtomicU16, Ordering}, - time::Duration, - }; - - static PORT: AtomicU16 = AtomicU16::new(10000); - - pub async fn test_relay() -> Result { - RelayNode::new( - PORT.fetch_add(1, Ordering::SeqCst), - Keypair::generate_ed25519(), - ) - .await - } - - #[tokio::test(flavor = "multi_thread")] - async fn relay() -> Result<()> { - let relay = test_relay().await?; - - let dir = tempdir::TempDir::new("relay")?; - let alice_path = dir.path().join("alice"); - std::fs::create_dir(&alice_path)?; - let bob_path = dir.path().join("bob"); - std::fs::create_dir(&bob_path)?; - - // Isn't actually in-memory, just provides useful defaults. - let mut alice_opts = IpfsOptions::inmemory_with_generated_keys(); - alice_opts.ipfs_path = alice_path; - alice_opts.listening_addrs = vec![multiaddr!(P2pCircuit)]; - let mut bob_opts = IpfsOptions::inmemory_with_generated_keys(); - bob_opts.ipfs_path = bob_path; - - let alice_peer_id = alice_opts.keypair.public().to_peer_id(); - let bob_peer_id = bob_opts.keypair.public().to_peer_id(); - - let (alice_builder, alice_relay) = TransportBuilder::new(alice_opts.keypair.clone())? - .or(MemoryTransport::default()) - .relay(); - let alice_transport = alice_builder - .map_auth() - .map(crate::transport::auth_mapper([bob_peer_id.clone()])) - .build(); - let (alice, task) = - UninitializedIpfs::::new(alice_opts, alice_transport, Some(alice_relay)) - .start() - .await?; - tokio::spawn(task); - - let (bob_builder, bob_relay) = TransportBuilder::new(bob_opts.keypair.clone())? - .or(MemoryTransport::default()) - .relay(); - let (bob, task) = - UninitializedIpfs::::new(bob_opts, bob_builder.build(), Some(bob_relay)) - .start() - .await?; - tokio::spawn(task); - - alice - .connect(MultiaddrWithoutPeerId::try_from(relay.internal())?.with(relay.id.clone())) - .await - .expect("alice failed to connect to relay"); - - bob.connect( - MultiaddrWithoutPeerId::try_from( - relay - .external() - .with(Protocol::P2p(relay.id.clone().into())) - .with(Protocol::P2pCircuit), - )? - .with(alice_peer_id.clone()), - ) - .await - .expect("bob failed to connect to alice"); - - tokio::time::sleep(Duration::from_millis(1000)).await; - - let alice_peers = alice.peers().await?; - let bob_peers = bob.peers().await?; - assert!(alice_peers - .iter() - .any(|conn| conn.addr.peer_id == bob_peer_id)); - assert!(bob_peers - .iter() - .any(|conn| conn.addr.peer_id == alice_peer_id)); - - Ok(()) - } -} diff --git a/src/routes/mod.rs b/src/routes/mod.rs index f0de98c7..bc699d0f 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -1,7 +1,11 @@ use anyhow::Result; -use ipfs::{PeerId, Protocol}; +use futures::io::AsyncRead; use kepler_lib::libipld::Cid; -use libp2p::identity::ed25519::Keypair as Ed25519Keypair; +use libp2p::{ + core::PeerId, + identity::{ed25519::Keypair as Ed25519Keypair, PublicKey}, + multiaddr::multiaddr, +}; use rocket::{ data::{Data, ToByteUnit}, http::{Header, Status}, @@ -18,10 +22,14 @@ use tracing::{info_span, Instrument}; use crate::{ auth_guards::{DelegateAuthWrapper, InvokeAuthWrapper, KVAction}, - kv::{ObjectBuilder, ObjectReader}, - relay::RelayNode, + config::Config, + kv::{ObjectBuilder, ReadResponse}, + p2p::relay::RelayNode, + storage::ImmutableStore, tracing::TracingSpan, + BlockStores, }; +use tokio_util::compat::{FuturesAsyncReadCompatExt, TokioAsyncReadCompatExt}; pub struct Metadata(pub BTreeMap); @@ -50,19 +58,22 @@ impl<'r> Responder<'r, 'static> for Metadata { } } -pub struct KVResponse(ObjectReader, pub Metadata); +pub struct KVResponse(R, pub Metadata); -impl KVResponse { - pub fn new(md: Metadata, reader: ObjectReader) -> Self { +impl KVResponse { + pub fn new(md: Metadata, reader: R) -> Self { Self(reader, md) } } -impl<'r> Responder<'r, 'static> for KVResponse { +impl<'r, R> Responder<'r, 'static> for KVResponse +where + R: 'static + AsyncRead + Send, +{ fn respond_to(self, r: &'r Request<'_>) -> rocket::response::Result<'static> { Ok(Response::build_from(self.1.respond_to(r)?) // must ensure that Metadata::respond_to does not set the body of the response - .streamed_body(self.0) + .streamed_body(self.0.compat()) .finalize()) } } @@ -77,11 +88,13 @@ pub mod util_routes { } #[get("/peer/relay")] -pub fn relay_addr(relay: &State) -> String { - relay - .external() - .with(Protocol::P2p(relay.id.into())) - .to_string() +pub fn relay_addr(relay: &State, config: &State) -> String { + multiaddr!( + Ip4([127, 0, 0, 1]), + Tcp(config.relay.port), + P2p(relay.id().clone()) + ) + .to_string() } #[get("/peer/generate")] @@ -89,7 +102,7 @@ pub fn open_host_key( s: &State>>, ) -> Result { let keypair = Ed25519Keypair::generate(); - let id = ipfs::PublicKey::Ed25519(keypair.public()).to_peer_id(); + let id = PublicKey::Ed25519(keypair.public()).to_peer_id(); s.write() .map_err(|_| (Status::InternalServerError, "cant read keys"))? .insert(id, keypair); @@ -114,10 +127,10 @@ impl<'r> Responder<'r, 'static> for DelegateAuthWrapper { #[post("/invoke", data = "")] pub async fn invoke( - i: InvokeAuthWrapper, + i: InvokeAuthWrapper, req_span: TracingSpan, data: Data<'_>, -) -> Result { +) -> Result::Readable>, (Status, String)> { let action_label = i.prometheus_label().to_string(); let span = info_span!(parent: &req_span.0, "invoke", action = %action_label); // Instrumenting async block to handle yielding properly @@ -138,10 +151,13 @@ pub async fn invoke( .await } -pub async fn handle_kv_action( - action: KVAction, +pub async fn handle_kv_action( + action: KVAction, data: Data<'_>, -) -> Result { +) -> Result, (Status, String)> +where + B: 'static + ImmutableStore, +{ match action { KVAction::Delete { orbit, @@ -162,7 +178,7 @@ pub async fn handle_kv_action( Ok(InvocationResponse::EmptySuccess) } KVAction::Get { orbit, key } => match orbit.service.read(key).await { - Ok(Some((md, r))) => Ok(InvocationResponse::KVResponse(KVResponse::new( + Ok(Some(ReadResponse(md, r))) => Ok(InvocationResponse::KVResponse(KVResponse::new( Metadata(md), r, ))), @@ -213,7 +229,7 @@ pub async fn handle_kv_action( .write( [( ObjectBuilder::new(key.as_bytes().to_vec(), metadata.0, auth_ref), - data.open(1u8.gigabytes()), + data.open(1u8.gigabytes()).compat(), )], rm, ) @@ -224,16 +240,19 @@ pub async fn handle_kv_action( } } -pub enum InvocationResponse { +pub enum InvocationResponse { NotFound, EmptySuccess, - KVResponse(KVResponse), + KVResponse(KVResponse), List(Vec), Metadata(Metadata), Revoked, } -impl<'r> Responder<'r, 'static> for InvocationResponse { +impl<'r, R> Responder<'r, 'static> for InvocationResponse +where + R: 'static + AsyncRead + Send, +{ fn respond_to(self, request: &'r Request<'_>) -> rocket::response::Result<'static> { match self { InvocationResponse::NotFound => Option::<()>::None.respond_to(request), diff --git a/src/storage/dynamodb.rs b/src/storage/dynamodb.rs deleted file mode 100644 index 2548018c..00000000 --- a/src/storage/dynamodb.rs +++ /dev/null @@ -1,366 +0,0 @@ -use anyhow::{Context, Error}; -use aws_sdk_dynamodb::{ - error::{GetItemError, GetItemErrorKind}, - model::{AttributeValue, ReturnValue}, - output::ScanOutput, - types::SdkError, - Client, -}; -use aws_smithy_http::endpoint::Endpoint; -use futures::{ - lock::Mutex, - stream::{self, StreamExt, TryStreamExt}, -}; -use ipfs::{ - refs::IpldRefsError, - repo::{PinKind, PinMode, PinStore}, -}; -use kepler_lib::libipld::cid::{multibase::Base, Cid}; -use rocket::async_trait; -use std::{collections::BTreeSet, str::FromStr}; - -use crate::config; - -const CID_ATTRIBUTE: &str = "Cid"; -const ROOT_ATTRIBUTE: &str = "Root"; -const PARENTS_ATTRIBUTE: &str = "Parents"; - -#[derive(Debug)] -pub struct DynamoPinStore { - // TODO no need for Mutex??? - client: Mutex, - table: String, - orbit: Cid, -} - -impl DynamoPinStore { - pub fn new(config: config::DynamoStorage, orbit: Cid) -> Self { - let general_config = super::utils::aws_config(); - let sdk_config = aws_sdk_dynamodb::config::Builder::from(&general_config); - let sdk_config = match config.endpoint { - Some(e) => sdk_config.endpoint_resolver(Endpoint::immutable(e)), - None => sdk_config, - }; - let sdk_config = sdk_config.build(); - let client = Mutex::new(Client::from_conf(sdk_config)); - Self { - client, - table: config.table, - orbit, - } - } - - pub async fn healthcheck(&self) -> Result<(), Error> { - // TODO ideally that would be in the builder - self.client - .lock() - .await - .describe_table() - .table_name(self.table.clone().clone()) - .send() - .await - .context(anyhow!("Failed healthchec for table `{}`", self.table))?; - Ok(()) - } -} - -// TODO implement mutex - -// TODO make that public in rust-ipfs -pub type References<'a> = futures::stream::BoxStream<'a, Result>; - -#[async_trait] -impl PinStore for DynamoPinStore { - async fn is_pinned(&self, cid: &Cid) -> Result { - match self - .client - .lock() - .await - .get_item() - .table_name(self.table.clone()) - .key( - CID_ATTRIBUTE, - AttributeValue::S(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - cid - )), - ) - .send() - .await - { - Ok(_) => Ok(true), - Err(SdkError::ServiceError { - err: - GetItemError { - kind: GetItemErrorKind::ResourceNotFoundException(_), - .. - }, - .. - }) => Ok(false), - Err(e) => Err(anyhow!("Error checking on item: {}", e)), - } - } - - /// Only using recursive pins - async fn insert_direct_pin(&self, _target: &Cid) -> Result<(), Error> { - Ok(()) - // Assuming a direct pin can't be already recursively/indirectly pinned already (i.e. already exist); - } - - async fn insert_recursive_pin( - &self, - target: &Cid, - referenced: References<'_>, - ) -> Result<(), Error> { - let client = self.client.lock().await; - // TODO either insert or increment - client - .update_item() - .table_name(self.table.clone()) - .key( - CID_ATTRIBUTE, - AttributeValue::S(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - target - )), - ) - .update_expression(format!( - "SET {} = :pin, {p} = {p} + :increment", - ROOT_ATTRIBUTE, - p = PARENTS_ATTRIBUTE - )) - .expression_attribute_values(":pin", AttributeValue::Bool(true)) - .expression_attribute_values(":increment", AttributeValue::N(1.to_string())) - .send() - .await?; - - let set = referenced.try_collect::>().await?; - for cid in set.iter() { - client - .update_item() - .table_name(self.table.clone()) - .key( - CID_ATTRIBUTE, - AttributeValue::S(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - cid - )), - ) - .update_expression(format!("SET {p} = {p} + :increment", p = PARENTS_ATTRIBUTE)) - .expression_attribute_values(":increment", AttributeValue::N(1.to_string())) - .send() - .await?; - } - Ok(()) - } - - /// Only using recursive pins - async fn remove_direct_pin(&self, _target: &Cid) -> Result<(), Error> { - Ok(()) - } - - async fn remove_recursive_pin( - &self, - target: &Cid, - referenced: References<'_>, - ) -> Result<(), Error> { - let client = self.client.lock().await; - let res = client - .update_item() - .table_name(self.table.clone()) - .key( - CID_ATTRIBUTE, - AttributeValue::S(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - target - )), - ) - .update_expression(format!( - "SET {} = :pin, {p} = {p} - :increment", - ROOT_ATTRIBUTE, - p = PARENTS_ATTRIBUTE - )) - .expression_attribute_values(":pin", AttributeValue::Bool(false)) - .expression_attribute_values(":increment", AttributeValue::N(1.to_string())) - .return_values(ReturnValue::UpdatedNew) - .send() - .await?; - - // TODO use a conditional delete - match res - .attributes - .and_then(|m| m.get(PARENTS_ATTRIBUTE).cloned()) - { - Some(AttributeValue::N(parents)) => { - if *parents == 0.to_string() { - client - .delete_item() - .table_name(self.table.clone()) - .key( - CID_ATTRIBUTE, - AttributeValue::S(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - target - )), - ) - .send() - .await?; - } - } - _ => error!("No attribute returned."), - }; - - let set = referenced.try_collect::>().await?; - for cid in set.iter() { - let res = client - .update_item() - .table_name(self.table.clone()) - .key( - CID_ATTRIBUTE, - AttributeValue::S(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - cid - )), - ) - .update_expression(format!("SET {p} = {p} - :increment", p = PARENTS_ATTRIBUTE)) - .expression_attribute_values(":increment", AttributeValue::N(1.to_string())) - .return_values(ReturnValue::UpdatedNew) - .send() - .await?; - - match res.attributes.map(|m| m.get(PARENTS_ATTRIBUTE).cloned()) { - Some(Some(AttributeValue::N(parents))) => { - if *parents == 0.to_string() { - client - .delete_item() - .table_name(self.table.clone()) - .key( - CID_ATTRIBUTE, - AttributeValue::S(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - target - )), - ) - .send() - .await?; - } - } - _ => error!("No attribute returned."), - }; - } - Ok(()) - } - - async fn list( - &self, - requirement: Option, - ) -> futures::stream::BoxStream<'static, Result<(Cid, PinMode), Error>> { - let query = self - .client - .lock() - .await - .scan() - .table_name(self.table.clone()); - let query = match requirement { - Some(PinMode::Recursive | PinMode::Direct) => query - .filter_expression(format!("{} = :r", ROOT_ATTRIBUTE)) - .expression_attribute_values(":r", AttributeValue::Bool(true)), - None | Some(PinMode::Indirect) => query, - }; - // TODO handle pagination - match query.send().await { - Ok(ScanOutput { - items: Some(items), .. - }) => stream::iter(items) - .map(|map| { - let cid = match map.get(CID_ATTRIBUTE) { - Some(AttributeValue::S(c)) => c, - _ => return Err(anyhow!("Row with no string Cid key.")), - }; - let pin_mode = match map.get(ROOT_ATTRIBUTE) { - Some(AttributeValue::Bool(true)) => PinMode::Recursive, - Some(AttributeValue::Bool(false)) => PinMode::Indirect, - Some(_) | None => { - error!("Cid `{}` with no boolean Root attribute.", cid); - return Err(anyhow!("Cid `{}` with no boolean Root attribute.", cid)); - } - }; - Cid::from_str(cid) - .map_err(|e| anyhow!("Couldn't convert cid key to Cid: {}", e)) - .map(|kk| (kk, pin_mode)) - }) - .boxed(), - Ok(ScanOutput { items: None, .. }) => stream::iter(vec![]).boxed(), - Err(e) => stream::iter(vec![Err(anyhow!("Error checking on item: {}", e))]).boxed(), - } - } - - async fn query( - &self, - ids: Vec, - requirement: Option, - ) -> Result)>, Error> { - // TODO impl PinKind::IndirectFrom - let query = self - .client - .lock() - .await - .scan() - .table_name(self.table.clone()); - let (query, expression) = match requirement { - Some(PinMode::Recursive | PinMode::Direct) => ( - query.expression_attribute_values(":r", AttributeValue::Bool(true)), - format!("{} == :r and", ROOT_ATTRIBUTE), - ), - None | Some(PinMode::Indirect) => (query, String::new()), - }; - let query = query - .filter_expression(format!("{} contains (:ids, {})", expression, CID_ATTRIBUTE)) - .expression_attribute_values( - ":ids", - AttributeValue::Ns( - ids.iter() - .map(|id| { - self.orbit - .to_string_of_base(Base::Base58Btc) - .map(|c| format!("{}/{}", c, id)) - }) - .collect::, _>>()?, - ), - ); - // TODO handle pagination - match query.send().await { - Ok(ScanOutput { - items: Some(items), .. - }) => items - .iter() - .map(|map| { - let cid = match map.get(CID_ATTRIBUTE) { - Some(AttributeValue::S(c)) => c, - _ => return Err(anyhow!("Row with no string Cid key.")), - }; - let pin_mode = match map.get(ROOT_ATTRIBUTE) { - Some(AttributeValue::Bool(true)) => PinKind::Recursive(0), - Some(AttributeValue::Bool(false)) => PinKind::IndirectFrom(Cid::default()), - Some(_) | None => { - error!("Cid `{}` with no boolean Root attribute.", cid); - return Err(anyhow!("Cid `{}` with no boolean Root attribute.", cid)); - } - }; - Cid::from_str(cid) - .map_err(|e| anyhow!("Couldn't convert cid key to Cid: {}", e)) - .map(|kk| (kk, pin_mode)) - }) - .collect(), - Ok(ScanOutput { items: None, .. }) => Ok(vec![]), - Err(e) => Err(anyhow!("Error checking on item: {}", e)), - } - } -} diff --git a/src/storage/either.rs b/src/storage/either.rs new file mode 100644 index 00000000..ef55bf55 --- /dev/null +++ b/src/storage/either.rs @@ -0,0 +1,132 @@ +use crate::{ + orbit::ProviderUtils, + storage::{ImmutableStore, StorageConfig}, +}; +use futures::future::Either as AsyncReadEither; +use kepler_lib::{ + libipld::cid::multihash::{Code, Multihash}, + resource::OrbitId, +}; +use libp2p::identity::ed25519::Keypair as Ed25519Keypair; + +#[derive(Debug, Clone, Hash, PartialEq, Eq)] +pub enum Either { + A(A), + B(B), +} + +#[derive(thiserror::Error, Debug)] +pub enum EitherError { + #[error(transparent)] + A(A), + #[error(transparent)] + B(B), +} + +#[async_trait] +impl ImmutableStore for Either +where + A: ImmutableStore, + B: ImmutableStore, +{ + type Readable = AsyncReadEither; + type Error = EitherError; + async fn contains(&self, id: &Multihash) -> Result { + match self { + Self::A(l) => l.contains(id).await.map_err(Self::Error::A), + Self::B(r) => r.contains(id).await.map_err(Self::Error::B), + } + } + async fn write( + &self, + data: impl futures::io::AsyncRead + Send, + hash_type: Code, + ) -> Result { + match self { + Self::A(l) => l.write(data, hash_type).await.map_err(Self::Error::A), + Self::B(r) => r.write(data, hash_type).await.map_err(Self::Error::B), + } + } + async fn remove(&self, id: &Multihash) -> Result, Self::Error> { + match self { + Self::A(l) => l.remove(id).await.map_err(Self::Error::A), + Self::B(r) => r.remove(id).await.map_err(Self::Error::B), + } + } + async fn read(&self, id: &Multihash) -> Result, Self::Error> { + match self { + Self::A(l) => l + .read(id) + .await + .map(|o| o.map(Self::Readable::Left)) + .map_err(Self::Error::A), + Self::B(r) => r + .read(id) + .await + .map(|o| o.map(Self::Readable::Right)) + .map_err(Self::Error::B), + } + } +} + +#[async_trait] +impl StorageConfig> for Either +where + A: StorageConfig + Sync, + B: StorageConfig + Sync, +{ + type Error = EitherError; + async fn open(&self, orbit: &OrbitId) -> Result>, Self::Error> { + match self { + Self::A(a) => a + .open(orbit) + .await + .map(|o| o.map(Either::A)) + .map_err(Self::Error::A), + Self::B(b) => b + .open(orbit) + .await + .map(|o| o.map(Either::B)) + .map_err(Self::Error::B), + } + } + async fn create(&self, orbit: &OrbitId) -> Result, Self::Error> { + match self { + Self::A(a) => a.create(orbit).await.map(Either::A).map_err(Self::Error::A), + Self::B(b) => b.create(orbit).await.map(Either::B).map_err(Self::Error::B), + } + } +} + +#[async_trait] +impl ProviderUtils for Either +where + A: ProviderUtils + Sync, + B: ProviderUtils + Sync, +{ + type Error = EitherError; + async fn exists(&self, orbit: &OrbitId) -> Result { + match self { + Self::A(a) => a.exists(orbit).await.map_err(Self::Error::A), + Self::B(b) => b.exists(orbit).await.map_err(Self::Error::B), + } + } + async fn relay_key_pair(&self) -> Result { + match self { + Self::A(a) => a.relay_key_pair().await.map_err(Self::Error::A), + Self::B(b) => b.relay_key_pair().await.map_err(Self::Error::B), + } + } + async fn key_pair(&self, orbit: &OrbitId) -> Result, Self::Error> { + match self { + Self::A(a) => a.key_pair(orbit).await.map_err(Self::Error::A), + Self::B(b) => b.key_pair(orbit).await.map_err(Self::Error::B), + } + } + async fn setup_orbit(&self, orbit: &OrbitId, key: &Ed25519Keypair) -> Result<(), Self::Error> { + match self { + Self::A(a) => a.setup_orbit(orbit, key).await.map_err(Self::Error::A), + Self::B(b) => b.setup_orbit(orbit, key).await.map_err(Self::Error::B), + } + } +} diff --git a/src/storage/file_system.rs b/src/storage/file_system.rs new file mode 100644 index 00000000..38e5b5ff --- /dev/null +++ b/src/storage/file_system.rs @@ -0,0 +1,175 @@ +use crate::{ + orbit::ProviderUtils, + storage::{utils::copy_in, ImmutableStore, StorageConfig}, +}; +use futures::io::AllowStdIo; +use kepler_lib::{ + libipld::cid::{ + multibase::{encode, Base}, + multihash::{Code, Error as MultihashError, Multihash}, + }, + resource::OrbitId, +}; +use libp2p::identity::{ed25519::Keypair as Ed25519Keypair, error::DecodingError}; +use serde::{Deserialize, Serialize}; +use std::{ + io::{Error as IoError, ErrorKind}, + path::{Path, PathBuf}, +}; +use tempfile::{NamedTempFile, PersistError}; +use tokio::fs::{create_dir_all, read, remove_file, write, File}; +use tokio_util::compat::{Compat, TokioAsyncReadCompatExt}; + +#[derive(Debug, Clone)] +pub struct FileSystemStore { + path: PathBuf, +} + +impl FileSystemStore { + pub fn new(path: PathBuf) -> Self { + Self { path } + } + + fn get_path(&self, mh: &Multihash) -> PathBuf { + self.path.join(encode(Base::Base64Url, mh.to_bytes())) + } +} + +#[derive(Serialize, Deserialize, Debug, Clone, Hash, PartialEq, Eq)] +pub struct FileSystemConfig { + path: PathBuf, +} + +impl FileSystemConfig { + pub fn new>(p: P) -> Self { + Self { + path: p.as_ref().into(), + } + } + pub fn path(&self) -> &Path { + &self.path + } +} + +#[async_trait] +impl StorageConfig for FileSystemConfig { + type Error = IoError; + async fn open(&self, orbit: &OrbitId) -> Result, Self::Error> { + let path = self.path.join(orbit.get_cid().to_string()).join("blocks"); + if path.is_dir() { + Ok(Some(FileSystemStore::new(path))) + } else { + Ok(None) + } + } + async fn create(&self, orbit: &OrbitId) -> Result { + let path = self.path.join(orbit.get_cid().to_string()).join("blocks"); + if !path.is_dir() { + create_dir_all(&path).await?; + } + Ok(FileSystemStore::new(path)) + } +} + +impl Default for FileSystemConfig { + fn default() -> Self { + Self { + path: PathBuf::from(r"/tmp/kepler/blocks"), + } + } +} + +#[derive(thiserror::Error, Debug)] +pub enum ProviderError { + #[error(transparent)] + Io(#[from] IoError), + #[error(transparent)] + KeypairDecode(#[from] DecodingError), +} + +#[async_trait] +impl ProviderUtils for FileSystemConfig { + type Error = ProviderError; + async fn exists(&self, orbit: &OrbitId) -> Result { + Ok(self + .path + .join(orbit.get_cid().to_string()) + .join("blocks") + .is_dir()) + } + async fn relay_key_pair(&self) -> Result { + let path = self.path.join("kp"); + match read(&path).await { + Ok(mut k) => Ok(Ed25519Keypair::decode(&mut k)?), + Err(e) if e.kind() == ErrorKind::NotFound => { + let k = Ed25519Keypair::generate(); + write(&path, k.encode()).await?; + Ok(k) + } + Err(e) => Err(e.into()), + } + } + async fn key_pair(&self, orbit: &OrbitId) -> Result, Self::Error> { + match read(self.path.join(orbit.get_cid().to_string()).join("kp")).await { + Ok(mut k) => Ok(Some(Ed25519Keypair::decode(&mut k)?)), + Err(e) if e.kind() == ErrorKind::NotFound => Ok(None), + Err(e) => Err(e.into()), + } + } + async fn setup_orbit(&self, orbit: &OrbitId, key: &Ed25519Keypair) -> Result<(), Self::Error> { + let dir = self.path.join(orbit.get_cid().to_string()); + create_dir_all(&dir).await?; + write(dir.join("kp"), key.encode()).await?; + write(dir.join("id"), orbit.to_string()).await?; + Ok(()) + } +} + +#[derive(thiserror::Error, Debug)] +pub enum FileSystemStoreError { + #[error(transparent)] + Io(#[from] IoError), + #[error(transparent)] + Multihash(#[from] MultihashError), + #[error(transparent)] + Persist(#[from] PersistError), +} + +#[async_trait] +impl ImmutableStore for FileSystemStore { + type Error = FileSystemStoreError; + type Readable = Compat; + async fn contains(&self, id: &Multihash) -> Result { + Ok(self.get_path(id).exists()) + } + async fn write( + &self, + data: impl futures::io::AsyncRead + Send, + hash_type: Code, + ) -> Result { + let (multihash, file) = copy_in( + data, + AllowStdIo::new(NamedTempFile::new_in(&self.path)?), + hash_type, + ) + .await?; + + let file = file.into_inner(); + file.persist(self.get_path(&multihash))?; + Ok(multihash) + } + async fn remove(&self, id: &Multihash) -> Result, Self::Error> { + match remove_file(self.get_path(id)).await { + Ok(()) => Ok(Some(())), + Err(e) if e.kind() == ErrorKind::NotFound => Ok(None), + Err(e) => Err(e.into()), + } + } + async fn read(&self, id: &Multihash) -> Result, Self::Error> { + match File::open(self.get_path(id)).await { + Ok(f) => Ok(Some(f.compat())), + Err(e) if e.kind() == ErrorKind::NotFound => Ok(None), + Err(e) => Err(e.into()), + } + } +} diff --git a/src/storage/mod.rs b/src/storage/mod.rs index c3369b77..bd13a568 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1,472 +1,114 @@ use anyhow::{Error, Result}; -use aws_sdk_s3::{ - error::{GetObjectError, GetObjectErrorKind}, - types::{ByteStream, SdkError}, +use kepler_lib::libipld::cid::{ + multihash::{Code, Multihash}, + Cid, }; -use aws_smithy_http::body::SdkBody; -use ipfs::{ - repo::{ - fs::{FsBlockStore, FsDataStore, FsLock}, - mem::MemLock, - BlockPut, BlockRm, BlockRmError, BlockStore, Column, DataStore, Lock, LockError, PinKind, - PinMode, PinStore, - }, - Block, RepoTypes, -}; -use kepler_lib::libipld::cid::{multibase::Base, Cid}; use kepler_lib::resource::OrbitId; -use libp2p::identity::ed25519::Keypair as Ed25519Keypair; -use rocket::tokio::fs; -use std::{path::PathBuf, str::FromStr}; -use tracing::instrument; +use std::{collections::HashMap, error::Error as StdError}; -mod dynamodb; +pub mod either; +pub mod file_system; mod indexes; -mod s3; +pub mod s3; mod utils; pub use indexes::KV; -use crate::config; -use dynamodb::References; - -pub struct StorageUtils { - config: config::BlockStorage, -} - -#[derive(Debug)] -pub struct Repo; - -#[derive(Debug)] -pub enum BlockStores { - S3(Box), - Local(Box), -} - -#[derive(Debug)] -pub enum DataStores { - S3(Box), - Local(Box), +#[async_trait] +pub trait StorageConfig { + type Error: StdError; + async fn open(&self, orbit: &OrbitId) -> Result, Self::Error>; + async fn create(&self, orbit: &OrbitId) -> Result; } -#[derive(Debug)] -pub enum Locks { - S3(MemLock), - Local(FsLock), +#[derive(thiserror::Error, Debug)] +pub enum VecReadError { + #[error(transparent)] + Store(#[from] E), + #[error(transparent)] + Read(futures::io::Error), } -impl StorageUtils { - pub fn new(config: config::BlockStorage) -> Self { - Self { config } - } - - pub async fn healthcheck(&self) -> Result<()> { - match &self.config { - config::BlockStorage::S3(r) => { - let client = s3::S3BlockStore::new_(r.clone(), Cid::default()); - client.init().await - } - config::BlockStorage::Local(r) => { - if !r.path.is_dir() { - Err(anyhow!( - "{} does not exist or is not a directory", - r.path.to_str().unwrap() - )) - } else { - Ok(()) - } - } - } - } - - // TODO either remove this method and only rely on fetching the kp, or find a better way for S3 - pub async fn exists(&self, orbit: Cid) -> Result { - match &self.config { - config::BlockStorage::S3(_) => Ok(self.key_pair(orbit).await?.is_some()), - config::BlockStorage::Local(r) => { - let dir = r.path.join(&orbit.to_string_of_base(Base::Base58Btc)?); - Ok(dir.exists()) - } - } - } - - pub async fn relay_key_pair(config: config::BlockStorage) -> Result { - let kp = match config.clone() { - config::BlockStorage::S3(r) => { - let client = s3::new_client(r.clone()); - let res = client - .get_object() - .bucket(r.bucket.clone()) - .key("kp") - .send() - .await; - match res { - Ok(o) => Some(Ed25519Keypair::decode( - &mut o.body.collect().await?.into_bytes().to_vec(), - )?), - Err(SdkError::ServiceError { - err: - GetObjectError { - kind: GetObjectErrorKind::NoSuchKey(_), - .. - }, - .. - }) => None, - Err(e) => return Err(e.into()), - } - } - config::BlockStorage::Local(r) => { - if let Ok(mut bytes) = fs::read(r.path.join("kp")).await { - Some(Ed25519Keypair::decode(&mut bytes)?) - } else { - None - } - } - }; - if let Some(k) = kp { - Ok(k) - } else { - let kp = Ed25519Keypair::generate(); - match config { - config::BlockStorage::S3(r) => { - let client = s3::new_client(r.clone()); - client - .put_object() - .bucket(r.bucket.clone()) - .key("kp") - .body(ByteStream::new(SdkBody::from(kp.encode().to_vec()))) - .send() - .await?; - } - config::BlockStorage::Local(r) => { - fs::write(r.path.join("kp"), kp.encode()).await?; - } - }; - Ok(kp) - } - } - - pub async fn key_pair(&self, orbit: Cid) -> Result> { - match &self.config { - config::BlockStorage::S3(r) => { - let client = s3::S3DataStore::new_(r.clone(), orbit); - Ok(client - .get_("keypair".to_string()) - .await? - .map(|mut b| Ed25519Keypair::decode(&mut b)) - .transpose()?) - } - config::BlockStorage::Local(r) => { - let dir = r.path.join(&orbit.to_string_of_base(Base::Base58Btc)?); - match fs::read(dir.join("kp")).await { - Ok(mut k) => Ok(Some(Ed25519Keypair::decode(&mut k)?)), - Err(e) => match e.kind() { - std::io::ErrorKind::NotFound => Ok(None), - _ => Err(e.into()), - }, - } - } - } - } - - pub async fn orbit_id(&self, orbit: Cid) -> Result> { - match &self.config { - config::BlockStorage::S3(r) => { - let client = s3::S3DataStore::new_(r.clone(), orbit); - Ok(client - .get_("orbit_url".to_string()) - .await? - .map(String::from_utf8) - .transpose()? - .map(|b| OrbitId::from_str(&b)) - .transpose()?) - } - config::BlockStorage::Local(r) => { - let dir = r.path.join(&orbit.to_string_of_base(Base::Base58Btc)?); - match fs::read(dir.join("id")).await { - Ok(i) => Ok(Some(String::from_utf8(i)?.parse()?)), - Err(e) => match e.kind() { - std::io::ErrorKind::NotFound => Ok(None), - _ => Err(e.into()), - }, - } - } - } - } - - pub async fn setup_orbit(&self, orbit: OrbitId, kp: Ed25519Keypair, auth: &[u8]) -> Result<()> { - match &self.config { - config::BlockStorage::S3(r) => { - let client = s3::S3DataStore::new_(r.clone(), orbit.get_cid()); - client - .put_("keypair".to_string(), kp.encode().to_vec()) - .await?; - client - .put_( - "orbit_url".to_string(), - orbit.to_string().as_bytes().to_vec(), - ) - .await?; - } - config::BlockStorage::Local(r) => { - let dir = r - .path - .join(orbit.get_cid().to_string_of_base(Base::Base58Btc)?); - fs::create_dir_all(&dir) - .await - .map_err(|e| anyhow!("Couldn't create dir: {}", e))?; - - fs::write(dir.join("access_log"), auth).await?; - fs::write(dir.join("kp"), kp.encode()).await?; - fs::write(dir.join("id"), orbit.to_string()).await?; - } +/// A Store implementing content-addressed storage +/// Content is address by [Multihash][libipld::cid::multihash::Multihash] and represented as an +/// [AsyncRead][futures::io::AsyncRead]-implementing type. +#[async_trait] +pub trait ImmutableStore: Send + Sync { + type Error: StdError + Send + Sync; + type Readable: futures::io::AsyncRead + Send + Sync; + async fn contains(&self, id: &Multihash) -> Result; + async fn write( + &self, + data: impl futures::io::AsyncRead + Send, + hash_type: Code, + ) -> Result; + async fn remove(&self, id: &Multihash) -> Result, Self::Error>; + async fn read(&self, id: &Multihash) -> Result, Self::Error>; + async fn read_to_vec( + &self, + id: &Multihash, + ) -> Result>, VecReadError> + where + Self::Readable: Send, + { + use futures::io::AsyncReadExt; + let r = match self.read(id).await? { + None => return Ok(None), + Some(r) => r, }; - Ok(()) - } - - pub async fn ipfs_path(&self, orbit: Cid) -> Result { - match &self.config { - config::BlockStorage::S3(r) => Ok(PathBuf::from(&format!( - "/s3bucket/{}/s3endpoint/{}/dynamotable/{}/dynamoendpoint/{}/orbitcid/{}", - r.bucket, - r.endpoint - .as_ref() - .map(|e| e.to_string()) - .unwrap_or_default(), - r.dynamodb.table, - r.dynamodb - .endpoint - .as_ref() - .map(|e| e.to_string()) - .unwrap_or_default(), - orbit - ))), - config::BlockStorage::Local(r) => { - let path = r.path.join(orbit.to_string_of_base(Base::Base58Btc)?); - if !path.exists() { - tokio::fs::create_dir_all(&path).await?; - } - Ok(path) - } - } + let mut v = Vec::new(); + Box::pin(r) + .read_to_end(&mut v) + .await + .map_err(VecReadError::Read)?; + Ok(Some(v)) } } -impl RepoTypes for Repo { - type TBlockStore = BlockStores; - type TDataStore = DataStores; - type TLock = Locks; -} - #[async_trait] -impl BlockStore for BlockStores { - fn new(path: PathBuf) -> Self { - if path.to_str().unwrap().starts_with("/s3bucket/") { - Self::S3(Box::new(s3::S3BlockStore::new(path))) - } else { - Self::Local(Box::new(FsBlockStore::new(path))) - } - } - - async fn init(&self) -> Result<(), Error> { - match self { - Self::S3(r) => r.init().await, - Self::Local(r) => r.init().await, - } - } - - async fn open(&self) -> Result<(), Error> { - match self { - Self::S3(r) => r.open().await, - Self::Local(r) => r.open().await, - } - } - - async fn contains(&self, cid: &Cid) -> Result { - match self { - Self::S3(r) => r.contains(cid).await, - Self::Local(r) => r.contains(cid).await, - } - } - - #[instrument(name = "blocks::get", skip_all)] - async fn get(&self, cid: &Cid) -> Result, Error> { - match self { - Self::S3(r) => r.get(cid).await, - Self::Local(r) => r.get(cid).await, - } - } - - #[instrument(name = "blocks::put", skip_all)] - async fn put(&self, block: Block) -> Result<(Cid, BlockPut), Error> { - match self { - Self::S3(r) => r.put(block).await, - Self::Local(r) => r.put(block).await, - } - } - - async fn remove(&self, cid: &Cid) -> Result, Error> { - match self { - Self::S3(r) => r.remove(cid).await, - Self::Local(r) => r.remove(cid).await, - } - } - - async fn list(&self) -> Result, Error> { - match self { - Self::S3(r) => r.list().await, - Self::Local(r) => r.list().await, - } - } - - async fn wipe(&self) { - match self { - Self::S3(r) => r.wipe().await, - Self::Local(r) => r.wipe().await, - } - } +trait StoreSeek: ImmutableStore { + type Seekable: futures::io::AsyncSeek; + async fn seek(&self, id: &Cid) -> Result, Self::Error>; } #[async_trait] -impl DataStore for DataStores { - fn new(path: PathBuf) -> DataStores { - if path.to_str().unwrap().starts_with("/s3bucket/") { - Self::S3(Box::new(s3::S3DataStore::new(path))) - } else { - Self::Local(Box::new(FsDataStore::new(path))) - } - } - - async fn init(&self) -> Result<(), Error> { - match self { - Self::S3(r) => r.init().await, - Self::Local(r) => r.init().await, - } - } - - async fn open(&self) -> Result<(), Error> { - match self { - Self::S3(r) => r.open().await, - Self::Local(r) => r.open().await, - } - } - - async fn contains(&self, col: Column, key: &[u8]) -> Result { - match self { - Self::S3(r) => r.contains(col, key).await, - Self::Local(r) => r.contains(col, key).await, - } - } - - async fn get(&self, col: Column, key: &[u8]) -> Result>, Error> { - match self { - Self::S3(r) => r.get(col, key).await, - Self::Local(r) => r.get(col, key).await, - } - } - - async fn put(&self, col: Column, key: &[u8], value: &[u8]) -> Result<(), Error> { - match self { - Self::S3(r) => r.put(col, key, value).await, - Self::Local(r) => r.put(col, key, value).await, - } +impl ImmutableStore for Box +where + S: ImmutableStore + Send + Sync, +{ + type Error = S::Error; + type Readable = S::Readable; + async fn contains(&self, id: &Multihash) -> Result { + self.contains(id).await + } + async fn write( + &self, + data: impl futures::io::AsyncRead + Send, + hash_type: Code, + ) -> Result { + self.write(data, hash_type).await } - - async fn remove(&self, col: Column, key: &[u8]) -> Result<(), Error> { - match self { - Self::S3(r) => r.remove(col, key).await, - Self::Local(r) => r.remove(col, key).await, - } + async fn remove(&self, id: &Multihash) -> Result, Self::Error> { + self.remove(id).await } - - async fn wipe(&self) { - match self { - Self::S3(r) => r.wipe().await, - Self::Local(r) => r.wipe().await, - } + async fn read(&self, id: &Multihash) -> Result, Self::Error> { + self.read(id).await } } #[async_trait] -impl PinStore for DataStores { - async fn is_pinned(&self, cid: &Cid) -> Result { - match self { - Self::S3(r) => r.is_pinned(cid).await, - Self::Local(r) => r.is_pinned(cid).await, - } - } - - async fn insert_direct_pin(&self, target: &Cid) -> Result<(), Error> { - match self { - Self::S3(r) => r.insert_direct_pin(target).await, - Self::Local(r) => r.insert_direct_pin(target).await, - } - } - - async fn insert_recursive_pin( - &self, - target: &Cid, - referenced: References<'_>, - ) -> Result<(), Error> { - match self { - Self::S3(r) => r.insert_recursive_pin(target, referenced).await, - Self::Local(r) => r.insert_recursive_pin(target, referenced).await, - } - } - - async fn remove_direct_pin(&self, target: &Cid) -> Result<(), Error> { - match self { - Self::S3(r) => r.remove_direct_pin(target).await, - Self::Local(r) => r.remove_direct_pin(target).await, - } - } - - async fn remove_recursive_pin( - &self, - target: &Cid, - referenced: References<'_>, - ) -> Result<(), Error> { - match self { - Self::S3(r) => r.remove_recursive_pin(target, referenced).await, - Self::Local(r) => r.remove_recursive_pin(target, referenced).await, - } - } - - async fn list( +trait IdempotentHeightGroup { + // write a height value for a Cid + // should error if given value already exists + // if successful, marks a Cid as 'fresh' + async fn see(&self, id: impl IntoIterator) -> Result<(), Error>; + // mark a Cid as no longer 'fresh' + async fn stale(&self, id: impl IntoIterator) -> Result<(), Error>; + // return 'fresh' Cids and their heights + async fn fresh(&self) -> Result, Error>; + // return the heights of any Cids + async fn height<'a>( &self, - requirement: Option, - ) -> futures::stream::BoxStream<'static, Result<(Cid, PinMode), Error>> { - match self { - Self::S3(r) => r.list(requirement).await, - Self::Local(r) => r.list(requirement).await, - } - } - - async fn query( - &self, - ids: Vec, - requirement: Option, - ) -> Result)>, Error> { - match self { - Self::S3(r) => r.query(ids, requirement).await, - Self::Local(r) => r.query(ids, requirement).await, - } - } -} - -impl Lock for Locks { - fn new(path: PathBuf) -> Self { - if path.to_str().unwrap().starts_with("/s3bucket/") { - Self::S3(MemLock::new(path)) - } else { - Self::Local(FsLock::new(path)) - } - } - - fn try_exclusive(&mut self) -> Result<(), LockError> { - match self { - Self::S3(r) => r.try_exclusive(), - Self::Local(r) => r.try_exclusive(), - } - } + id: impl IntoIterator, + ) -> Result, Error>; } diff --git a/src/storage/s3.rs b/src/storage/s3.rs index b1f7c665..feec6f97 100644 --- a/src/storage/s3.rs +++ b/src/storage/s3.rs @@ -1,84 +1,140 @@ -use anyhow::{Context, Error}; use aws_sdk_s3::{ - error::{GetObjectError, GetObjectErrorKind}, + error::{ + GetObjectError, GetObjectErrorKind, HeadObjectError, HeadObjectErrorKind, PutObjectError, + }, types::{ByteStream, SdkError}, Client, // Config, + Error as S3Error, +}; +use aws_smithy_http::{body::SdkBody, byte_stream::Error as ByteStreamError, endpoint::Endpoint}; +use futures::{ + io::AllowStdIo, + stream::{IntoAsyncRead, MapErr, TryStreamExt}, }; -use aws_smithy_http::{body::SdkBody, endpoint::Endpoint}; -// use aws_types::{credentials::Credentials, region::Region}; -use futures::stream::{StreamExt, TryStreamExt}; -use ipfs::{ - repo::{ - BlockPut, BlockRm, BlockRmError, BlockStore, Column, DataStore, PinKind, PinMode, PinStore, +use kepler_lib::{ + libipld::cid::{ + multibase::{encode, Base}, + multihash::{Code, Error as MultihashError, Multihash}, + Cid, }, - Block, + resource::OrbitId, }; -use kepler_lib::libipld::cid::{multibase::Base, Cid}; -use regex::Regex; +use libp2p::identity::{ed25519::Keypair as Ed25519Keypair, error::DecodingError}; use rocket::{async_trait, http::hyper::Uri}; -use std::{path::PathBuf, str::FromStr}; - -use super::dynamodb::{DynamoPinStore, References}; -use crate::config; - -#[derive(Debug)] -pub struct S3DataStore { - // TODO Remove is unused (orbit::delete is never called). - // When that changes we will need to use a mutex, either local or in Dynamo - pub client: Client, - pub bucket: String, - pub dynamodb: DynamoPinStore, - pub orbit: Cid, -} +use serde::{Deserialize, Serialize}; +use serde_with::{serde_as, DisplayFromStr}; +use std::io::Error as IoError; +use tempfile::NamedTempFile; + +use crate::{ + orbit::ProviderUtils, + storage::{utils::copy_in, ImmutableStore, StorageConfig}, +}; // TODO we could use the same struct for both the block store and the data // (pin) store, but we need to remember that for now it will be two different // objects in rust-ipfs -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct S3BlockStore { // TODO Remove is unused (orbit::delete is never called). // When that changes we will need to use a mutex, either local or in Dynamo pub client: Client, pub bucket: String, - pub dynamodb: DynamoPinStore, - pub orbit: Cid, + pub orbit: String, } -pub fn new_client(config: config::S3BlockStorage) -> Client { - let general_config = super::utils::aws_config(); - let sdk_config = aws_sdk_s3::config::Builder::from(&general_config); - let sdk_config = match config.endpoint { - Some(e) => sdk_config.endpoint_resolver(Endpoint::immutable(e)), - None => sdk_config, - }; - let sdk_config = sdk_config.build(); - Client::from_conf(sdk_config) +#[serde_as] +#[derive(Serialize, Deserialize, Debug, Clone, Hash, PartialEq, Eq)] +pub struct S3BlockConfig { + pub bucket: String, + #[serde_as(as = "Option")] + #[serde(default)] + pub endpoint: Option, } -impl S3DataStore { - pub fn new_(config: config::S3BlockStorage, orbit: Cid) -> Self { - S3DataStore { - client: new_client(config.clone()), - bucket: config.bucket, - dynamodb: DynamoPinStore::new(config.dynamodb, orbit), - orbit, - } +#[async_trait] +impl StorageConfig for S3BlockConfig { + type Error = std::convert::Infallible; + async fn open(&self, orbit: &OrbitId) -> Result, Self::Error> { + Ok(Some(S3BlockStore::new_(self, orbit.get_cid()))) + } + async fn create(&self, orbit: &OrbitId) -> Result { + Ok(S3BlockStore::new_(self, orbit.get_cid())) + } +} + +#[derive(thiserror::Error, Debug)] +pub enum ProviderError { + #[error(transparent)] + S3(#[from] S3Error), + #[error(transparent)] + KeypairDecode(#[from] DecodingError), + #[error(transparent)] + ByteStream(#[from] ByteStreamError), +} + +impl From> for ProviderError { + fn from(e: SdkError) -> Self { + Self::S3(e.into()) } +} - pub async fn get_(&self, key: String) -> Result>, Error> { - let res = self - .client +impl From> for ProviderError { + fn from(e: SdkError) -> Self { + Self::S3(e.into()) + } +} + +#[async_trait] +impl ProviderUtils for S3BlockConfig { + type Error = ProviderError; + async fn exists(&self, orbit: &OrbitId) -> Result { + self.key_pair(orbit).await.map(|o| o.is_some()) + } + async fn relay_key_pair(&self) -> Result { + let client = new_client(self); + match client .get_object() - .bucket(self.bucket.clone()) - .key(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - key - )) + .bucket(&self.bucket) + .key("kp") .send() - .await; - match res { - Ok(o) => Ok(Some(o.body.collect().await?.into_bytes().to_vec())), + .await + { + Ok(o) => Ok(Ed25519Keypair::decode( + &mut o.body.collect().await?.into_bytes().to_vec(), + )?), + Err(SdkError::ServiceError { + err: + GetObjectError { + kind: GetObjectErrorKind::NoSuchKey(_), + .. + }, + .. + }) => { + let kp = Ed25519Keypair::generate(); + client + .put_object() + .bucket(&self.bucket) + .key("kp") + .body(ByteStream::new(SdkBody::from(kp.encode().to_vec()))) + .send() + .await?; + Ok(kp) + } + Err(e) => Err(e.into()), + } + } + async fn key_pair(&self, orbit: &OrbitId) -> Result, Self::Error> { + match new_client(self) + .get_object() + .bucket(&self.bucket) + .key(format!("{}/keypair", orbit.get_cid())) + .send() + .await + { + Ok(o) => Ok(Some(Ed25519Keypair::decode( + &mut o.body.collect().await?.into_bytes().to_vec(), + )?)), Err(SdkError::ServiceError { err: GetObjectError { @@ -90,105 +146,142 @@ impl S3DataStore { Err(e) => Err(e.into()), } } - - pub async fn put_(&self, key: String, body: Vec) -> Result<(), Error> { - self.client + async fn setup_orbit(&self, orbit: &OrbitId, key: &Ed25519Keypair) -> Result<(), Self::Error> { + let client = new_client(self); + client .put_object() - .bucket(self.bucket.clone()) - .key(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - key - )) - .body(ByteStream::new(SdkBody::from(body))) + .bucket(&self.bucket) + .key(format!("{}/keypair", orbit.get_cid())) + .body(ByteStream::new(SdkBody::from(key.encode().to_vec()))) + .send() + .await?; + client + .put_object() + .bucket(&self.bucket) + .key(format!("{}/orbit_url", orbit.get_cid())) + .body(ByteStream::new(SdkBody::from(orbit.to_string()))) .send() .await?; Ok(()) } } + +pub fn new_client(config: &S3BlockConfig) -> Client { + let general_config = super::utils::aws_config(); + let sdk_config = aws_sdk_s3::config::Builder::from(&general_config); + let sdk_config = match &config.endpoint { + Some(e) => sdk_config.endpoint_resolver(Endpoint::immutable(e.clone())), + None => sdk_config, + }; + let sdk_config = sdk_config.build(); + Client::from_conf(sdk_config) +} + impl S3BlockStore { - pub fn new_(config: config::S3BlockStorage, orbit: Cid) -> Self { + pub fn new_(config: &S3BlockConfig, orbit: Cid) -> Self { S3BlockStore { - client: new_client(config.clone()), - bucket: config.bucket, - dynamodb: DynamoPinStore::new(config.dynamodb, orbit), - orbit, + client: new_client(config), + bucket: config.bucket.clone(), + orbit: orbit.to_string(), } } + + fn key(&self, id: &Multihash) -> String { + format!("{}/{}", self.orbit, encode(Base::Base64Url, &id.to_bytes())) + } } -fn path_to_config(path: PathBuf) -> (config::S3BlockStorage, Cid) { - let re = - Regex::new(r"^/s3bucket/(?P.*)/s3endpoint/(?P.*)/dynamotable/(?P.*)/dynamoendpoint/(?P.*)/orbitcid/(?P.*)/(blockstore|datastore)$") - .unwrap(); - let fields = re.captures(path.to_str().unwrap()).unwrap(); - let s3_bucket = fields.name("bucket").unwrap().as_str().to_string(); - let s3_endpoint = Some(fields.name("s3endpoint").unwrap().as_str()) - .filter(|s| !s.is_empty()) - .map(|e| Uri::from_str(e).unwrap()); - let dynamo_table = fields.name("table").unwrap().as_str().to_string(); - let dynamo_endpoint = Some(fields.name("dynamoendpoint").unwrap().as_str()) - .filter(|s| !s.is_empty()) - .map(|e| Uri::from_str(e).unwrap()); - let orbit = Cid::from_str(fields.name("orbit").unwrap().as_str()).unwrap(); +pub fn convert(e: ByteStreamError) -> IoError { + e.into() +} - let config = config::S3BlockStorage { - bucket: s3_bucket, - endpoint: s3_endpoint, - dynamodb: config::DynamoStorage { - table: dynamo_table, - endpoint: dynamo_endpoint, - }, - }; - (config, orbit) +#[derive(thiserror::Error, Debug)] +pub enum S3StoreError { + #[error(transparent)] + S3(#[from] S3Error), + #[error(transparent)] + Io(#[from] IoError), + #[error(transparent)] + Bytestream(#[from] ByteStreamError), + #[error(transparent)] + Multihash(#[from] MultihashError), } #[async_trait] -impl BlockStore for S3BlockStore { - fn new(path: PathBuf) -> Self { - let (config, orbit) = path_to_config(path); - S3BlockStore::new_(config, orbit) +impl ImmutableStore for S3BlockStore { + type Error = S3StoreError; + type Readable = IntoAsyncRead IoError>>; + async fn contains(&self, id: &Multihash) -> Result { + match self + .client + .head_object() + .bucket(&self.bucket) + .key(self.key(id)) + .send() + .await + { + Ok(_) => Ok(true), + Err(SdkError::ServiceError { + err: + HeadObjectError { + kind: HeadObjectErrorKind::NotFound(_), + .. + }, + .. + }) => Ok(false), + Err(e) => Err(S3Error::from(e).into()), + } } + async fn write( + &self, + data: impl futures::io::AsyncRead + Send, + hash_type: Code, + ) -> Result { + // TODO find a way to do this without filesystem access + let (multihash, file) = + copy_in(data, AllowStdIo::new(NamedTempFile::new()?), hash_type).await?; + + let (_, path) = file.into_inner().into_parts(); - async fn init(&self) -> Result<(), Error> { - self.dynamodb - .healthcheck() - .await - .context("Failed healthcheck for DynamoDB")?; self.client - .head_bucket() - .bucket(self.bucket.clone()) + .put_object() + .bucket(&self.bucket) + .key(self.key(&multihash)) + // TODO deprecated but also doesnt require a path + .body(ByteStream::from_path(&path).await?) .send() .await - .context("Failed healthcheck for S3")?; - Ok(()) - } - - async fn open(&self) -> Result<(), Error> { - Ok(()) + .map_err(S3Error::from)?; + Ok(multihash) } - - async fn contains(&self, cid: &Cid) -> Result { - self.dynamodb.is_pinned(cid).await + async fn remove(&self, id: &Multihash) -> Result, Self::Error> { + match self + .client + .delete_object() + .bucket(&self.bucket) + .key(self.key(id)) + .send() + .await + { + Ok(_) => Ok(Some(())), + // TODO does this distinguish between object missing and object present? + Err(e) => Err(S3Error::from(e).into()), + } } - - async fn get(&self, cid: &Cid) -> Result, Error> { + async fn read(&self, id: &Multihash) -> Result, Self::Error> { let res = self .client .get_object() - .bucket(self.bucket.clone()) - .key(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - cid - )) + .bucket(&self.bucket) + .key(self.key(id)) .send() .await; match res { - Ok(o) => Ok(Some(Block::new( - *cid, - o.body.collect().await?.into_bytes().to_vec(), - )?)), + Ok(o) => Ok(Some( + o.body + .map_err(convert as fn(ByteStreamError) -> IoError) + .into_async_read(), + )), Err(SdkError::ServiceError { err: GetObjectError { @@ -197,159 +290,7 @@ impl BlockStore for S3BlockStore { }, .. }) => Ok(None), - Err(e) => Err(e.into()), - } - } - - async fn put(&self, block: Block) -> Result<(Cid, BlockPut), Error> { - let res = self - .client - .put_object() - .bucket(self.bucket.clone()) - .key(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - block.cid() - )) - .body(ByteStream::new(SdkBody::from(block.data()))) - .send() - .await; - - match res { - // can't tell if the object already existed - Ok(_) => Ok((*block.cid(), BlockPut::NewBlock)), - Err(e) => Err(e.into()), + Err(e) => Err(S3Error::from(e).into()), } } - - async fn remove(&self, cid: &Cid) -> Result, Error> { - // TODO when is that called, should the pin store call this? - let res = self - .client - .delete_object() - .bucket(self.bucket.clone()) - .key(format!( - "{}/{}", - self.orbit.to_string_of_base(Base::Base58Btc)?, - cid - )) - .send() - .await; - - match res { - // Cannot tell if the object existed in the first place. - Ok(_) => Ok(Ok(BlockRm::Removed(*cid))), - Err(e) => Err(e.into()), - } - } - - async fn list(&self) -> Result, Error> { - self.dynamodb - .list(None) - .await - .map(|r| r.map(|rr| rr.0)) - .try_collect() - .await - } - - async fn wipe(&self) { - unimplemented!("wipe") - } -} - -#[async_trait] -impl DataStore for S3DataStore { - fn new(path: PathBuf) -> S3DataStore { - let (config, orbit) = path_to_config(path); - S3DataStore::new_(config, orbit) - } - - async fn init(&self) -> Result<(), Error> { - self.dynamodb.healthcheck().await?; - self.client - .head_bucket() - .bucket(self.bucket.clone()) - .send() - .await?; - Ok(()) - } - - async fn open(&self) -> Result<(), Error> { - Ok(()) - } - - // None of those methods are implemented for Sled of Fs data stores 🤡 - - async fn contains(&self, _col: Column, _key: &[u8]) -> Result { - Err(anyhow::anyhow!("not implemented")) - } - - async fn get(&self, _col: Column, _key: &[u8]) -> Result>, Error> { - Err(anyhow::anyhow!("not implemented")) - } - - async fn put(&self, _col: Column, _key: &[u8], _value: &[u8]) -> Result<(), Error> { - Err(anyhow::anyhow!("not implemented")) - } - - async fn remove(&self, _col: Column, _key: &[u8]) -> Result<(), Error> { - Err(anyhow::anyhow!("not implemented")) - } - - async fn wipe(&self) { - todo!() - } -} - -#[async_trait] -impl PinStore for S3DataStore { - async fn is_pinned(&self, _cid: &Cid) -> Result { - // self.dynamodb.is_pinned(cid).await - unimplemented!("Unused (so untested)"); - } - - async fn insert_direct_pin(&self, _target: &Cid) -> Result<(), Error> { - // self.dynamodb.insert_direct_pin(target).await - unimplemented!("Unused (so untested)"); - } - - async fn insert_recursive_pin( - &self, - _target: &Cid, - _referenced: References<'_>, - ) -> Result<(), Error> { - // self.dynamodb.insert_recursive_pin(target, referenced).await - unimplemented!("Unused (so untested)"); - } - - async fn remove_direct_pin(&self, _target: &Cid) -> Result<(), Error> { - // self.dynamodb.remove_direct_pin(target).await - unimplemented!("Unused (so untested)"); - } - - async fn remove_recursive_pin( - &self, - _target: &Cid, - _referenced: References<'_>, - ) -> Result<(), Error> { - // self.dynamodb.remove_recursive_pin(target, referenced).await - unimplemented!("Unused (so untested)"); - } - - async fn list( - &self, - _requirement: Option, - ) -> futures::stream::BoxStream<'static, Result<(Cid, PinMode), Error>> { - // self.dynamodb.list(requirement).await - unimplemented!("Unused (so untested)"); - } - - async fn query( - &self, - _ids: Vec, - _requirement: Option, - ) -> Result)>, Error> { - // self.dynamodb.query(ids, requirement).await - unimplemented!("Unused (so untested)"); - } } diff --git a/src/storage/utils.rs b/src/storage/utils.rs index 410dc384..f04c5594 100644 --- a/src/storage/utils.rs +++ b/src/storage/utils.rs @@ -1,6 +1,96 @@ use aws_types::sdk_config::SdkConfig; -use futures::executor::block_on; +use core::pin::Pin; +use futures::{ + executor::block_on, + io::{copy, AsyncRead, AsyncWrite, AsyncWriteExt}, + task::{Context, Poll}, +}; +use libipld::cid::multihash::{ + Blake2b256, Blake2b512, Blake2s128, Blake2s256, Blake3_256, Code, Error as MultihashError, + Hasher, Keccak224, Keccak256, Keccak384, Keccak512, Multihash, MultihashDigest, Sha2_256, + Sha2_512, Sha3_224, Sha3_256, Sha3_384, Sha3_512, +}; +use pin_project::pin_project; +use std::io::Error as IoError; pub fn aws_config() -> SdkConfig { block_on(async { aws_config::from_env().load().await }) } + +#[pin_project] +#[derive(Debug, Clone)] +pub struct HashBuffer { + #[pin] + buffer: B, + hasher: H, +} + +impl HashBuffer { + pub fn into_inner(self) -> (H, B) { + (self.hasher, self.buffer) + } +} + +impl HashBuffer +where + H: Default, +{ + pub fn new(buffer: B) -> Self { + Self { + buffer, + hasher: H::default(), + } + } +} + +macro_rules! write_with_multihash { + ($data:ident, $buffer:ident, $code:ident, $($hashes:ident),*) => { + match $code { + $(Code::$hashes => { + let mut hb = HashBuffer::<$hashes, B>::new($buffer); + copy($data, &mut hb).await?; + hb.flush().await?; + let (mut h, b) = hb.into_inner(); + Ok((Code::$hashes.wrap(h.finalize())?, b)) + },)* + c => Err(MultihashError::UnsupportedCode(c.into())) + } + }; +} + +pub async fn copy_in( + data: impl AsyncRead, + buffer: B, + hash_type: Code, +) -> Result<(Multihash, B), MultihashError> +where + B: AsyncWrite + Unpin, +{ + write_with_multihash!( + data, buffer, hash_type, Sha2_256, Sha2_512, Sha3_224, Sha3_256, Sha3_384, Sha3_512, + Keccak224, Keccak256, Keccak384, Keccak512, Blake2b256, Blake2b512, Blake2s128, Blake2s256, + Blake3_256 + ) +} + +impl AsyncWrite for HashBuffer +where + H: Hasher, + B: AsyncWrite, +{ + fn poll_write( + self: Pin<&mut Self>, + cx: &mut Context<'_>, + buf: &[u8], + ) -> Poll> { + let p = self.project(); + p.hasher.update(buf); + p.buffer.poll_write(cx, buf) + } + fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + self.project().buffer.poll_flush(cx) + } + fn poll_close(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { + self.project().buffer.poll_close(cx) + } +} diff --git a/src/transport.rs b/src/transport.rs index b4dd0c29..28e3e299 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -3,8 +3,10 @@ use std::{ future::{ready, Ready}, }; -use ipfs::PeerId; -use libp2p::{core::Endpoint, noise::NoiseError}; +use libp2p::{ + core::{Endpoint, PeerId}, + noise::NoiseError, +}; pub fn auth_mapper( i: I, @@ -39,136 +41,136 @@ pub enum AuthError { #[cfg(test)] mod test { - use std::convert::TryFrom; - - use crate::{config, ipfs::create_ipfs, relay::test::test_relay}; - use ipfs::{MultiaddrWithoutPeerId, Protocol}; - use kepler_lib::libipld::Cid; - use libp2p::identity::Keypair; - use std::str::FromStr; - use tempdir::TempDir; - - #[tokio::test] - async fn authorised() -> anyhow::Result<()> { - let id = - Cid::from_str("bafkreieq5jui4j25lacwomsqgjeswwl3y5zcdrresptwgmfylxo2depppq").unwrap(); - let temp_dir = TempDir::new(&id.to_string())?; - let relay = test_relay().await?; - - let alice_keypair = Keypair::generate_ed25519(); - let alice_peer_id = alice_keypair.public().to_peer_id(); - let alice_path = temp_dir.path().join("alice"); - let bob_keypair = Keypair::generate_ed25519(); - let bob_peer_id = bob_keypair.public().to_peer_id(); - let bob_path = temp_dir.path().join("bob"); - let alice_config = config::Config { - storage: config::Storage { - blocks: config::BlockStorage::Local(config::LocalBlockStorage { - path: alice_path.clone(), - }), - indexes: config::IndexStorage::Local(config::LocalIndexStorage { - path: alice_path.clone(), - }), - }, - ..Default::default() - }; - let bob_config = config::Config { - storage: config::Storage { - blocks: config::BlockStorage::Local(config::LocalBlockStorage { - path: bob_path.clone(), - }), - indexes: config::IndexStorage::Local(config::LocalIndexStorage { - path: bob_path.clone(), - }), - }, - ..Default::default() - }; - - let (alice, ipfs_task, _alice_behaviour_process) = - create_ipfs(id, &alice_config, alice_keypair, vec![bob_peer_id]).await?; - tokio::task::spawn(ipfs_task); - let (bob, ipfs_task, _bob_behaviour_process) = - create_ipfs(id, &bob_config, bob_keypair, vec![]).await?; - tokio::task::spawn(ipfs_task); - - alice - .connect(MultiaddrWithoutPeerId::try_from(relay.internal())?.with(relay.id)) - .await?; - - bob.connect( - MultiaddrWithoutPeerId::try_from( - relay - .external() - .with(Protocol::P2p(relay.id.into())) - .with(Protocol::P2pCircuit), - )? - .with(alice_peer_id), - ) - .await - .expect("authorised peer (bob) could not connect to alice"); - - Ok(()) - } - - #[tokio::test] - async fn unauthorised() -> anyhow::Result<()> { - let id = - Cid::from_str("bafkreieq5jui4j25lacwomsqgjeswwl3y5zcdrresptwgmfylxo2depppq").unwrap(); - let temp_dir = TempDir::new(&id.to_string())?; - let relay = test_relay().await?; - - let alice_keypair = Keypair::generate_ed25519(); - let alice_peer_id = alice_keypair.public().to_peer_id(); - let alice_path = temp_dir.path().join("alice"); - let bob_keypair = Keypair::generate_ed25519(); - let _bob_peer_id = bob_keypair.public().to_peer_id(); - let bob_path = temp_dir.path().join("bob"); - let alice_config = config::Config { - storage: config::Storage { - blocks: config::BlockStorage::Local(config::LocalBlockStorage { - path: alice_path.clone(), - }), - indexes: config::IndexStorage::Local(config::LocalIndexStorage { - path: alice_path.clone(), - }), - }, - ..Default::default() - }; - let bob_config = config::Config { - storage: config::Storage { - blocks: config::BlockStorage::Local(config::LocalBlockStorage { - path: bob_path.clone(), - }), - indexes: config::IndexStorage::Local(config::LocalIndexStorage { - path: bob_path.clone(), - }), - }, - ..Default::default() - }; - - let (alice, ipfs_task, _alice_behaviour_process) = - create_ipfs(id, &alice_config, alice_keypair, vec![]).await?; - tokio::task::spawn(ipfs_task); - let (bob, ipfs_task, _bob_behaviour_process) = - create_ipfs(id, &bob_config, bob_keypair, vec![]).await?; - tokio::task::spawn(ipfs_task); - - alice - .connect(MultiaddrWithoutPeerId::try_from(relay.internal())?.with(relay.id)) - .await?; - - bob.connect( - MultiaddrWithoutPeerId::try_from( - relay - .external() - .with(Protocol::P2p(relay.id.into())) - .with(Protocol::P2pCircuit), - )? - .with(alice_peer_id), - ) - .await - .expect_err("unauthorised peer (bob) connected to alice"); - - Ok(()) - } + // use std::convert::TryFrom; + + // use crate::{config, ipfs::create_ipfs, relay::test::test_relay}; + // use ipfs::multiaddr::Protocol; + // use kepler_lib::libipld::Cid; + // use libp2p::identity::Keypair; + // use std::str::FromStr; + // use tempfile::TempDir; + + // #[tokio::test] + // async fn authorised() -> anyhow::Result<()> { + // let id = + // Cid::from_str("bafkreieq5jui4j25lacwomsqgjeswwl3y5zcdrresptwgmfylxo2depppq").unwrap(); + // let temp_dir = tempfile::new(&id.to_string())?; + // let relay = test_relay().await?; + + // let alice_keypair = Keypair::generate_ed25519(); + // let alice_peer_id = alice_keypair.public().to_peer_id(); + // let alice_path = temp_dir.path().join("alice"); + // let bob_keypair = Keypair::generate_ed25519(); + // let bob_peer_id = bob_keypair.public().to_peer_id(); + // let bob_path = temp_dir.path().join("bob"); + // let alice_config = config::Config { + // storage: config::Storage { + // blocks: config::BlockStorage::Local(config::LocalBlockStorage { + // path: alice_path.clone(), + // }), + // indexes: config::IndexStorage::Local(config::LocalIndexStorage { + // path: alice_path.clone(), + // }), + // }, + // ..Default::default() + // }; + // let bob_config = config::Config { + // storage: config::Storage { + // blocks: config::BlockStorage::Local(config::LocalBlockStorage { + // path: bob_path.clone(), + // }), + // indexes: config::IndexStorage::Local(config::LocalIndexStorage { + // path: bob_path.clone(), + // }), + // }, + // ..Default::default() + // }; + + // let (alice, ipfs_task, _alice_behaviour_process) = + // create_ipfs(id, &alice_config, alice_keypair, vec![bob_peer_id]).await?; + // tokio::task::spawn(ipfs_task); + // let (bob, ipfs_task, _bob_behaviour_process) = + // create_ipfs(id, &bob_config, bob_keypair, vec![]).await?; + // tokio::task::spawn(ipfs_task); + + // alice + // .connect(MultiaddrWithoutPeerId::try_from(relay.internal())?.with(relay.id)) + // .await?; + + // bob.connect( + // MultiaddrWithoutPeerId::try_from( + // relay + // .external() + // .with(Protocol::P2p(relay.id.into())) + // .with(Protocol::P2pCircuit), + // )? + // .with(alice_peer_id), + // ) + // .await + // .expect("authorised peer (bob) could not connect to alice"); + + // Ok(()) + // } + + // #[tokio::test] + // async fn unauthorised() -> anyhow::Result<()> { + // let id = + // Cid::from_str("bafkreieq5jui4j25lacwomsqgjeswwl3y5zcdrresptwgmfylxo2depppq").unwrap(); + // let temp_dir = tempfile::new(&id.to_string())?; + // let relay = test_relay().await?; + + // let alice_keypair = Keypair::generate_ed25519(); + // let alice_peer_id = alice_keypair.public().to_peer_id(); + // let alice_path = temp_dir.path().join("alice"); + // let bob_keypair = Keypair::generate_ed25519(); + // let _bob_peer_id = bob_keypair.public().to_peer_id(); + // let bob_path = temp_dir.path().join("bob"); + // let alice_config = config::Config { + // storage: config::Storage { + // blocks: config::BlockStorage::Local(config::LocalBlockStorage { + // path: alice_path.clone(), + // }), + // indexes: config::IndexStorage::Local(config::LocalIndexStorage { + // path: alice_path.clone(), + // }), + // }, + // ..Default::default() + // }; + // let bob_config = config::Config { + // storage: config::Storage { + // blocks: config::BlockStorage::Local(config::LocalBlockStorage { + // path: bob_path.clone(), + // }), + // indexes: config::IndexStorage::Local(config::LocalIndexStorage { + // path: bob_path.clone(), + // }), + // }, + // ..Default::default() + // }; + + // let (alice, ipfs_task, _alice_behaviour_process) = + // create_ipfs(id, &alice_config, alice_keypair, vec![]).await?; + // tokio::task::spawn(ipfs_task); + // let (bob, ipfs_task, _bob_behaviour_process) = + // create_ipfs(id, &bob_config, bob_keypair, vec![]).await?; + // tokio::task::spawn(ipfs_task); + + // alice + // .connect(MultiaddrWithoutPeerId::try_from(relay.internal())?.with(relay.id)) + // .await?; + + // bob.connect( + // MultiaddrWithoutPeerId::try_from( + // relay + // .external() + // .with(Protocol::P2p(relay.id.into())) + // .with(Protocol::P2pCircuit), + // )? + // .with(alice_peer_id), + // ) + // .await + // .expect_err("unauthorised peer (bob) connected to alice"); + + // Ok(()) + // } } diff --git a/test/load/signer/Cargo.toml b/test/load/signer/Cargo.toml index 7869f1e2..18f75d33 100644 --- a/test/load/signer/Cargo.toml +++ b/test/load/signer/Cargo.toml @@ -7,7 +7,6 @@ edition = "2021" [dependencies] axum = "0.5.6" -chrono = "0.4.19" ethers = "0.6.2" iri-string = "0.4" kepler-lib = { path = "../../../lib" }