From 7c38e538395aff4eea227f619a712bd0a6327532 Mon Sep 17 00:00:00 2001 From: Devin R Date: Sun, 21 Jun 2020 15:58:42 -0400 Subject: [PATCH 01/14] Move to depend on ruma monorepo and ruma-events0.22 --- Cargo.lock | 2487 ---------------------------------- Cargo.toml | 12 +- src/client_server.rs | 257 ++-- src/database/account_data.rs | 2 +- src/database/globals.rs | 21 +- src/database/rooms.rs | 6 +- src/database/rooms/edus.rs | 4 +- src/database/users.rs | 2 +- src/error.rs | 5 + src/pdu.rs | 19 +- 10 files changed, 176 insertions(+), 2639 deletions(-) delete mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock deleted file mode 100644 index 07f6826..0000000 --- a/Cargo.lock +++ /dev/null @@ -1,2487 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -[[package]] -name = "addr2line" -version = "0.12.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602d785912f476e480434627e8732e6766b760c045bbf897d9dfaa9f4fbd399c" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler32" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" - -[[package]] -name = "aead" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "aes" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" -dependencies = [ - "aes-soft", - "aesni", - "block-cipher-trait", -] - -[[package]] -name = "aes-gcm" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" -dependencies = [ - "aead", - "aes", - "block-cipher-trait", - "ghash", - "subtle 2.2.3", - "zeroize", -] - -[[package]] -name = "aes-soft" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" -dependencies = [ - "block-cipher-trait", - "byteorder", - "opaque-debug", -] - -[[package]] -name = "aesni" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" -dependencies = [ - "block-cipher-trait", - "opaque-debug", -] - -[[package]] -name = "arc-swap" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" - -[[package]] -name = "async-trait" -version = "0.1.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "atomic" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f46ca51dca4837f1520754d1c8c36636356b81553d928dc9c177025369a06e" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "autocfg" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" - -[[package]] -name = "backtrace" -version = "0.3.49" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05100821de9e028f12ae3d189176b41ee198341eb8f369956407fea2f5cc666c" -dependencies = [ - "addr2line", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base-x" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" - -[[package]] -name = "base64" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" -dependencies = [ - "byteorder", -] - -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - -[[package]] -name = "base64" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" - -[[package]] -name = "binascii" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" - -[[package]] -name = "bitflags" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" - -[[package]] -name = "blake2b_simd" -version = "0.5.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq", -] - -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", -] - -[[package]] -name = "block-cipher-trait" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - -[[package]] -name = "bumpalo" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" - -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - -[[package]] -name = "bytemuck" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431" - -[[package]] -name = "byteorder" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" - -[[package]] -name = "bytes" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" -dependencies = [ - "loom", -] - -[[package]] -name = "cc" -version = "1.0.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1be3409f94d7bdceeb5f5fac551039d9b3f00e25da7a74fc4d33400a0d96368" - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags", -] - -[[package]] -name = "color_quant" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" - -[[package]] -name = "conduit" -version = "0.1.0" -dependencies = [ - "base64 0.12.3", - "directories", - "http", - "image", - "js_int", - "log", - "rand", - "reqwest", - "rocket", - "ruma", - "rust-argon2 0.8.2", - "serde", - "serde_json", - "sled", - "thiserror", - "tokio", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "cookie" -version = "0.14.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca761767cf3fa9068cc893ec8c247a22d0fd0535848e65640c0548bd1f8bbb36" -dependencies = [ - "aes-gcm", - "base64 0.12.3", - "hkdf", - "percent-encoding 2.1.0", - "rand", - "sha2", - "time 0.2.16", -] - -[[package]] -name = "core-foundation" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" - -[[package]] -name = "crc32fast" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if", - "lazy_static", -] - -[[package]] -name = "crypto-mac" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" -dependencies = [ - "generic-array", - "subtle 1.0.0", -] - -[[package]] -name = "deflate" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" -dependencies = [ - "adler32", - "byteorder", -] - -[[package]] -name = "devise" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" -dependencies = [ - "devise_codegen", - "devise_core", -] - -[[package]] -name = "devise_codegen" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" -dependencies = [ - "devise_core", - "quote 1.0.7", -] - -[[package]] -name = "devise_core" -version = "0.3.0" -source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" -dependencies = [ - "bitflags", - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array", -] - -[[package]] -name = "directories" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c" -dependencies = [ - "cfg-if", - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" -dependencies = [ - "libc", - "redox_users", - "winapi 0.3.9", -] - -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - -[[package]] -name = "dtoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" - -[[package]] -name = "encoding_rs" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "fs2" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" - -[[package]] -name = "futures-executor" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" - -[[package]] -name = "futures-macro" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" -dependencies = [ - "proc-macro-hack", - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "futures-sink" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" - -[[package]] -name = "futures-task" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" -dependencies = [ - "once_cell", -] - -[[package]] -name = "futures-util" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project", - "pin-utils", - "proc-macro-hack", - "proc-macro-nested", - "slab", -] - -[[package]] -name = "fxhash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" -dependencies = [ - "byteorder", -] - -[[package]] -name = "generator" -version = "0.6.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" -dependencies = [ - "cc", - "libc", - "log", - "rustc_version", - "winapi 0.3.9", -] - -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -dependencies = [ - "typenum", -] - -[[package]] -name = "getrandom" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" -dependencies = [ - "cfg-if", - "libc", - "wasi", -] - -[[package]] -name = "ghash" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" -dependencies = [ - "polyval", -] - -[[package]] -name = "gif" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" -dependencies = [ - "color_quant", - "lzw", -] - -[[package]] -name = "gimli" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" - -[[package]] -name = "glob" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" - -[[package]] -name = "h2" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "log", - "slab", - "tokio", - "tokio-util", -] - -[[package]] -name = "heck" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" -dependencies = [ - "unicode-segmentation", -] - -[[package]] -name = "hermit-abi" -version = "0.1.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" -dependencies = [ - "libc", -] - -[[package]] -name = "hkdf" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" -dependencies = [ - "digest", - "hmac", -] - -[[package]] -name = "hmac" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" -dependencies = [ - "crypto-mac", - "digest", -] - -[[package]] -name = "http" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" -dependencies = [ - "bytes", - "http", -] - -[[package]] -name = "httparse" -version = "1.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" - -[[package]] -name = "hyper" -version = "0.13.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "itoa", - "log", - "pin-project", - "socket2", - "time 0.1.43", - "tokio", - "tower-service", - "want", -] - -[[package]] -name = "hyper-tls" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" -dependencies = [ - "bytes", - "hyper", - "native-tls", - "tokio", - "tokio-tls", -] - -[[package]] -name = "idna" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "image" -version = "0.23.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b0553fec6407d63fe2975b794dfb099f3f790bdc958823851af37b26404ab4" -dependencies = [ - "bytemuck", - "byteorder", - "gif", - "jpeg-decoder", - "num-iter", - "num-rational", - "num-traits", - "png", -] - -[[package]] -name = "indexmap" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" -dependencies = [ - "autocfg", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "itoa" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" - -[[package]] -name = "jpeg-decoder" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704" -dependencies = [ - "byteorder", -] - -[[package]] -name = "js-sys" -version = "0.3.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "js_int" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2b63d60564122f2a7d6592c2f1d6c1c60e7a266b4d24715950a1ddad784f66" -dependencies = [ - "serde", -] - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.71" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" - -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "loom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", -] - -[[package]] -name = "lzw" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" - -[[package]] -name = "matches" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "memchr" -version = "2.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" - -[[package]] -name = "memoffset" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" -dependencies = [ - "autocfg", -] - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "mime_guess" -version = "2.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" -dependencies = [ - "mime", - "unicase", -] - -[[package]] -name = "miniz_oxide" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" -dependencies = [ - "adler32", -] - -[[package]] -name = "mio" -version = "0.6.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" -dependencies = [ - "cfg-if", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "mio-uds" -version = "0.6.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" -dependencies = [ - "iovec", - "libc", - "mio", -] - -[[package]] -name = "miow" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "native-tls" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" -dependencies = [ - "lazy_static", - "libc", - "log", - "openssl", - "openssl-probe", - "openssl-sys", - "schannel", - "security-framework", - "security-framework-sys", - "tempfile", -] - -[[package]] -name = "net2" -version = "0.2.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" -dependencies = [ - "cfg-if", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "num-integer" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-iter" -version = "0.1.41" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" -dependencies = [ - "hermit-abi", - "libc", -] - -[[package]] -name = "object" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" - -[[package]] -name = "once_cell" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" - -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - -[[package]] -name = "openssl" -version = "0.10.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4" -dependencies = [ - "bitflags", - "cfg-if", - "foreign-types", - "lazy_static", - "libc", - "openssl-sys", -] - -[[package]] -name = "openssl-probe" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" - -[[package]] -name = "openssl-sys" -version = "0.9.58" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "parking_lot" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" -dependencies = [ - "cfg-if", - "cloudabi", - "libc", - "redox_syscall", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "pear" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a" -dependencies = [ - "pear_codegen", -] - -[[package]] -name = "pear_codegen" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "syn 0.15.44", - "version_check", - "yansi", -] - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - -[[package]] -name = "pin-project" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "pin-project-lite" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" - -[[package]] -name = "png" -version = "0.16.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ccdd66f6fe4b2433b07e4728e9a013e43233120427046e93ceb709c3a439bf" -dependencies = [ - "bitflags", - "crc32fast", - "deflate", - "miniz_oxide", -] - -[[package]] -name = "polyval" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" -dependencies = [ - "cfg-if", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" - -[[package]] -name = "proc-macro-hack" -version = "0.5.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" - -[[package]] -name = "proc-macro-nested" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" - -[[package]] -name = "proc-macro2" -version = "0.4.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" -dependencies = [ - "unicode-xid 0.1.0", -] - -[[package]] -name = "proc-macro2" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" -dependencies = [ - "unicode-xid 0.2.1", -] - -[[package]] -name = "quote" -version = "0.6.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" -dependencies = [ - "proc-macro2 0.4.30", -] - -[[package]] -name = "quote" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" -dependencies = [ - "proc-macro2 1.0.18", -] - -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom", - "libc", - "rand_chacha", - "rand_core", - "rand_hc", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core", -] - -[[package]] -name = "redox_syscall" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" - -[[package]] -name = "redox_users" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" -dependencies = [ - "getrandom", - "redox_syscall", - "rust-argon2 0.7.0", -] - -[[package]] -name = "ref-cast" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" -dependencies = [ - "ref-cast-impl", -] - -[[package]] -name = "ref-cast-impl" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "reqwest" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680" -dependencies = [ - "base64 0.12.3", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "http", - "http-body", - "hyper", - "hyper-tls", - "js-sys", - "lazy_static", - "log", - "mime", - "mime_guess", - "native-tls", - "percent-encoding 2.1.0", - "pin-project-lite", - "serde", - "serde_urlencoded", - "tokio", - "tokio-tls", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "winreg", -] - -[[package]] -name = "ring" -version = "0.16.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi 0.3.9", -] - -[[package]] -name = "rocket" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=33e95f49008dcbc8dc51da7d37e0570059176b73#33e95f49008dcbc8dc51da7d37e0570059176b73" -dependencies = [ - "async-trait", - "atomic", - "atty", - "binascii", - "futures", - "log", - "memchr", - "num_cpus", - "pear", - "ref-cast", - "rocket_codegen", - "rocket_http", - "state", - "time 0.2.16", - "tokio", - "toml", - "version_check", - "yansi", -] - -[[package]] -name = "rocket_codegen" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=33e95f49008dcbc8dc51da7d37e0570059176b73#33e95f49008dcbc8dc51da7d37e0570059176b73" -dependencies = [ - "devise", - "glob", - "indexmap", - "quote 1.0.7", - "rocket_http", - "version_check", - "yansi", -] - -[[package]] -name = "rocket_http" -version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=33e95f49008dcbc8dc51da7d37e0570059176b73#33e95f49008dcbc8dc51da7d37e0570059176b73" -dependencies = [ - "cookie", - "http", - "hyper", - "indexmap", - "log", - "mime", - "pear", - "percent-encoding 1.0.1", - "ref-cast", - "smallvec", - "state", - "time 0.2.16", - "tokio", - "tokio-rustls", - "unicode-xid 0.2.1", -] - -[[package]] -name = "ruma" -version = "0.1.0" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "ruma-api", - "ruma-client-api", - "ruma-common", - "ruma-events", - "ruma-federation-api", - "ruma-identifiers", - "ruma-signatures", -] - -[[package]] -name = "ruma-api" -version = "0.16.1" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "http", - "percent-encoding 2.1.0", - "ruma-api-macros", - "ruma-identifiers", - "ruma-serde", - "serde", - "serde_json", - "strum", -] - -[[package]] -name = "ruma-api-macros" -version = "0.16.1" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "ruma-client-api" -version = "0.9.0" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "http", - "js_int", - "ruma-api", - "ruma-common", - "ruma-events", - "ruma-identifiers", - "ruma-serde", - "serde", - "serde_json", - "strum", -] - -[[package]] -name = "ruma-common" -version = "0.1.3" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "matches", - "ruma-serde", - "serde", - "serde_json", - "strum", -] - -[[package]] -name = "ruma-events" -version = "0.21.3" -source = "git+https://github.com/ruma/ruma-events?rev=c1ee72d#c1ee72db0f3107a97f6a4273a0ea3fed5c4c30e2" -dependencies = [ - "js_int", - "ruma-common", - "ruma-events-macros", - "ruma-identifiers", - "ruma-serde", - "serde", - "serde_json", - "strum", -] - -[[package]] -name = "ruma-events-macros" -version = "0.21.3" -source = "git+https://github.com/ruma/ruma-events?rev=c1ee72d#c1ee72db0f3107a97f6a4273a0ea3fed5c4c30e2" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "ruma-federation-api" -version = "0.0.2" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "js_int", - "matches", - "ruma-api", - "ruma-events", - "ruma-identifiers", - "ruma-serde", - "serde", - "serde_json", -] - -[[package]] -name = "ruma-identifiers" -version = "0.16.2" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "rand", - "serde", - "strum", -] - -[[package]] -name = "ruma-serde" -version = "0.2.2" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "dtoa", - "itoa", - "js_int", - "serde", - "serde_json", - "url", -] - -[[package]] -name = "ruma-signatures" -version = "0.6.0-dev.1" -source = "git+https://github.com/timokoesters/ruma#5a30f9cfc6c168f25cfcf51f3d80b3594c0f59b1" -dependencies = [ - "base64 0.12.3", - "ring", - "serde_json", - "untrusted", -] - -[[package]] -name = "rust-argon2" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" -dependencies = [ - "base64 0.11.0", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", -] - -[[package]] -name = "rust-argon2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19" -dependencies = [ - "base64 0.12.3", - "blake2b_simd", - "constant_time_eq", - "crossbeam-utils", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - -[[package]] -name = "rustls" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" -dependencies = [ - "base64 0.10.1", - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "ryu" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" - -[[package]] -name = "schannel" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" -dependencies = [ - "lazy_static", - "winapi 0.3.9", -] - -[[package]] -name = "scoped-tls" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" - -[[package]] -name = "scopeguard" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" - -[[package]] -name = "sct" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "security-framework" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" -dependencies = [ - "bitflags", - "core-foundation", - "core-foundation-sys", - "libc", - "security-framework-sys", -] - -[[package]] -name = "security-framework-sys" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.114" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "serde_json" -version = "1.0.55" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_urlencoded" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" -dependencies = [ - "dtoa", - "itoa", - "serde", - "url", -] - -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - -[[package]] -name = "sha2" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", -] - -[[package]] -name = "signal-hook-registry" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" -dependencies = [ - "arc-swap", - "libc", -] - -[[package]] -name = "slab" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" - -[[package]] -name = "sled" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdad3dc85d888056d3bd9954ffdf22d8a22701b6cd3aca4f6df4c436111898c4" -dependencies = [ - "backtrace", - "crc32fast", - "crossbeam-epoch", - "crossbeam-utils", - "fs2", - "fxhash", - "libc", - "log", - "parking_lot", -] - -[[package]] -name = "smallvec" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" - -[[package]] -name = "socket2" -version = "0.3.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "winapi 0.3.9", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "standback" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0437cfb83762844799a60e1e3b489d5ceb6a650fbacb86437badc1b6d87b246" -dependencies = [ - "version_check", -] - -[[package]] -name = "state" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" - -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "serde", - "serde_derive", - "syn 1.0.33", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2 1.0.18", - "quote 1.0.7", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn 1.0.33", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - -[[package]] -name = "strum" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" -dependencies = [ - "strum_macros", -] - -[[package]] -name = "strum_macros" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" -dependencies = [ - "heck", - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - -[[package]] -name = "subtle" -version = "2.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" - -[[package]] -name = "syn" -version = "0.15.44" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" -dependencies = [ - "proc-macro2 0.4.30", - "quote 0.6.13", - "unicode-xid 0.1.0", -] - -[[package]] -name = "syn" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "unicode-xid 0.2.1", -] - -[[package]] -name = "tempfile" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" -dependencies = [ - "cfg-if", - "libc", - "rand", - "redox_syscall", - "remove_dir_all", - "winapi 0.3.9", -] - -[[package]] -name = "thiserror" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "time" -version = "0.1.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" -dependencies = [ - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "time" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15" -dependencies = [ - "cfg-if", - "libc", - "standback", - "stdweb", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" -dependencies = [ - "proc-macro-hack", - "proc-macro2 1.0.18", - "quote 1.0.7", - "standback", - "syn 1.0.33", -] - -[[package]] -name = "tinyvec" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" - -[[package]] -name = "tokio" -version = "0.2.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "iovec", - "lazy_static", - "libc", - "memchr", - "mio", - "mio-uds", - "num_cpus", - "pin-project-lite", - "signal-hook-registry", - "slab", - "tokio-macros", - "winapi 0.3.9", -] - -[[package]] -name = "tokio-macros" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", -] - -[[package]] -name = "tokio-rustls" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3068d891551949b37681724d6b73666787cc63fa8e255c812a41d2513aff9775" -dependencies = [ - "futures-core", - "rustls", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-tls" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" -dependencies = [ - "native-tls", - "tokio", -] - -[[package]] -name = "tokio-util" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - -[[package]] -name = "toml" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" -dependencies = [ - "serde", -] - -[[package]] -name = "tower-service" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" - -[[package]] -name = "try-lock" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" - -[[package]] -name = "typenum" -version = "1.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" - -[[package]] -name = "unicase" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" -dependencies = [ - "version_check", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" -dependencies = [ - "matches", -] - -[[package]] -name = "unicode-normalization" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-segmentation" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" - -[[package]] -name = "unicode-xid" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" - -[[package]] -name = "unicode-xid" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" - -[[package]] -name = "universal-hash" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" -dependencies = [ - "generic-array", - "subtle 2.2.3", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" -dependencies = [ - "idna", - "matches", - "percent-encoding 2.1.0", -] - -[[package]] -name = "vcpkg" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" - -[[package]] -name = "version_check" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - -[[package]] -name = "wasm-bindgen" -version = "0.2.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" -dependencies = [ - "cfg-if", - "serde", - "serde_json", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" -dependencies = [ - "quote 1.0.7", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" -dependencies = [ - "proc-macro2 1.0.18", - "quote 1.0.7", - "syn 1.0.33", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" - -[[package]] -name = "web-sys" -version = "0.3.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.21.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "winreg" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" -dependencies = [ - "winapi 0.3.9", -] - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "yansi" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" - -[[package]] -name = "zeroize" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" diff --git a/Cargo.toml b/Cargo.toml index 30af056..eaad710 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,16 +29,16 @@ thiserror = "1.0.19" image = { version = "0.23.4", default-features = false, features = ["jpeg", "png", "gif"] } [dependencies.ruma] -git = "https://github.com/timokoesters/ruma" -#rev = "baa87104569b45dc07a9a7a16d3c7592ab8f4d6b" +git = "https://github.com/DevinR528/ruma" +branch = "matrix-sdk2" #path = "../ruma/ruma" features = ["rand", "client-api", "federation-api"] # These are required only until ruma-events and ruma-federation-api are merged into ruma/ruma -[patch.crates-io] -ruma-common = { git = "https://github.com/timokoesters/ruma" } -ruma-serde = { git = "https://github.com/timokoesters/ruma" } -ruma-identifiers = { git = "https://github.com/timokoesters/ruma" } +# [patch.crates-io] +# ruma-common = { git = "https://github.com/ruma/ruma", rev = "baa87104569b45dc07a9a7a16d3c7592ab8f4d6b" } +# ruma-serde = { git = "https://github.com/ruma/ruma", rev = "baa87104569b45dc07a9a7a16d3c7592ab8f4d6b" } +# ruma-identifiers = { git = "https://github.com/ruma/ruma", rev = "baa87104569b45dc07a9a7a16d3c7592ab8f4d6b" } #ruma-common = { path = "../ruma/ruma-common" } #ruma-serde = { path = "../ruma/ruma-serde" } #ruma-identifiers = { path = "../ruma/ruma-identifiers" } diff --git a/src/client_server.rs b/src/client_server.rs index f1a9dbe..5a20eb3 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -60,12 +60,11 @@ use ruma::{ unversioned::get_supported_versions, }, events::{ - collections::only::Event as EduEvent, room::{ canonical_alias, guest_access, history_visibility, join_rules, member, name, redaction, topic, }, - EventJson, EventType, + AnyBasicEvent, AnyEphemeralRoomEvent, AnyEvent as EduEvent, EventJson, EventType, }, identifiers::{RoomAliasId, RoomId, RoomVersionId, UserId}, }; @@ -77,7 +76,7 @@ const TOKEN_LENGTH: usize = 256; const MXC_LENGTH: usize = 256; const SESSION_ID_LENGTH: usize = 256; -#[get("/_matrix/client/versions")] +// #[get("/_matrix/client/versions")] pub fn get_supported_versions_route() -> ConduitResult { let mut unstable_features = BTreeMap::new(); @@ -90,7 +89,7 @@ pub fn get_supported_versions_route() -> ConduitResult, body: Ruma, @@ -120,7 +119,7 @@ pub fn get_register_available_route( Ok(get_username_availability::Response { available: true }.into()) } -#[post("/_matrix/client/r0/register", data = "")] +// #[post("/_matrix/client/r0/register", data = "")] pub fn register_route( db: State<'_, Database>, body: Ruma, @@ -226,7 +225,7 @@ pub fn register_route( .into()) } -#[get("/_matrix/client/r0/login")] +// #[get("/_matrix/client/r0/login")] pub fn get_login_route() -> ConduitResult { Ok(get_login_types::Response { flows: vec![get_login_types::LoginType::Password], @@ -234,7 +233,7 @@ pub fn get_login_route() -> ConduitResult { .into()) } -#[post("/_matrix/client/r0/login", data = "")] +// #[post("/_matrix/client/r0/login", data = "")] pub fn login_route( db: State<'_, Database>, body: Ruma, @@ -285,14 +284,14 @@ pub fn login_route( Ok(login::Response { user_id, access_token: token, - home_server: Some(db.globals.server_name().to_owned()), + home_server: Some(db.globals.server_name().to_string()), device_id, well_known: None, } .into()) } -#[post("/_matrix/client/r0/logout", data = "")] +// #[post("/_matrix/client/r0/logout", data = "")] pub fn logout_route( db: State<'_, Database>, body: Ruma, @@ -473,14 +472,14 @@ pub fn get_capabilities_route() -> ConduitResult { .into()) } -#[get("/_matrix/client/r0/pushrules", data = "")] +// #[get("/_matrix/client/r0/pushrules", data = "")] pub fn get_pushrules_all_route( db: State<'_, Database>, body: Ruma, ) -> ConduitResult { let user_id = body.user_id.as_ref().expect("user is authenticated"); - if let EduEvent::PushRules(pushrules) = db + if let EduEvent::Basic(AnyBasicEvent::PushRules(pushrules)) = db .account_data .get(None, &user_id, &EventType::PushRules)? .ok_or(Error::BadRequest( @@ -515,7 +514,7 @@ pub fn set_pushrule_route( Ok(set_pushrule::Response.into()) } -#[put("/_matrix/client/r0/pushrules/<_scope>/<_kind>/<_rule_id>/enabled")] +// #[put("/_matrix/client/r0/pushrules/<_scope>/<_kind>/<_rule_id>/enabled")] pub fn set_pushrule_enabled_route( _scope: String, _kind: String, @@ -526,7 +525,7 @@ pub fn set_pushrule_enabled_route( Ok(set_pushrule_enabled::Response.into()) } -#[get("/_matrix/client/r0/user/<_user_id>/filter/<_filter_id>")] +// #[get("/_matrix/client/r0/user/<_user_id>/filter/<_filter_id>")] pub fn get_filter_route( _user_id: String, _filter_id: String, @@ -544,7 +543,7 @@ pub fn get_filter_route( .into()) } -#[post("/_matrix/client/r0/user/<_user_id>/filter")] +// #[post("/_matrix/client/r0/user/<_user_id>/filter")] pub fn create_filter_route(_user_id: String) -> ConduitResult { // TODO Ok(create_filter::Response { @@ -553,10 +552,10 @@ pub fn create_filter_route(_user_id: String) -> ConduitResult/account_data/<_type>", - data = "" -)] +// #[put( +// "/_matrix/client/r0/user/<_user_id>/account_data/<_type>", +// data = "" +// )] pub fn set_global_account_data_route( db: State<'_, Database>, body: Ruma, @@ -582,10 +581,10 @@ pub fn set_global_account_data_route( Ok(set_global_account_data::Response.into()) } -#[get( - "/_matrix/client/r0/user/<_user_id>/account_data/<_type>", - data = "" -)] +// #[get( +// "/_matrix/client/r0/user/<_user_id>/account_data/<_type>", +// data = "" +// )] pub fn get_global_account_data_route( db: State<'_, Database>, body: Ruma, @@ -603,10 +602,19 @@ pub fn get_global_account_data_route( )? .ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?; - Ok(get_global_account_data::Response { account_data: data }.into()) + // TODO clearly this is not ideal... + // NOTE: EventJson is no longer needed as all the enums and event structs impl ser/de + let data: Result = data.deserialize().map_err(Into::into); + match data? { + EduEvent::Basic(data) => Ok(get_global_account_data::Response { + account_data: EventJson::from(data), + } + .into()), + _ => panic!("timo what do i do here"), + } } -#[put("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] +// #[put("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] pub fn set_displayname_route( db: State<'_, Database>, body: Ruma, @@ -672,7 +680,7 @@ pub fn set_displayname_route( Ok(set_display_name::Response.into()) } -#[get("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] +// #[get("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] pub fn get_displayname_route( db: State<'_, Database>, body: Ruma, @@ -685,7 +693,7 @@ pub fn get_displayname_route( .into()) } -#[put("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] +// #[put("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] pub fn set_avatar_url_route( db: State<'_, Database>, body: Ruma, @@ -762,7 +770,7 @@ pub fn set_avatar_url_route( Ok(set_avatar_url::Response.into()) } -#[get("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] +// #[get("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] pub fn get_avatar_url_route( db: State<'_, Database>, body: Ruma, @@ -775,7 +783,7 @@ pub fn get_avatar_url_route( .into()) } -#[get("/_matrix/client/r0/profile/<_user_id>", data = "")] +// #[get("/_matrix/client/r0/profile/<_user_id>", data = "")] pub fn get_profile_route( db: State<'_, Database>, body: Ruma, @@ -800,7 +808,7 @@ pub fn get_profile_route( .into()) } -#[put("/_matrix/client/r0/presence/<_user_id>/status", data = "")] +// #[put("/_matrix/client/r0/presence/<_user_id>/status", data = "")] pub fn set_presence_route( db: State<'_, Database>, body: Ruma, @@ -830,7 +838,7 @@ pub fn set_presence_route( Ok(set_presence::Response.into()) } -#[post("/_matrix/client/r0/keys/upload", data = "")] +// #[post("/_matrix/client/r0/keys/upload", data = "")] pub fn upload_keys_route( db: State<'_, Database>, body: Ruma, @@ -859,7 +867,7 @@ pub fn upload_keys_route( .into()) } -#[post("/_matrix/client/r0/keys/query", data = "")] +// #[post("/_matrix/client/r0/keys/query", data = "")] pub fn get_keys_route( db: State<'_, Database>, body: Ruma, @@ -936,7 +944,7 @@ pub fn get_keys_route( .into()) } -#[post("/_matrix/client/r0/keys/claim", data = "")] +// #[post("/_matrix/client/r0/keys/claim", data = "")] pub fn claim_keys_route( db: State<'_, Database>, body: Ruma, @@ -1099,7 +1107,7 @@ pub fn set_read_marker_route( content: ruma::events::fully_read::FullyReadEventContent { event_id: body.fully_read.clone(), }, - room_id: Some(body.room_id.clone()), + room_id: body.room_id.clone(), }) .expect("we just created a valid event") .as_object_mut() @@ -1135,20 +1143,22 @@ pub fn set_read_marker_route( db.rooms.edus.roomlatest_update( &user_id, &body.room_id, - EduEvent::Receipt(ruma::events::receipt::ReceiptEvent { - content: receipt_content, - room_id: None, // None because it can be inferred - }), + EduEvent::Ephemeral(AnyEphemeralRoomEvent::Receipt( + ruma::events::receipt::ReceiptEvent { + content: ruma::events::receipt::ReceiptEventContent(receipt_content), + room_id: body.room_id.clone(), + }, + )), &db.globals, )?; } Ok(set_read_marker::Response.into()) } -#[put( - "/_matrix/client/r0/rooms/<_room_id>/typing/<_user_id>", - data = "" -)] +// #[put( +// "/_matrix/client/r0/rooms/<_room_id>/typing/<_user_id>", +// data = "" +// )] pub fn create_typing_event_route( db: State<'_, Database>, body: Ruma, @@ -1174,15 +1184,14 @@ pub fn create_typing_event_route( Ok(create_typing_event::Response.into()) } -#[post("/_matrix/client/r0/createRoom", data = "")] +// #[post("/_matrix/client/r0/createRoom", data = "")] pub fn create_room_route( db: State<'_, Database>, body: Ruma, ) -> ConduitResult { let user_id = body.user_id.as_ref().expect("user is authenticated"); - let room_id = RoomId::new(db.globals.server_name()) - .map_err(|_| Error::bad_database("Server name is invalid."))?; + let room_id = RoomId::new(db.globals.server_name()); let alias = body .room_alias_name @@ -1439,10 +1448,10 @@ pub fn create_room_route( Ok(create_room::Response { room_id }.into()) } -#[put( - "/_matrix/client/r0/rooms/<_room_id>/redact/<_event_id>/<_txn_id>", - data = "" -)] +// #[put( +// "/_matrix/client/r0/rooms/<_room_id>/redact/<_event_id>/<_txn_id>", +// data = "" +// )] pub fn redact_event_route( db: State<'_, Database>, body: Ruma, @@ -1469,7 +1478,7 @@ pub fn redact_event_route( Ok(redact_event::Response { event_id }.into()) } -#[put("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] +// #[put("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] pub fn create_alias_route( db: State<'_, Database>, body: Ruma, @@ -1485,7 +1494,7 @@ pub fn create_alias_route( Ok(create_alias::Response.into()) } -#[delete("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] +// #[delete("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] pub fn delete_alias_route( db: State<'_, Database>, body: Ruma, @@ -1496,7 +1505,7 @@ pub fn delete_alias_route( Ok(delete_alias::Response.into()) } -#[get("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] +// #[get("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] pub fn get_alias_route( db: State<'_, Database>, body: Ruma, @@ -1516,12 +1525,12 @@ pub fn get_alias_route( Ok(get_alias::Response { room_id, - servers: vec![db.globals.server_name().to_owned()], + servers: vec![db.globals.server_name().to_string()], } .into()) } -#[post("/_matrix/client/r0/rooms/<_room_id>/join", data = "")] +// #[post("/_matrix/client/r0/rooms/<_room_id>/join", data = "")] pub fn join_room_by_id_route( db: State<'_, Database>, body: Ruma, @@ -1556,7 +1565,7 @@ pub fn join_room_by_id_route( .into()) } -#[post("/_matrix/client/r0/join/<_room_id_or_alias>", data = "")] +// #[post("/_matrix/client/r0/join/<_room_id_or_alias>", data = "")] pub fn join_room_by_id_or_alias_route( db: State<'_, Database>, body: Ruma, @@ -1585,7 +1594,7 @@ pub fn join_room_by_id_or_alias_route( .into()) } -#[post("/_matrix/client/r0/rooms/<_room_id>/leave", data = "")] +// #[post("/_matrix/client/r0/rooms/<_room_id>/leave", data = "")] pub fn leave_room_route( db: State<'_, Database>, body: Ruma, @@ -1623,7 +1632,7 @@ pub fn leave_room_route( Ok(leave_room::Response.into()) } -#[post("/_matrix/client/r0/rooms/<_room_id>/kick", data = "")] +// #[post("/_matrix/client/r0/rooms/<_room_id>/kick", data = "")] pub fn kick_user_route( db: State<'_, Database>, body: Ruma, @@ -1663,7 +1672,7 @@ pub fn kick_user_route( Ok(kick_user::Response.into()) } -#[post("/_matrix/client/r0/rooms/<_room_id>/ban", data = "")] +// #[post("/_matrix/client/r0/rooms/<_room_id>/ban", data = "")] pub fn ban_user_route( db: State<'_, Database>, body: Ruma, @@ -1710,7 +1719,7 @@ pub fn ban_user_route( Ok(ban_user::Response.into()) } -#[post("/_matrix/client/r0/rooms/<_room_id>/unban", data = "")] +// #[post("/_matrix/client/r0/rooms/<_room_id>/unban", data = "")] pub fn unban_user_route( db: State<'_, Database>, body: Ruma, @@ -1749,7 +1758,7 @@ pub fn unban_user_route( Ok(unban_user::Response.into()) } -#[post("/_matrix/client/r0/rooms/<_room_id>/forget", data = "")] +// #[post("/_matrix/client/r0/rooms/<_room_id>/forget", data = "")] pub fn forget_room_route( db: State<'_, Database>, body: Ruma, @@ -1762,7 +1771,7 @@ pub fn forget_room_route( Ok(forget_room::Response.into()) } -#[post("/_matrix/client/r0/rooms/<_room_id>/invite", data = "")] +// #[post("/_matrix/client/r0/rooms/<_room_id>/invite", data = "")] pub fn invite_user_route( db: State<'_, Database>, body: Ruma, @@ -1793,7 +1802,7 @@ pub fn invite_user_route( } } -#[put("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] +// #[put("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] pub async fn set_room_visibility_route( db: State<'_, Database>, body: Ruma, @@ -1807,7 +1816,7 @@ pub async fn set_room_visibility_route( Ok(set_room_visibility::Response.into()) } -#[get("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] +// #[get("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] pub async fn get_room_visibility_route( db: State<'_, Database>, body: Ruma, @@ -1823,7 +1832,7 @@ pub async fn get_room_visibility_route( .into()) } -#[get("/_matrix/client/r0/publicRooms", data = "")] +// #[get("/_matrix/client/r0/publicRooms", data = "")] pub async fn get_public_rooms_route( db: State<'_, Database>, body: Ruma, @@ -1872,7 +1881,7 @@ pub async fn get_public_rooms_route( .into()) } -#[post("/_matrix/client/r0/publicRooms", data = "")] +// #[post("/_matrix/client/r0/publicRooms", data = "")] pub async fn get_public_rooms_filtered_route( db: State<'_, Database>, body: Ruma, @@ -1984,7 +1993,7 @@ pub async fn get_public_rooms_filtered_route( .into()) } -#[post("/_matrix/client/r0/user_directory/search", data = "")] +// #[post("/_matrix/client/r0/user_directory/search", data = "")] pub fn search_users_route( db: State<'_, Database>, body: Ruma, @@ -2050,7 +2059,7 @@ pub fn get_member_events_route( .into()) } -#[get("/_matrix/client/r0/thirdparty/protocols")] +// #[get("/_matrix/client/r0/thirdparty/protocols")] pub fn get_protocols_route() -> ConduitResult { warn!("TODO: get_protocols_route"); Ok(get_protocols::Response { @@ -2124,7 +2133,7 @@ pub fn create_message_event_route( } #[put( - "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", + // "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", data = "" )] pub fn create_state_event_for_key_route( @@ -2185,10 +2194,10 @@ pub fn create_state_event_for_key_route( Ok(create_state_event_for_key::Response { event_id }.into()) } -#[put( - "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", - data = "" -)] +// #[put( +// "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", +// data = "" +// )] pub fn create_state_event_for_empty_key_route( db: State<'_, Database>, body: Ruma, @@ -2232,7 +2241,7 @@ pub fn create_state_event_for_empty_key_route( .into()) } -#[get("/_matrix/client/r0/rooms/<_room_id>/state", data = "")] +// #[get("/_matrix/client/r0/rooms/<_room_id>/state", data = "")] pub fn get_state_events_route( db: State<'_, Database>, body: Ruma, @@ -2258,10 +2267,10 @@ pub fn get_state_events_route( .into()) } -#[get( - "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", - data = "" -)] +// #[get( +// "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", +// data = "" +// )] pub fn get_state_events_for_key_route( db: State<'_, Database>, body: Ruma, @@ -2293,10 +2302,10 @@ pub fn get_state_events_for_key_route( .into()) } -#[get( - "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", - data = "" -)] +// #[get( +// "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", +// data = "" +// )] pub fn get_state_events_for_empty_key_route( db: State<'_, Database>, body: Ruma, @@ -2327,7 +2336,7 @@ pub fn get_state_events_for_empty_key_route( .into()) } -#[get("/_matrix/client/r0/sync", data = "")] +// #[get("/_matrix/client/r0/sync", data = "")] pub fn sync_route( db: State<'_, Database>, body: Ruma, @@ -2522,9 +2531,9 @@ pub fn sync_route( { edus.push( serde_json::from_str( - &serde_json::to_string(&EduEvent::Typing( + &serde_json::to_string(&EduEvent::Ephemeral(AnyEphemeralRoomEvent::Typing( db.rooms.edus.roomactives_all(&room_id)?, - )) + ))) .expect("event is valid, we just created it"), ) .expect("event is valid, we just created it"), @@ -2537,7 +2546,13 @@ pub fn sync_route( .account_data .changes_since(Some(&room_id), &user_id, since)? .into_iter() - .map(|(_, v)| v) + .flat_map(|(_, v)| { + if let Some(EduEvent::Basic(account_event)) = v.deserialize().ok() { + Some(EventJson::from(account_event)) + } else { + None + } + }) .collect(), }, summary: sync_events::RoomSummary { @@ -2701,10 +2716,10 @@ pub fn sync_route( .into()) } -#[get( - "/_matrix/client/r0/rooms/<_room_id>/context/<_event_id>", - data = "" -)] +// #[get( +// "/_matrix/client/r0/rooms/<_room_id>/context/<_event_id>", +// data = "" +// )] pub fn get_context_route( db: State<'_, Database>, body: Ruma, @@ -2802,7 +2817,7 @@ pub fn get_context_route( .into()) } -#[get("/_matrix/client/r0/rooms/<_room_id>/messages", data = "")] +// #[get("/_matrix/client/r0/rooms/<_room_id>/messages", data = "")] pub fn get_message_events_route( db: State<'_, Database>, body: Ruma, @@ -2824,15 +2839,16 @@ pub fn get_message_events_route( .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Invalid `from` value."))?; match body.dir { get_message_events::Direction::Forward => { + let limit = body + .limit + .try_into() + .map_or(Ok::<_, Error>(10_usize), |l: u32| Ok(l as usize))?; + let events_after = db .rooms .pdus_after(&user_id, &body.room_id, from) // Use limit or else 10 - .take(body.limit.map_or(Ok::<_, Error>(10_usize), |l| { - Ok(u32::try_from(l).map_err(|_| { - Error::BadRequest(ErrorKind::InvalidParam, "Limit value is invalid.") - })? as usize) - })?) + .take(limit) .filter_map(|r| r.ok()) // Filter out buggy events .collect::>(); @@ -2859,15 +2875,16 @@ pub fn get_message_events_route( .into()) } get_message_events::Direction::Backward => { + let limit = body + .limit + .try_into() + .map_or(Ok::<_, Error>(10_usize), |l: u32| Ok(l as usize))?; + let events_before = db .rooms .pdus_until(&user_id, &body.room_id, from) // Use limit or else 10 - .take(body.limit.map_or(Ok::<_, Error>(10_usize), |l| { - Ok(u32::try_from(l).map_err(|_| { - Error::BadRequest(ErrorKind::InvalidParam, "Limit value is invalid.") - })? as usize) - })?) + .take(limit) .filter_map(|r| r.ok()) // Filter out buggy events .collect::>(); @@ -2896,7 +2913,7 @@ pub fn get_message_events_route( } } -#[get("/_matrix/client/r0/voip/turnServer")] +// #[get("/_matrix/client/r0/voip/turnServer")] pub fn turn_server_route() -> ConduitResult { Err(Error::BadRequest( ErrorKind::NotFound, @@ -2904,7 +2921,7 @@ pub fn turn_server_route() -> ConduitResult { )) } -#[post("/_matrix/client/r0/publicised_groups")] +// #[post("/_matrix/client/r0/publicised_groups")] pub fn publicised_groups_route() -> ConduitResult { Err(Error::BadRequest( ErrorKind::NotFound, @@ -2912,10 +2929,10 @@ pub fn publicised_groups_route() -> ConduitResult/<_txn_id>", - data = "" -)] +// #[put( +// "/_matrix/client/r0/sendToDevice/<_event_type>/<_txn_id>", +// data = "" +// )] pub fn send_event_to_device_route( db: State<'_, Database>, body: Ruma, @@ -2961,7 +2978,7 @@ pub fn send_event_to_device_route( Ok(send_event_to_device::Response.into()) } -#[get("/_matrix/media/r0/config")] +// #[get("/_matrix/media/r0/config")] pub fn get_media_config_route() -> ConduitResult { Ok(get_media_config::Response { upload_size: (20_u32 * 1024 * 1024).into(), // 20 MB @@ -2969,7 +2986,7 @@ pub fn get_media_config_route() -> ConduitResult { .into()) } -#[post("/_matrix/media/r0/upload", data = "")] +// #[post("/_matrix/media/r0/upload", data = "")] pub fn create_content_route( db: State<'_, Database>, body: Ruma, @@ -2989,10 +3006,10 @@ pub fn create_content_route( Ok(create_content::Response { content_uri: mxc }.into()) } -#[get( - "/_matrix/media/r0/download/<_server_name>/<_media_id>", - data = "" -)] +// #[get( +// "/_matrix/media/r0/download/<_server_name>/<_media_id>", +// data = "" +// )] pub fn get_content_route( db: State<'_, Database>, body: Ruma, @@ -3014,10 +3031,10 @@ pub fn get_content_route( } } -#[get( - "/_matrix/media/r0/thumbnail/<_server_name>/<_media_id>", - data = "" -)] +// #[get( +// "/_matrix/media/r0/thumbnail/<_server_name>/<_media_id>", +// data = "" +// )] pub fn get_content_thumbnail_route( db: State<'_, Database>, body: Ruma, @@ -3039,7 +3056,7 @@ pub fn get_content_thumbnail_route( } } -#[get("/_matrix/client/r0/devices", data = "")] +// #[get("/_matrix/client/r0/devices", data = "")] pub fn get_devices_route( db: State<'_, Database>, body: Ruma, @@ -3055,7 +3072,7 @@ pub fn get_devices_route( Ok(get_devices::Response { devices }.into()) } -#[get("/_matrix/client/r0/devices/<_device_id>", data = "")] +// #[get("/_matrix/client/r0/devices/<_device_id>", data = "")] pub fn get_device_route( db: State<'_, Database>, body: Ruma, @@ -3071,7 +3088,7 @@ pub fn get_device_route( Ok(get_device::Response { device }.into()) } -#[put("/_matrix/client/r0/devices/<_device_id>", data = "")] +// #[put("/_matrix/client/r0/devices/<_device_id>", data = "")] pub fn update_device_route( db: State<'_, Database>, body: Ruma, @@ -3092,7 +3109,7 @@ pub fn update_device_route( Ok(update_device::Response.into()) } -#[delete("/_matrix/client/r0/devices/<_device_id>", data = "")] +// #[delete("/_matrix/client/r0/devices/<_device_id>", data = "")] pub fn delete_device_route( db: State<'_, Database>, body: Ruma, @@ -3136,7 +3153,7 @@ pub fn delete_device_route( Ok(delete_device::Response.into()) } -#[post("/_matrix/client/r0/delete_devices", data = "")] +// #[post("/_matrix/client/r0/delete_devices", data = "")] pub fn delete_devices_route( db: State<'_, Database>, body: Ruma, diff --git a/src/database/account_data.rs b/src/database/account_data.rs index befd937..3b64ba7 100644 --- a/src/database/account_data.rs +++ b/src/database/account_data.rs @@ -1,7 +1,7 @@ use crate::{utils, Error, Result}; use ruma::{ api::client::error::ErrorKind, - events::{collections::only::Event as EduEvent, EventJson, EventType}, + events::{AnyEvent as EduEvent, EventJson, EventType}, identifiers::{RoomId, UserId}, }; use std::{collections::HashMap, convert::TryFrom}; diff --git a/src/database/globals.rs b/src/database/globals.rs index a767d8a..00e0982 100644 --- a/src/database/globals.rs +++ b/src/database/globals.rs @@ -1,12 +1,14 @@ -use crate::{utils, Error, Result}; +use std::convert::TryFrom; +use crate::{utils, Error, Result}; +use ruma::identifiers::{ServerName, ServerNameRef}; pub const COUNTER: &str = "c"; pub struct Globals { pub(super) globals: sled::Tree, keypair: ruma::signatures::Ed25519KeyPair, reqwest_client: reqwest::Client, - server_name: String, + server_name: ServerName, registration_disabled: bool, } @@ -24,10 +26,13 @@ impl Globals { globals, keypair, reqwest_client: reqwest::Client::new(), - server_name: config - .get_str("server_name") - .unwrap_or("localhost") - .to_owned(), + server_name: ServerName::try_from( + config + .get_str("server_name") + .unwrap_or("localhost") + .to_owned(), + ) + .map_err(|_| Error::bad_database("Invalid server name"))?, registration_disabled: config.get_bool("registration_disabled").unwrap_or(false), }) } @@ -59,8 +64,8 @@ impl Globals { }) } - pub fn server_name(&self) -> &str { - &self.server_name + pub fn server_name(&self) -> ServerNameRef<'_> { + self.server_name.as_ref() } pub fn registration_disabled(&self) -> bool { diff --git a/src/database/rooms.rs b/src/database/rooms.rs index b7f7221..d29ab42 100644 --- a/src/database/rooms.rs +++ b/src/database/rooms.rs @@ -515,7 +515,7 @@ impl Rooms { event_id: EventId::try_from("$thiswillbefilledinlater").expect("we know this is valid"), room_id: room_id.clone(), sender: sender.clone(), - origin: globals.server_name().to_owned(), + origin: globals.server_name().to_string(), origin_server_ts: utils::millis_since_unix_epoch() .try_into() .expect("time is valid"), @@ -529,7 +529,7 @@ impl Rooms { auth_events: Vec::new(), redacts: redacts.clone(), unsigned, - hashes: ruma::api::federation::EventHash { + hashes: ruma::events::pdu::EventHash { sha256: "aaa".to_owned(), }, signatures: HashMap::new(), @@ -547,7 +547,7 @@ impl Rooms { let mut pdu_json = serde_json::to_value(&pdu).expect("event is valid, we just created it"); ruma::signatures::hash_and_sign_event( - globals.server_name(), + globals.server_name().as_str(), globals.keypair(), &mut pdu_json, ) diff --git a/src/database/rooms/edus.rs b/src/database/rooms/edus.rs index 645ccb0..de138b6 100644 --- a/src/database/rooms/edus.rs +++ b/src/database/rooms/edus.rs @@ -1,6 +1,6 @@ use crate::{utils, Error, Result}; use ruma::{ - events::{collections::only::Event as EduEvent, EventJson}, + events::{AnyEvent as EduEvent, EventJson}, identifiers::{RoomId, UserId}, }; use std::convert::TryFrom; @@ -235,7 +235,7 @@ impl RoomEdus { Ok(ruma::events::typing::TypingEvent { content: ruma::events::typing::TypingEventContent { user_ids }, - room_id: None, // Can be inferred + room_id: room_id.clone(), // Can be inferred }) } diff --git a/src/database/users.rs b/src/database/users.rs index 2ccf59a..4e2e1a2 100644 --- a/src/database/users.rs +++ b/src/database/users.rs @@ -8,7 +8,7 @@ use ruma::{ keys::{AlgorithmAndDeviceId, CrossSigningKey, DeviceKeys, KeyAlgorithm, OneTimeKey}, }, }, - events::{to_device::AnyToDeviceEvent, EventJson, EventType}, + events::{AnyToDeviceEvent, EventJson, EventType}, identifiers::UserId, }; use std::{collections::BTreeMap, convert::TryFrom, time::SystemTime}; diff --git a/src/error.rs b/src/error.rs index 7305073..e1af15a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -25,6 +25,11 @@ pub enum Error { #[from] source: image::error::ImageError, }, + #[error("Could not deserialize json")] + SerdeError { + #[from] + source: serde_json::Error, + }, #[error("{0}")] BadConfig(&'static str), #[error("{0}")] diff --git a/src/pdu.rs b/src/pdu.rs index 8a5858e..4504ae6 100644 --- a/src/pdu.rs +++ b/src/pdu.rs @@ -1,12 +1,9 @@ use crate::{Error, Result}; use js_int::UInt; use ruma::{ - api::federation::EventHash, events::{ - collections::all::{RoomEvent, StateEvent}, - room::member::MemberEvent, - stripped::AnyStrippedStateEvent, - EventJson, EventType, + pdu::EventHash, AnyRoomEvent, AnyStateEvent, AnyStrippedStateEventStub, EventJson, + EventType, }, identifiers::{EventId, RoomId, UserId}, }; @@ -81,19 +78,19 @@ impl PduEvent { Ok(()) } - pub fn to_room_event(&self) -> EventJson { + pub fn to_room_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) + serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } - pub fn to_state_event(&self) -> EventJson { + pub fn to_state_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) + serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } - pub fn to_stripped_state_event(&self) -> EventJson { + pub fn to_stripped_state_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) + serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } pub fn to_member_event(&self) -> EventJson { From 24b670204713b54bee092f39322286f7a3117b92 Mon Sep 17 00:00:00 2001 From: Devin R Date: Mon, 22 Jun 2020 07:26:09 -0400 Subject: [PATCH 02/14] Add to_*_event_stub methods to pdu, filter for correct event kind When creating some responses (sync) an AnyRoomEventStub is needed for this PduEvent will deserialize the JSON as a Stub event and a non stub event when needed. Ephemeral and account events are checked to be the correct type and filtered out if not. This requires an extra `deserialize` call which could/should be removed. TODO: Possibly get rid of EventJson in some places. --- src/client_server.rs | 222 ++++++++++++++++++++----------------- src/database/rooms/edus.rs | 2 + src/pdu.rs | 14 ++- 3 files changed, 136 insertions(+), 102 deletions(-) diff --git a/src/client_server.rs b/src/client_server.rs index 5a20eb3..15ced16 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -76,7 +76,7 @@ const TOKEN_LENGTH: usize = 256; const MXC_LENGTH: usize = 256; const SESSION_ID_LENGTH: usize = 256; -// #[get("/_matrix/client/versions")] +#[get("/_matrix/client/versions")] pub fn get_supported_versions_route() -> ConduitResult { let mut unstable_features = BTreeMap::new(); @@ -89,7 +89,7 @@ pub fn get_supported_versions_route() -> ConduitResult, body: Ruma, @@ -119,7 +119,7 @@ pub fn get_register_available_route( Ok(get_username_availability::Response { available: true }.into()) } -// #[post("/_matrix/client/r0/register", data = "")] +#[post("/_matrix/client/r0/register", data = "")] pub fn register_route( db: State<'_, Database>, body: Ruma, @@ -225,7 +225,7 @@ pub fn register_route( .into()) } -// #[get("/_matrix/client/r0/login")] +#[get("/_matrix/client/r0/login")] pub fn get_login_route() -> ConduitResult { Ok(get_login_types::Response { flows: vec![get_login_types::LoginType::Password], @@ -233,7 +233,7 @@ pub fn get_login_route() -> ConduitResult { .into()) } -// #[post("/_matrix/client/r0/login", data = "")] +#[post("/_matrix/client/r0/login", data = "")] pub fn login_route( db: State<'_, Database>, body: Ruma, @@ -291,7 +291,7 @@ pub fn login_route( .into()) } -// #[post("/_matrix/client/r0/logout", data = "")] +#[post("/_matrix/client/r0/logout", data = "")] pub fn logout_route( db: State<'_, Database>, body: Ruma, @@ -472,7 +472,7 @@ pub fn get_capabilities_route() -> ConduitResult { .into()) } -// #[get("/_matrix/client/r0/pushrules", data = "")] +#[get("/_matrix/client/r0/pushrules", data = "")] pub fn get_pushrules_all_route( db: State<'_, Database>, body: Ruma, @@ -514,7 +514,7 @@ pub fn set_pushrule_route( Ok(set_pushrule::Response.into()) } -// #[put("/_matrix/client/r0/pushrules/<_scope>/<_kind>/<_rule_id>/enabled")] +#[put("/_matrix/client/r0/pushrules/<_scope>/<_kind>/<_rule_id>/enabled")] pub fn set_pushrule_enabled_route( _scope: String, _kind: String, @@ -525,7 +525,7 @@ pub fn set_pushrule_enabled_route( Ok(set_pushrule_enabled::Response.into()) } -// #[get("/_matrix/client/r0/user/<_user_id>/filter/<_filter_id>")] +#[get("/_matrix/client/r0/user/<_user_id>/filter/<_filter_id>")] pub fn get_filter_route( _user_id: String, _filter_id: String, @@ -543,7 +543,7 @@ pub fn get_filter_route( .into()) } -// #[post("/_matrix/client/r0/user/<_user_id>/filter")] +#[post("/_matrix/client/r0/user/<_user_id>/filter")] pub fn create_filter_route(_user_id: String) -> ConduitResult { // TODO Ok(create_filter::Response { @@ -552,10 +552,10 @@ pub fn create_filter_route(_user_id: String) -> ConduitResult/account_data/<_type>", -// data = "" -// )] +#[put( + "/_matrix/client/r0/user/<_user_id>/account_data/<_type>", + data = "" +)] pub fn set_global_account_data_route( db: State<'_, Database>, body: Ruma, @@ -581,10 +581,10 @@ pub fn set_global_account_data_route( Ok(set_global_account_data::Response.into()) } -// #[get( -// "/_matrix/client/r0/user/<_user_id>/account_data/<_type>", -// data = "" -// )] +#[get( + "/_matrix/client/r0/user/<_user_id>/account_data/<_type>", + data = "" +)] pub fn get_global_account_data_route( db: State<'_, Database>, body: Ruma, @@ -614,7 +614,7 @@ pub fn get_global_account_data_route( } } -// #[put("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] +#[put("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] pub fn set_displayname_route( db: State<'_, Database>, body: Ruma, @@ -680,7 +680,7 @@ pub fn set_displayname_route( Ok(set_display_name::Response.into()) } -// #[get("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] +#[get("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] pub fn get_displayname_route( db: State<'_, Database>, body: Ruma, @@ -693,7 +693,7 @@ pub fn get_displayname_route( .into()) } -// #[put("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] +#[put("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] pub fn set_avatar_url_route( db: State<'_, Database>, body: Ruma, @@ -770,7 +770,7 @@ pub fn set_avatar_url_route( Ok(set_avatar_url::Response.into()) } -// #[get("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] +#[get("/_matrix/client/r0/profile/<_user_id>/avatar_url", data = "")] pub fn get_avatar_url_route( db: State<'_, Database>, body: Ruma, @@ -783,7 +783,7 @@ pub fn get_avatar_url_route( .into()) } -// #[get("/_matrix/client/r0/profile/<_user_id>", data = "")] +#[get("/_matrix/client/r0/profile/<_user_id>", data = "")] pub fn get_profile_route( db: State<'_, Database>, body: Ruma, @@ -808,7 +808,7 @@ pub fn get_profile_route( .into()) } -// #[put("/_matrix/client/r0/presence/<_user_id>/status", data = "")] +#[put("/_matrix/client/r0/presence/<_user_id>/status", data = "")] pub fn set_presence_route( db: State<'_, Database>, body: Ruma, @@ -838,7 +838,7 @@ pub fn set_presence_route( Ok(set_presence::Response.into()) } -// #[post("/_matrix/client/r0/keys/upload", data = "")] +#[post("/_matrix/client/r0/keys/upload", data = "")] pub fn upload_keys_route( db: State<'_, Database>, body: Ruma, @@ -867,7 +867,7 @@ pub fn upload_keys_route( .into()) } -// #[post("/_matrix/client/r0/keys/query", data = "")] +#[post("/_matrix/client/r0/keys/query", data = "")] pub fn get_keys_route( db: State<'_, Database>, body: Ruma, @@ -944,7 +944,7 @@ pub fn get_keys_route( .into()) } -// #[post("/_matrix/client/r0/keys/claim", data = "")] +#[post("/_matrix/client/r0/keys/claim", data = "")] pub fn claim_keys_route( db: State<'_, Database>, body: Ruma, @@ -1155,10 +1155,10 @@ pub fn set_read_marker_route( Ok(set_read_marker::Response.into()) } -// #[put( -// "/_matrix/client/r0/rooms/<_room_id>/typing/<_user_id>", -// data = "" -// )] +#[put( + "/_matrix/client/r0/rooms/<_room_id>/typing/<_user_id>", + data = "" +)] pub fn create_typing_event_route( db: State<'_, Database>, body: Ruma, @@ -1184,7 +1184,7 @@ pub fn create_typing_event_route( Ok(create_typing_event::Response.into()) } -// #[post("/_matrix/client/r0/createRoom", data = "")] +#[post("/_matrix/client/r0/createRoom", data = "")] pub fn create_room_route( db: State<'_, Database>, body: Ruma, @@ -1448,10 +1448,10 @@ pub fn create_room_route( Ok(create_room::Response { room_id }.into()) } -// #[put( -// "/_matrix/client/r0/rooms/<_room_id>/redact/<_event_id>/<_txn_id>", -// data = "" -// )] +#[put( + "/_matrix/client/r0/rooms/<_room_id>/redact/<_event_id>/<_txn_id>", + data = "" +)] pub fn redact_event_route( db: State<'_, Database>, body: Ruma, @@ -1478,7 +1478,7 @@ pub fn redact_event_route( Ok(redact_event::Response { event_id }.into()) } -// #[put("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] +#[put("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] pub fn create_alias_route( db: State<'_, Database>, body: Ruma, @@ -1494,7 +1494,7 @@ pub fn create_alias_route( Ok(create_alias::Response.into()) } -// #[delete("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] +#[delete("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] pub fn delete_alias_route( db: State<'_, Database>, body: Ruma, @@ -1505,7 +1505,7 @@ pub fn delete_alias_route( Ok(delete_alias::Response.into()) } -// #[get("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] +#[get("/_matrix/client/r0/directory/room/<_room_alias>", data = "")] pub fn get_alias_route( db: State<'_, Database>, body: Ruma, @@ -1530,7 +1530,7 @@ pub fn get_alias_route( .into()) } -// #[post("/_matrix/client/r0/rooms/<_room_id>/join", data = "")] +#[post("/_matrix/client/r0/rooms/<_room_id>/join", data = "")] pub fn join_room_by_id_route( db: State<'_, Database>, body: Ruma, @@ -1565,7 +1565,7 @@ pub fn join_room_by_id_route( .into()) } -// #[post("/_matrix/client/r0/join/<_room_id_or_alias>", data = "")] +#[post("/_matrix/client/r0/join/<_room_id_or_alias>", data = "")] pub fn join_room_by_id_or_alias_route( db: State<'_, Database>, body: Ruma, @@ -1594,7 +1594,7 @@ pub fn join_room_by_id_or_alias_route( .into()) } -// #[post("/_matrix/client/r0/rooms/<_room_id>/leave", data = "")] +#[post("/_matrix/client/r0/rooms/<_room_id>/leave", data = "")] pub fn leave_room_route( db: State<'_, Database>, body: Ruma, @@ -1632,7 +1632,7 @@ pub fn leave_room_route( Ok(leave_room::Response.into()) } -// #[post("/_matrix/client/r0/rooms/<_room_id>/kick", data = "")] +#[post("/_matrix/client/r0/rooms/<_room_id>/kick", data = "")] pub fn kick_user_route( db: State<'_, Database>, body: Ruma, @@ -1672,7 +1672,7 @@ pub fn kick_user_route( Ok(kick_user::Response.into()) } -// #[post("/_matrix/client/r0/rooms/<_room_id>/ban", data = "")] +#[post("/_matrix/client/r0/rooms/<_room_id>/ban", data = "")] pub fn ban_user_route( db: State<'_, Database>, body: Ruma, @@ -1719,7 +1719,7 @@ pub fn ban_user_route( Ok(ban_user::Response.into()) } -// #[post("/_matrix/client/r0/rooms/<_room_id>/unban", data = "")] +#[post("/_matrix/client/r0/rooms/<_room_id>/unban", data = "")] pub fn unban_user_route( db: State<'_, Database>, body: Ruma, @@ -1758,7 +1758,7 @@ pub fn unban_user_route( Ok(unban_user::Response.into()) } -// #[post("/_matrix/client/r0/rooms/<_room_id>/forget", data = "")] +#[post("/_matrix/client/r0/rooms/<_room_id>/forget", data = "")] pub fn forget_room_route( db: State<'_, Database>, body: Ruma, @@ -1771,7 +1771,7 @@ pub fn forget_room_route( Ok(forget_room::Response.into()) } -// #[post("/_matrix/client/r0/rooms/<_room_id>/invite", data = "")] +#[post("/_matrix/client/r0/rooms/<_room_id>/invite", data = "")] pub fn invite_user_route( db: State<'_, Database>, body: Ruma, @@ -1802,7 +1802,7 @@ pub fn invite_user_route( } } -// #[put("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] +#[put("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] pub async fn set_room_visibility_route( db: State<'_, Database>, body: Ruma, @@ -1816,7 +1816,7 @@ pub async fn set_room_visibility_route( Ok(set_room_visibility::Response.into()) } -// #[get("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] +#[get("/_matrix/client/r0/directory/list/room/<_room_id>", data = "")] pub async fn get_room_visibility_route( db: State<'_, Database>, body: Ruma, @@ -1832,7 +1832,7 @@ pub async fn get_room_visibility_route( .into()) } -// #[get("/_matrix/client/r0/publicRooms", data = "")] +#[get("/_matrix/client/r0/publicRooms", data = "")] pub async fn get_public_rooms_route( db: State<'_, Database>, body: Ruma, @@ -1881,7 +1881,7 @@ pub async fn get_public_rooms_route( .into()) } -// #[post("/_matrix/client/r0/publicRooms", data = "")] +#[post("/_matrix/client/r0/publicRooms", data = "")] pub async fn get_public_rooms_filtered_route( db: State<'_, Database>, body: Ruma, @@ -1993,7 +1993,7 @@ pub async fn get_public_rooms_filtered_route( .into()) } -// #[post("/_matrix/client/r0/user_directory/search", data = "")] +#[post("/_matrix/client/r0/user_directory/search", data = "")] pub fn search_users_route( db: State<'_, Database>, body: Ruma, @@ -2059,7 +2059,7 @@ pub fn get_member_events_route( .into()) } -// #[get("/_matrix/client/r0/thirdparty/protocols")] +#[get("/_matrix/client/r0/thirdparty/protocols")] pub fn get_protocols_route() -> ConduitResult { warn!("TODO: get_protocols_route"); Ok(get_protocols::Response { @@ -2133,7 +2133,7 @@ pub fn create_message_event_route( } #[put( - // "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", + "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", data = "" )] pub fn create_state_event_for_key_route( @@ -2194,10 +2194,10 @@ pub fn create_state_event_for_key_route( Ok(create_state_event_for_key::Response { event_id }.into()) } -// #[put( -// "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", -// data = "" -// )] +#[put( + "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", + data = "" +)] pub fn create_state_event_for_empty_key_route( db: State<'_, Database>, body: Ruma, @@ -2241,7 +2241,7 @@ pub fn create_state_event_for_empty_key_route( .into()) } -// #[get("/_matrix/client/r0/rooms/<_room_id>/state", data = "")] +#[get("/_matrix/client/r0/rooms/<_room_id>/state", data = "")] pub fn get_state_events_route( db: State<'_, Database>, body: Ruma, @@ -2267,10 +2267,10 @@ pub fn get_state_events_route( .into()) } -// #[get( -// "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", -// data = "" -// )] +#[get( + "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>/<_state_key>", + data = "" +)] pub fn get_state_events_for_key_route( db: State<'_, Database>, body: Ruma, @@ -2302,10 +2302,10 @@ pub fn get_state_events_for_key_route( .into()) } -// #[get( -// "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", -// data = "" -// )] +#[get( + "/_matrix/client/r0/rooms/<_room_id>/state/<_event_type>", + data = "" +)] pub fn get_state_events_for_empty_key_route( db: State<'_, Database>, body: Ruma, @@ -2336,7 +2336,7 @@ pub fn get_state_events_for_empty_key_route( .into()) } -// #[get("/_matrix/client/r0/sync", data = "")] +#[get("/_matrix/client/r0/sync", data = "")] pub fn sync_route( db: State<'_, Database>, body: Ruma, @@ -2513,7 +2513,7 @@ pub fn sync_route( let room_events = pdus .into_iter() - .map(|pdu| pdu.to_room_event()) + .map(|pdu| pdu.to_room_event_stub()) .collect::>(); let mut edus = db @@ -2521,6 +2521,14 @@ pub fn sync_route( .edus .roomlatests_since(&room_id, since)? .filter_map(|r| r.ok()) // Filter out buggy events + .filter_map(|r| { + if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() { + // TODO we could get rid of EventJson? + Some(EventJson::from(ev)) + } else { + None + } + }) .collect::>(); if db @@ -2579,7 +2587,7 @@ pub fn sync_route( db.rooms .room_state_full(&room_id)? .into_iter() - .map(|(_, pdu)| pdu.to_state_event()) + .map(|(_, pdu)| pdu.to_state_event_stub()) .collect() } else { Vec::new() @@ -2599,7 +2607,7 @@ pub fn sync_route( let pdus = db.rooms.pdus_since(&user_id, &room_id, since)?; let room_events = pdus .filter_map(|pdu| pdu.ok()) // Filter out buggy events - .map(|pdu| pdu.to_room_event()) + .map(|pdu| pdu.to_room_event_stub()) .collect(); // TODO: Only until leave point @@ -2608,6 +2616,14 @@ pub fn sync_route( .edus .roomlatests_since(&room_id, since)? .filter_map(|r| r.ok()) // Filter out buggy events + .filter_map(|r| { + if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() { + // TODO we could get rid of EventJson? + Some(EventJson::from(ev)) + } else { + None + } + }) .collect::>(); if db @@ -2618,9 +2634,9 @@ pub fn sync_route( { edus.push( serde_json::from_str( - &serde_json::to_string(&EduEvent::Typing( + &serde_json::to_string(&EduEvent::Ephemeral(AnyEphemeralRoomEvent::Typing( db.rooms.edus.roomactives_all(&room_id)?, - )) + ))) .expect("event is valid, we just created it"), ) .expect("event is valid, we just created it"), @@ -2694,7 +2710,13 @@ pub fn sync_route( .account_data .changes_since(None, &user_id, since)? .into_iter() - .map(|(_, v)| v) + .flat_map(|(_, v)| { + if let Some(EduEvent::Basic(account_event)) = v.deserialize().ok() { + Some(EventJson::from(account_event)) + } else { + None + } + }) .collect(), }, device_lists: sync_events::DeviceLists { @@ -2716,10 +2738,10 @@ pub fn sync_route( .into()) } -// #[get( -// "/_matrix/client/r0/rooms/<_room_id>/context/<_event_id>", -// data = "" -// )] +#[get( + "/_matrix/client/r0/rooms/<_room_id>/context/<_event_id>", + data = "" +)] pub fn get_context_route( db: State<'_, Database>, body: Ruma, @@ -2817,7 +2839,7 @@ pub fn get_context_route( .into()) } -// #[get("/_matrix/client/r0/rooms/<_room_id>/messages", data = "")] +#[get("/_matrix/client/r0/rooms/<_room_id>/messages", data = "")] pub fn get_message_events_route( db: State<'_, Database>, body: Ruma, @@ -2913,7 +2935,7 @@ pub fn get_message_events_route( } } -// #[get("/_matrix/client/r0/voip/turnServer")] +#[get("/_matrix/client/r0/voip/turnServer")] pub fn turn_server_route() -> ConduitResult { Err(Error::BadRequest( ErrorKind::NotFound, @@ -2921,7 +2943,7 @@ pub fn turn_server_route() -> ConduitResult { )) } -// #[post("/_matrix/client/r0/publicised_groups")] +#[post("/_matrix/client/r0/publicised_groups")] pub fn publicised_groups_route() -> ConduitResult { Err(Error::BadRequest( ErrorKind::NotFound, @@ -2929,10 +2951,10 @@ pub fn publicised_groups_route() -> ConduitResult/<_txn_id>", -// data = "" -// )] +#[put( + "/_matrix/client/r0/sendToDevice/<_event_type>/<_txn_id>", + data = "" +)] pub fn send_event_to_device_route( db: State<'_, Database>, body: Ruma, @@ -2978,7 +3000,7 @@ pub fn send_event_to_device_route( Ok(send_event_to_device::Response.into()) } -// #[get("/_matrix/media/r0/config")] +#[get("/_matrix/media/r0/config")] pub fn get_media_config_route() -> ConduitResult { Ok(get_media_config::Response { upload_size: (20_u32 * 1024 * 1024).into(), // 20 MB @@ -2986,7 +3008,7 @@ pub fn get_media_config_route() -> ConduitResult { .into()) } -// #[post("/_matrix/media/r0/upload", data = "")] +#[post("/_matrix/media/r0/upload", data = "")] pub fn create_content_route( db: State<'_, Database>, body: Ruma, @@ -3006,10 +3028,10 @@ pub fn create_content_route( Ok(create_content::Response { content_uri: mxc }.into()) } -// #[get( -// "/_matrix/media/r0/download/<_server_name>/<_media_id>", -// data = "" -// )] +#[get( + "/_matrix/media/r0/download/<_server_name>/<_media_id>", + data = "" +)] pub fn get_content_route( db: State<'_, Database>, body: Ruma, @@ -3031,10 +3053,10 @@ pub fn get_content_route( } } -// #[get( -// "/_matrix/media/r0/thumbnail/<_server_name>/<_media_id>", -// data = "" -// )] +#[get( + "/_matrix/media/r0/thumbnail/<_server_name>/<_media_id>", + data = "" +)] pub fn get_content_thumbnail_route( db: State<'_, Database>, body: Ruma, @@ -3056,7 +3078,7 @@ pub fn get_content_thumbnail_route( } } -// #[get("/_matrix/client/r0/devices", data = "")] +#[get("/_matrix/client/r0/devices", data = "")] pub fn get_devices_route( db: State<'_, Database>, body: Ruma, @@ -3072,7 +3094,7 @@ pub fn get_devices_route( Ok(get_devices::Response { devices }.into()) } -// #[get("/_matrix/client/r0/devices/<_device_id>", data = "")] +#[get("/_matrix/client/r0/devices/<_device_id>", data = "")] pub fn get_device_route( db: State<'_, Database>, body: Ruma, @@ -3088,7 +3110,7 @@ pub fn get_device_route( Ok(get_device::Response { device }.into()) } -// #[put("/_matrix/client/r0/devices/<_device_id>", data = "")] +#[put("/_matrix/client/r0/devices/<_device_id>", data = "")] pub fn update_device_route( db: State<'_, Database>, body: Ruma, @@ -3109,7 +3131,7 @@ pub fn update_device_route( Ok(update_device::Response.into()) } -// #[delete("/_matrix/client/r0/devices/<_device_id>", data = "")] +#[delete("/_matrix/client/r0/devices/<_device_id>", data = "")] pub fn delete_device_route( db: State<'_, Database>, body: Ruma, @@ -3153,7 +3175,7 @@ pub fn delete_device_route( Ok(delete_device::Response.into()) } -// #[post("/_matrix/client/r0/delete_devices", data = "")] +#[post("/_matrix/client/r0/delete_devices", data = "")] pub fn delete_devices_route( db: State<'_, Database>, body: Ruma, diff --git a/src/database/rooms/edus.rs b/src/database/rooms/edus.rs index de138b6..c352a01 100644 --- a/src/database/rooms/edus.rs +++ b/src/database/rooms/edus.rs @@ -62,6 +62,8 @@ impl RoomEdus { room_id: &RoomId, since: u64, ) -> Result>>> { + // TODO is this ^^^^^^^ + // only ever a read receipt could we just return EphemeralRoomEvent here? let mut prefix = room_id.to_string().as_bytes().to_vec(); prefix.push(0xff); diff --git a/src/pdu.rs b/src/pdu.rs index 4504ae6..73bb869 100644 --- a/src/pdu.rs +++ b/src/pdu.rs @@ -2,8 +2,8 @@ use crate::{Error, Result}; use js_int::UInt; use ruma::{ events::{ - pdu::EventHash, AnyRoomEvent, AnyStateEvent, AnyStrippedStateEventStub, EventJson, - EventType, + pdu::EventHash, AnyRoomEvent, AnyRoomEventStub, AnyStateEvent, AnyStateEventStub, + AnyStrippedStateEventStub, EventJson, EventType, }, identifiers::{EventId, RoomId, UserId}, }; @@ -78,6 +78,11 @@ impl PduEvent { Ok(()) } + pub fn to_room_event_stub(&self) -> EventJson { + let json = serde_json::to_string(&self).expect("PDUs are always valid"); + serde_json::from_str::>(&json) + .expect("EventJson::from_str always works") + } pub fn to_room_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); serde_json::from_str::>(&json) @@ -88,6 +93,11 @@ impl PduEvent { serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } + pub fn to_state_event_stub(&self) -> EventJson { + let json = serde_json::to_string(&self).expect("PDUs are always valid"); + serde_json::from_str::>(&json) + .expect("EventJson::from_str always works") + } pub fn to_stripped_state_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); serde_json::from_str::>(&json) From ddc759887010013632929ed0164b19c5eb5bec45 Mon Sep 17 00:00:00 2001 From: Devin R Date: Tue, 23 Jun 2020 18:58:39 -0400 Subject: [PATCH 03/14] Use ruma/ruma master --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index eaad710..55308b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,8 +29,8 @@ thiserror = "1.0.19" image = { version = "0.23.4", default-features = false, features = ["jpeg", "png", "gif"] } [dependencies.ruma] -git = "https://github.com/DevinR528/ruma" -branch = "matrix-sdk2" +git = "https://github.com/ruma/ruma" +# branch = "matrix-sdk2" #path = "../ruma/ruma" features = ["rand", "client-api", "federation-api"] From 84dcb885a7fb28a1472656a8e036199381c0fd19 Mon Sep 17 00:00:00 2001 From: Devin R Date: Wed, 24 Jun 2020 17:03:33 -0400 Subject: [PATCH 04/14] Return correct Errors and replace panic, fix misc review issues Remove EventJson todo comments, clean up Cargo.toml commented ruma deps. --- Cargo.toml | 14 ++----------- src/client_server.rs | 40 ++++++++++++++++---------------------- src/database/globals.rs | 2 +- src/database/rooms/edus.rs | 2 -- src/error.rs | 5 ----- 5 files changed, 20 insertions(+), 43 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 55308b5..f15c403 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,16 +29,6 @@ thiserror = "1.0.19" image = { version = "0.23.4", default-features = false, features = ["jpeg", "png", "gif"] } [dependencies.ruma] -git = "https://github.com/ruma/ruma" -# branch = "matrix-sdk2" -#path = "../ruma/ruma" +git = "https://github.com/DevinR528/ruma" +branch = "key-sign" features = ["rand", "client-api", "federation-api"] - -# These are required only until ruma-events and ruma-federation-api are merged into ruma/ruma -# [patch.crates-io] -# ruma-common = { git = "https://github.com/ruma/ruma", rev = "baa87104569b45dc07a9a7a16d3c7592ab8f4d6b" } -# ruma-serde = { git = "https://github.com/ruma/ruma", rev = "baa87104569b45dc07a9a7a16d3c7592ab8f4d6b" } -# ruma-identifiers = { git = "https://github.com/ruma/ruma", rev = "baa87104569b45dc07a9a7a16d3c7592ab8f4d6b" } -#ruma-common = { path = "../ruma/ruma-common" } -#ruma-serde = { path = "../ruma/ruma-serde" } -#ruma-identifiers = { path = "../ruma/ruma-identifiers" } diff --git a/src/client_server.rs b/src/client_server.rs index 15ced16..d3ff62c 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -602,15 +602,17 @@ pub fn get_global_account_data_route( )? .ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?; - // TODO clearly this is not ideal... - // NOTE: EventJson is no longer needed as all the enums and event structs impl ser/de - let data: Result = data.deserialize().map_err(Into::into); - match data? { - EduEvent::Basic(data) => Ok(get_global_account_data::Response { + let data: Result = data + .deserialize() + .map_err(|_| Error::bad_database("Deserialization of account data failed")); + + if let EduEvent::Basic(data) = data? { + Ok(get_global_account_data::Response { account_data: EventJson::from(data), } - .into()), - _ => panic!("timo what do i do here"), + .into()) + } else { + Err(Error::bad_database("Encountered a non account data event.")) } } @@ -2523,7 +2525,6 @@ pub fn sync_route( .filter_map(|r| r.ok()) // Filter out buggy events .filter_map(|r| { if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() { - // TODO we could get rid of EventJson? Some(EventJson::from(ev)) } else { None @@ -2554,8 +2555,8 @@ pub fn sync_route( .account_data .changes_since(Some(&room_id), &user_id, since)? .into_iter() - .flat_map(|(_, v)| { - if let Some(EduEvent::Basic(account_event)) = v.deserialize().ok() { + .filter_map(|(_, v)| { + if let Ok(EduEvent::Basic(account_event)) = v.deserialize() { Some(EventJson::from(account_event)) } else { None @@ -2618,7 +2619,6 @@ pub fn sync_route( .filter_map(|r| r.ok()) // Filter out buggy events .filter_map(|r| { if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() { - // TODO we could get rid of EventJson? Some(EventJson::from(ev)) } else { None @@ -2710,8 +2710,8 @@ pub fn sync_route( .account_data .changes_since(None, &user_id, since)? .into_iter() - .flat_map(|(_, v)| { - if let Some(EduEvent::Basic(account_event)) = v.deserialize().ok() { + .filter_map(|(_, v)| { + if let Ok(EduEvent::Basic(account_event)) = v.deserialize() { Some(EventJson::from(account_event)) } else { None @@ -2859,13 +2859,12 @@ pub fn get_message_events_route( .clone() .parse() .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Invalid `from` value."))?; + let limit = body + .limit + .try_into() + .map_or(Ok::<_, Error>(10_usize), |l: u32| Ok(l as usize))?; match body.dir { get_message_events::Direction::Forward => { - let limit = body - .limit - .try_into() - .map_or(Ok::<_, Error>(10_usize), |l: u32| Ok(l as usize))?; - let events_after = db .rooms .pdus_after(&user_id, &body.room_id, from) @@ -2897,11 +2896,6 @@ pub fn get_message_events_route( .into()) } get_message_events::Direction::Backward => { - let limit = body - .limit - .try_into() - .map_or(Ok::<_, Error>(10_usize), |l: u32| Ok(l as usize))?; - let events_before = db .rooms .pdus_until(&user_id, &body.room_id, from) diff --git a/src/database/globals.rs b/src/database/globals.rs index 00e0982..b04eebb 100644 --- a/src/database/globals.rs +++ b/src/database/globals.rs @@ -32,7 +32,7 @@ impl Globals { .unwrap_or("localhost") .to_owned(), ) - .map_err(|_| Error::bad_database("Invalid server name"))?, + .map_err(|_| Error::BadConfig("Invalid server name"))?, registration_disabled: config.get_bool("registration_disabled").unwrap_or(false), }) } diff --git a/src/database/rooms/edus.rs b/src/database/rooms/edus.rs index c352a01..de138b6 100644 --- a/src/database/rooms/edus.rs +++ b/src/database/rooms/edus.rs @@ -62,8 +62,6 @@ impl RoomEdus { room_id: &RoomId, since: u64, ) -> Result>>> { - // TODO is this ^^^^^^^ - // only ever a read receipt could we just return EphemeralRoomEvent here? let mut prefix = room_id.to_string().as_bytes().to_vec(); prefix.push(0xff); diff --git a/src/error.rs b/src/error.rs index e1af15a..7305073 100644 --- a/src/error.rs +++ b/src/error.rs @@ -25,11 +25,6 @@ pub enum Error { #[from] source: image::error::ImageError, }, - #[error("Could not deserialize json")] - SerdeError { - #[from] - source: serde_json::Error, - }, #[error("{0}")] BadConfig(&'static str), #[error("{0}")] From 63e23154f37dca1662df61c419460f682da8a8b7 Mon Sep 17 00:00:00 2001 From: Devin R Date: Fri, 26 Jun 2020 18:34:11 -0400 Subject: [PATCH 05/14] Rebase with key backups and cross signing Moved back to a fork of ruma with timo's key-backup and cross-signing branch. Ephemeral events in sync responses are EphemeralRoomEventStub (they also have no room_id like all of sync responses events) --- Cargo.lock | 2128 ++++++++++++++++++++++++++++++++++++ src/client_server.rs | 18 +- src/database.rs | 1 + src/database/rooms/edus.rs | 3 +- src/pdu.rs | 9 +- src/push_rules.rs | 15 +- 6 files changed, 2149 insertions(+), 25 deletions(-) create mode 100644 Cargo.lock diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..5a8b807 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,2128 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +[[package]] +name = "addr2line" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "602d785912f476e480434627e8732e6766b760c045bbf897d9dfaa9f4fbd399c" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler32" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" + +[[package]] +name = "arc-swap" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" + +[[package]] +name = "async-trait" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "autocfg" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" + +[[package]] +name = "backtrace" +version = "0.3.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05100821de9e028f12ae3d189176b41ee198341eb8f369956407fea2f5cc666c" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d27c3610c36aee21ce8ac510e6224498de4228ad772a171ed65643a24693a5a8" + +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +dependencies = [ + "byteorder", +] + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + +[[package]] +name = "base64" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" + +[[package]] +name = "bitflags" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" + +[[package]] +name = "blake2b_simd" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8fb2d74254a3a0b5cac33ac9f8ed0e44aa50378d9dbb2e5d83bd21ed1dc2c8a" +dependencies = [ + "arrayref", + "arrayvec", + "constant_time_eq", +] + +[[package]] +name = "bumpalo" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" + +[[package]] +name = "bytemuck" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431" + +[[package]] +name = "byteorder" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" + +[[package]] +name = "bytes" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" +dependencies = [ + "loom", +] + +[[package]] +name = "cc" +version = "1.0.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1be3409f94d7bdceeb5f5fac551039d9b3f00e25da7a74fc4d33400a0d96368" + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cloudabi" +version = "0.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +dependencies = [ + "bitflags", +] + +[[package]] +name = "color_quant" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dbbb57365263e881e805dc77d94697c9118fd94d8da011240555aa7b23445bd" + +[[package]] +name = "conduit" +version = "0.1.0" +dependencies = [ + "base64 0.12.3", + "directories", + "http", + "image", + "js_int", + "log", + "rand", + "reqwest", + "rocket", + "ruma", + "rust-argon2 0.8.2", + "serde", + "serde_json", + "sled", + "thiserror", + "tokio", +] + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "cookie" +version = "0.12.0" +source = "git+https://github.com/SergioBenitez/cookie-rs?rev=e0f3e6c#e0f3e6c4daea108d55838c56da777b36898bd223" +dependencies = [ + "base64 0.10.1", + "percent-encoding 2.1.0", + "ring", + "time", +] + +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + +[[package]] +name = "crc32fast" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "lazy_static", + "maybe-uninit", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" +dependencies = [ + "autocfg", + "cfg-if", + "lazy_static", +] + +[[package]] +name = "deflate" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" +dependencies = [ + "adler32", + "byteorder", +] + +[[package]] +name = "devise" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" +dependencies = [ + "devise_codegen", + "devise_core", +] + +[[package]] +name = "devise_codegen" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" +dependencies = [ + "devise_core", + "quote 1.0.7", +] + +[[package]] +name = "devise_core" +version = "0.3.0" +source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" +dependencies = [ + "bitflags", + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "directories" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "551a778172a450d7fc12e629ca3b0428d00f6afa9a43da1b630d54604e97371c" +dependencies = [ + "cfg-if", + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a" +dependencies = [ + "libc", + "redox_users", + "winapi 0.3.9", +] + +[[package]] +name = "dtoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" + +[[package]] +name = "encoding_rs" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8ac63f94732332f44fe654443c46f6375d1939684c17b0afb6cb56b0456e171" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding 2.1.0", +] + +[[package]] +name = "fs2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "fuchsia-zircon" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" +dependencies = [ + "bitflags", + "fuchsia-zircon-sys", +] + +[[package]] +name = "fuchsia-zircon-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" + +[[package]] +name = "futures" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" + +[[package]] +name = "futures-executor" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" + +[[package]] +name = "futures-macro" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "futures-sink" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" + +[[package]] +name = "futures-task" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "proc-macro-hack", + "proc-macro-nested", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "generator" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" +dependencies = [ + "cc", + "libc", + "log", + "rustc_version", + "winapi 0.3.9", +] + +[[package]] +name = "getrandom" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "gif" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "471d90201b3b223f3451cd4ad53e34295f16a1df17b1edf3736d47761c3981af" +dependencies = [ + "color_quant", + "lzw", +] + +[[package]] +name = "gimli" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" + +[[package]] +name = "h2" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "log", + "slab", + "tokio", + "tokio-util", +] + +[[package]] +name = "heck" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +dependencies = [ + "libc", +] + +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "httparse" +version = "1.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" + +[[package]] +name = "hyper" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "itoa", + "log", + "pin-project", + "socket2", + "time", + "tokio", + "tower-service", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-tls", +] + +[[package]] +name = "idna" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "image" +version = "0.23.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b0553fec6407d63fe2975b794dfb099f3f790bdc958823851af37b26404ab4" +dependencies = [ + "bytemuck", + "byteorder", + "gif", + "jpeg-decoder", + "num-iter", + "num-rational", + "num-traits", + "png", +] + +[[package]] +name = "indexmap" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" +dependencies = [ + "autocfg", +] + +[[package]] +name = "iovec" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +dependencies = [ + "libc", +] + +[[package]] +name = "itoa" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" + +[[package]] +name = "jpeg-decoder" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704" +dependencies = [ + "byteorder", +] + +[[package]] +name = "js-sys" +version = "0.3.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "js_int" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b2b63d60564122f2a7d6592c2f1d6c1c60e7a266b4d24715950a1ddad784f66" +dependencies = [ + "serde", +] + +[[package]] +name = "kernel32-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.71" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" + +[[package]] +name = "lock_api" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "loom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", +] + +[[package]] +name = "lzw" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d947cbb889ed21c2a84be6ffbaebf5b4e0f4340638cba0444907e38b56be084" + +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" + +[[package]] +name = "memchr" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" + +[[package]] +name = "memoffset" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "mime_guess" +version = "2.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "miniz_oxide" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +dependencies = [ + "adler32", +] + +[[package]] +name = "mio" +version = "0.6.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +dependencies = [ + "cfg-if", + "fuchsia-zircon", + "fuchsia-zircon-sys", + "iovec", + "kernel32-sys", + "libc", + "log", + "miow", + "net2", + "slab", + "winapi 0.2.8", +] + +[[package]] +name = "mio-uds" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afcb699eb26d4332647cc848492bbc15eafb26f08d0304550d5aa1f612e066f0" +dependencies = [ + "iovec", + "libc", + "mio", +] + +[[package]] +name = "miow" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +dependencies = [ + "kernel32-sys", + "net2", + "winapi 0.2.8", + "ws2_32-sys", +] + +[[package]] +name = "native-tls" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "net2" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +dependencies = [ + "cfg-if", + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "num-integer" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "object" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ab52be62400ca80aa00285d25253d7f7c437b7375c4de678f5405d3afe82ca5" + +[[package]] +name = "once_cell" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" + +[[package]] +name = "openssl" +version = "0.10.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d575eff3665419f9b83678ff2815858ad9d11567e082f5ac1814baba4e2bcb4" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "lazy_static", + "libc", + "openssl-sys", +] + +[[package]] +name = "openssl-probe" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" + +[[package]] +name = "openssl-sys" +version = "0.9.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a842db4709b604f0fe5d1170ae3565899be2ad3d9cbc72dedc789ac0511f78de" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parking_lot" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +dependencies = [ + "cfg-if", + "cloudabi", + "libc", + "redox_syscall", + "smallvec", + "winapi 0.3.9", +] + +[[package]] +name = "pear" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5320f212db967792b67cfe12bd469d08afd6318a249bd917d5c19bc92200ab8a" +dependencies = [ + "pear_codegen", +] + +[[package]] +name = "pear_codegen" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfc1c836fdc3d1ef87c348b237b5b5c4dff922156fb2d968f57734f9669768ca" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "syn 0.15.44", + "version_check", + "yansi", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pin-project" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" + +[[package]] +name = "png" +version = "0.16.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ccdd66f6fe4b2433b07e4728e9a013e43233120427046e93ceb709c3a439bf" +dependencies = [ + "bitflags", + "crc32fast", + "deflate", + "miniz_oxide", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" + +[[package]] +name = "proc-macro-hack" +version = "0.5.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" + +[[package]] +name = "proc-macro-nested" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" + +[[package]] +name = "proc-macro2" +version = "0.4.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" +dependencies = [ + "unicode-xid 0.1.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +dependencies = [ + "unicode-xid 0.2.1", +] + +[[package]] +name = "quote" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce23b6b870e8f94f81fb0a363d65d86675884b34a09043c81e5562f11c1f8e1" +dependencies = [ + "proc-macro2 0.4.30", +] + +[[package]] +name = "quote" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +dependencies = [ + "proc-macro2 1.0.18", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom", + "libc", + "rand_chacha", + "rand_core", + "rand_hc", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.1.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" + +[[package]] +name = "redox_users" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09b23093265f8d200fa7b4c2c76297f47e681c655f6f1285a8780d6a022f7431" +dependencies = [ + "getrandom", + "redox_syscall", + "rust-argon2 0.7.0", +] + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "reqwest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680" +dependencies = [ + "base64 0.12.3", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "hyper-tls", + "js-sys", + "lazy_static", + "log", + "mime", + "mime_guess", + "native-tls", + "percent-encoding 2.1.0", + "pin-project-lite", + "serde", + "serde_urlencoded", + "tokio", + "tokio-tls", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + +[[package]] +name = "ring" +version = "0.16.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "952cd6b98c85bbc30efa1ba5783b8abf12fec8b3287ffa52605b9432313e34e4" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi 0.3.9", +] + +[[package]] +name = "rocket" +version = "0.5.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4928e35ec5c4b9242f50d644282d9896d0160a10#4928e35ec5c4b9242f50d644282d9896d0160a10" +dependencies = [ + "async-trait", + "atty", + "base16", + "base64 0.11.0", + "futures", + "log", + "memchr", + "num_cpus", + "pear", + "rocket_codegen", + "rocket_http", + "state", + "time", + "tokio", + "toml", + "version_check", + "yansi", +] + +[[package]] +name = "rocket_codegen" +version = "0.5.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4928e35ec5c4b9242f50d644282d9896d0160a10#4928e35ec5c4b9242f50d644282d9896d0160a10" +dependencies = [ + "devise", + "indexmap", + "quote 1.0.7", + "rocket_http", + "version_check", + "yansi", +] + +[[package]] +name = "rocket_http" +version = "0.5.0-dev" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4928e35ec5c4b9242f50d644282d9896d0160a10#4928e35ec5c4b9242f50d644282d9896d0160a10" +dependencies = [ + "cookie", + "http", + "hyper", + "indexmap", + "log", + "mime", + "pear", + "percent-encoding 1.0.1", + "smallvec", + "state", + "time", + "tokio", + "tokio-rustls", + "unicode-xid 0.2.1", +] + +[[package]] +name = "ruma" +version = "0.1.0" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "ruma-api", + "ruma-client-api", + "ruma-common", + "ruma-events", + "ruma-federation-api", + "ruma-identifiers", + "ruma-signatures", +] + +[[package]] +name = "ruma-api" +version = "0.16.1" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "http", + "percent-encoding 2.1.0", + "ruma-api-macros", + "ruma-identifiers", + "ruma-serde", + "serde", + "serde_json", + "strum", +] + +[[package]] +name = "ruma-api-macros" +version = "0.16.1" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "ruma-client-api" +version = "0.9.0" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "http", + "js_int", + "ruma-api", + "ruma-common", + "ruma-events", + "ruma-identifiers", + "ruma-serde", + "serde", + "serde_json", + "strum", +] + +[[package]] +name = "ruma-common" +version = "0.1.3" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "js_int", + "matches", + "ruma-serde", + "serde", + "serde_json", + "strum", +] + +[[package]] +name = "ruma-events" +version = "0.21.3" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "js_int", + "ruma-common", + "ruma-events-macros", + "ruma-identifiers", + "ruma-serde", + "serde", + "serde_json", + "strum", +] + +[[package]] +name = "ruma-events-macros" +version = "0.21.3" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "ruma-federation-api" +version = "0.0.2" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "js_int", + "matches", + "ruma-api", + "ruma-events", + "ruma-identifiers", + "ruma-serde", + "serde", + "serde_json", +] + +[[package]] +name = "ruma-identifiers" +version = "0.16.2" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "rand", + "serde", + "strum", +] + +[[package]] +name = "ruma-serde" +version = "0.2.2" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "form_urlencoded", + "itoa", + "js_int", + "serde", + "serde_json", +] + +[[package]] +name = "ruma-signatures" +version = "0.6.0-dev.1" +source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +dependencies = [ + "base64 0.12.3", + "ring", + "serde_json", + "untrusted", +] + +[[package]] +name = "rust-argon2" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bc8af4bda8e1ff4932523b94d3dd20ee30a87232323eda55903ffd71d2fb017" +dependencies = [ + "base64 0.11.0", + "blake2b_simd", + "constant_time_eq", + "crossbeam-utils", +] + +[[package]] +name = "rust-argon2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dab61250775933275e84053ac235621dfb739556d5c54a2f2e9313b7cf43a19" +dependencies = [ + "base64 0.12.3", + "blake2b_simd", + "constant_time_eq", + "crossbeam-utils", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" + +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + +[[package]] +name = "rustls" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" +dependencies = [ + "base64 0.10.1", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "ryu" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" + +[[package]] +name = "schannel" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" +dependencies = [ + "lazy_static", + "winapi 0.3.9", +] + +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "sct" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "security-framework" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + +[[package]] +name = "serde" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "serde_json" +version = "1.0.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +dependencies = [ + "dtoa", + "itoa", + "serde", + "url", +] + +[[package]] +name = "signal-hook-registry" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +dependencies = [ + "arc-swap", + "libc", +] + +[[package]] +name = "slab" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" + +[[package]] +name = "sled" +version = "0.32.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdad3dc85d888056d3bd9954ffdf22d8a22701b6cd3aca4f6df4c436111898c4" +dependencies = [ + "backtrace", + "crc32fast", + "crossbeam-epoch", + "crossbeam-utils", + "fs2", + "fxhash", + "libc", + "log", + "parking_lot", +] + +[[package]] +name = "smallvec" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" + +[[package]] +name = "socket2" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "winapi 0.3.9", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "state" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" + +[[package]] +name = "strum" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" +dependencies = [ + "heck", + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "syn" +version = "0.15.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" +dependencies = [ + "proc-macro2 0.4.30", + "quote 0.6.13", + "unicode-xid 0.1.0", +] + +[[package]] +name = "syn" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "unicode-xid 0.2.1", +] + +[[package]] +name = "tempfile" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +dependencies = [ + "cfg-if", + "libc", + "rand", + "redox_syscall", + "remove_dir_all", + "winapi 0.3.9", +] + +[[package]] +name = "thiserror" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dfdd070ccd8ccb78f4ad66bf1982dc37f620ef696c6b5028fe2ed83dd3d0d08" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi 0.3.9", +] + +[[package]] +name = "tinyvec" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" + +[[package]] +name = "tokio" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-uds", + "num_cpus", + "pin-project-lite", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", +] + +[[package]] +name = "tokio-rustls" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3068d891551949b37681724d6b73666787cc63fa8e255c812a41d2513aff9775" +dependencies = [ + "futures-core", + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a70f4fcd7b3b24fb194f837560168208f669ca8cb70d0c4b862944452396343" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" +dependencies = [ + "serde", +] + +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + +[[package]] +name = "try-lock" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" + +[[package]] +name = "unicase" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +dependencies = [ + "version_check", +] + +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +dependencies = [ + "matches", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" + +[[package]] +name = "unicode-xid" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" + +[[package]] +name = "unicode-xid" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +dependencies = [ + "idna", + "matches", + "percent-encoding 2.1.0", +] + +[[package]] +name = "vcpkg" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6454029bf181f092ad1b853286f23e2c507d8e8194d01d92da4a55c274a5508c" + +[[package]] +name = "version_check" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasm-bindgen" +version = "0.2.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" +dependencies = [ + "cfg-if", + "serde", + "serde_json", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" +dependencies = [ + "quote 1.0.7", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.33", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" + +[[package]] +name = "web-sys" +version = "0.3.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-build" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "ws2_32-sys" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" +dependencies = [ + "winapi 0.2.8", + "winapi-build", +] + +[[package]] +name = "yansi" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" diff --git a/src/client_server.rs b/src/client_server.rs index d3ff62c..057db5b 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -2523,13 +2523,6 @@ pub fn sync_route( .edus .roomlatests_since(&room_id, since)? .filter_map(|r| r.ok()) // Filter out buggy events - .filter_map(|r| { - if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() { - Some(EventJson::from(ev)) - } else { - None - } - }) .collect::>(); if db @@ -2617,13 +2610,6 @@ pub fn sync_route( .edus .roomlatests_since(&room_id, since)? .filter_map(|r| r.ok()) // Filter out buggy events - .filter_map(|r| { - if let Ok(EduEvent::Ephemeral(ev)) = r.deserialize() { - Some(EventJson::from(ev)) - } else { - None - } - }) .collect::>(); if db @@ -2634,9 +2620,9 @@ pub fn sync_route( { edus.push( serde_json::from_str( - &serde_json::to_string(&EduEvent::Ephemeral(AnyEphemeralRoomEvent::Typing( + &serde_json::to_string(&ruma::events::AnyEphemeralRoomEventStub::Typing( db.rooms.edus.roomactives_all(&room_id)?, - ))) + )) .expect("event is valid, we just created it"), ) .expect("event is valid, we just created it"), diff --git a/src/database.rs b/src/database.rs index 370fde7..fcda5af 100644 --- a/src/database.rs +++ b/src/database.rs @@ -62,6 +62,7 @@ impl Database { .to_owned()) })?; + println!("{:?}", path); let db = sled::open(&path)?; info!("Opened sled database at {}", path); diff --git a/src/database/rooms/edus.rs b/src/database/rooms/edus.rs index de138b6..10f893a 100644 --- a/src/database/rooms/edus.rs +++ b/src/database/rooms/edus.rs @@ -61,7 +61,8 @@ impl RoomEdus { &self, room_id: &RoomId, since: u64, - ) -> Result>>> { + ) -> Result>>> + { let mut prefix = room_id.to_string().as_bytes().to_vec(); prefix.push(0xff); diff --git a/src/pdu.rs b/src/pdu.rs index 73bb869..2fcc3df 100644 --- a/src/pdu.rs +++ b/src/pdu.rs @@ -2,8 +2,9 @@ use crate::{Error, Result}; use js_int::UInt; use ruma::{ events::{ - pdu::EventHash, AnyRoomEvent, AnyRoomEventStub, AnyStateEvent, AnyStateEventStub, - AnyStrippedStateEventStub, EventJson, EventType, + pdu::EventHash, room::member::MemberEventContent, AnyRoomEvent, AnyRoomEventStub, + AnyStateEvent, AnyStateEventStub, AnyStrippedStateEventStub, EventJson, EventType, + StateEvent, }, identifiers::{EventId, RoomId, UserId}, }; @@ -103,9 +104,9 @@ impl PduEvent { serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } - pub fn to_member_event(&self) -> EventJson { + pub fn to_member_event(&self) -> EventJson> { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) + serde_json::from_str::>>(&json) .expect("EventJson::from_str always works") } } diff --git a/src/push_rules.rs b/src/push_rules.rs index 90e9243..cb277b9 100644 --- a/src/push_rules.rs +++ b/src/push_rules.rs @@ -1,7 +1,10 @@ +use js_int::uint; use ruma::{ - events::push_rules::{ConditionalPushRule, PatternedPushRule, PushCondition, Ruleset}, identifiers::UserId, - push::{Action, Tweak}, + push::{ + Action, ConditionalPushRule, PatternedPushRule, PushCondition, RoomMemberCountIs, Ruleset, + Tweak, + }, }; pub fn default_pushrules(user_id: &UserId) -> Ruleset { @@ -174,7 +177,9 @@ pub fn encrypted_room_one_to_one_rule() -> ConditionalPushRule { enabled: true, rule_id: ".m.rule.encrypted_room_one_to_one".to_owned(), conditions: vec![ - PushCondition::RoomMemberCount { is: "2".to_owned() }, + PushCondition::RoomMemberCount { + is: RoomMemberCountIs::from(uint!(2)..), + }, PushCondition::EventMatch { key: "type".to_owned(), pattern: "m.room.encrypted".to_owned(), @@ -194,7 +199,9 @@ pub fn room_one_to_one_rule() -> ConditionalPushRule { enabled: true, rule_id: ".m.rule.room_one_to_one".to_owned(), conditions: vec![ - PushCondition::RoomMemberCount { is: "2".to_owned() }, + PushCondition::RoomMemberCount { + is: RoomMemberCountIs::from(uint!(2)..), + }, PushCondition::EventMatch { key: "type".to_owned(), pattern: "m.room.message".to_owned(), From d02685a4fd6c4071ea9f22c7876cd87422cdb555 Mon Sep 17 00:00:00 2001 From: Devin R Date: Fri, 17 Jul 2020 16:00:39 -0400 Subject: [PATCH 06/14] Update to latest ruma/ruma commit This will most likely be the API that is released to crates.io so it should be fairly stable... --- Cargo.lock | 309 ++++++++++++++++++------------------ Cargo.toml | 6 +- src/client_server.rs | 60 +++---- src/database/globals.rs | 21 ++- src/database/key_backups.rs | 2 +- src/database/rooms/edus.rs | 2 +- src/database/users.rs | 6 +- src/pdu.rs | 16 +- 8 files changed, 205 insertions(+), 217 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a8b807..3d23fac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,13 +2,19 @@ # It is not intended for manual editing. [[package]] name = "addr2line" -version = "0.12.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "602d785912f476e480434627e8732e6766b760c045bbf897d9dfaa9f4fbd399c" +checksum = "1b6a2d3371669ab3ca9797670853d61402b03d0b4b9ebf33d677dfa720203072" dependencies = [ "gimli", ] +[[package]] +name = "adler" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee2a4ec343196209d6594e19543ae87a39f96d5534d7174822a3ad825dd6ed7e" + [[package]] name = "adler32" version = "1.1.0" @@ -21,6 +27,12 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" +[[package]] +name = "array-init" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f30bbe2f5e3d117f55bd8c7a1f9191e4a5deba9f15f595bbea4f670c59c765db" + [[package]] name = "arrayref" version = "0.3.6" @@ -41,7 +53,7 @@ checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] @@ -63,14 +75,14 @@ checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.49" +version = "0.3.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05100821de9e028f12ae3d189176b41ee198341eb8f369956407fea2f5cc666c" +checksum = "46254cf2fdcdf1badb5934448c1bcbe046a56537b3987d96c51a7afc5d03f293" dependencies = [ "addr2line", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.4.0", "object", "rustc-demangle", ] @@ -139,18 +151,15 @@ checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "bytes" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" -dependencies = [ - "loom", -] +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "cc" -version = "1.0.55" +version = "1.0.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1be3409f94d7bdceeb5f5fac551039d9b3f00e25da7a74fc4d33400a0d96368" +checksum = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" [[package]] name = "cfg-if" @@ -160,9 +169,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" [[package]] name = "cloudabi" -version = "0.0.3" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" dependencies = [ "bitflags", ] @@ -265,9 +274,9 @@ dependencies = [ [[package]] name = "deflate" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e5d2a2273fed52a7f947ee55b092c4057025d7a3e04e5ecdbd25d6c3fb1bd7" +checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" dependencies = [ "adler32", "byteorder", @@ -299,7 +308,7 @@ dependencies = [ "bitflags", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] @@ -452,7 +461,7 @@ dependencies = [ "proc-macro-hack", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] @@ -499,19 +508,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "generator" -version = "0.6.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" -dependencies = [ - "cc", - "libc", - "log", - "rustc_version", - "winapi 0.3.9", -] - [[package]] name = "getrandom" version = "0.1.14" @@ -535,15 +531,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc8e0c9bce37868955864dbecd2b1ab2bdf967e6f28066d65aaac620444b65c" +checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" [[package]] name = "h2" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" dependencies = [ "bytes", "fnv", @@ -552,10 +548,10 @@ dependencies = [ "futures-util", "http", "indexmap", - "log", "slab", "tokio", "tokio-util", + "tracing", ] [[package]] @@ -569,9 +565,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9586eedd4ce6b3c498bc3b4dd92fc9f11166aa908a914071953768066c67909" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ "libc", ] @@ -605,9 +601,9 @@ checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] name = "hyper" -version = "0.13.6" +version = "0.13.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" +checksum = "3e68a8dd9716185d9e64ea473ea6ef63529252e3e27623295a0378a19665d5eb" dependencies = [ "bytes", "futures-channel", @@ -618,20 +614,20 @@ dependencies = [ "http-body", "httparse", "itoa", - "log", "pin-project", "socket2", "time", "tokio", "tower-service", + "tracing", "want", ] [[package]] name = "hyper-tls" -version = "0.4.1" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3adcd308402b9553630734e9c36b77a7e48b3821251ca2493e8cd596763aafaa" +checksum = "d979acc56dcb5b8dddba3917601745e877576475aa046df3226eabdecef78eed" dependencies = [ "bytes", "hyper", @@ -653,9 +649,9 @@ dependencies = [ [[package]] name = "image" -version = "0.23.6" +version = "0.23.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b0553fec6407d63fe2975b794dfb099f3f790bdc958823851af37b26404ab4" +checksum = "a2397fc43bd5648b7117aabb3c5e62d0e62c194826ec77b0b4d0c41e62744635" dependencies = [ "bytemuck", "byteorder", @@ -676,6 +672,12 @@ dependencies = [ "autocfg", ] +[[package]] +name = "instant" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485" + [[package]] name = "iovec" version = "0.1.4" @@ -693,18 +695,18 @@ checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "jpeg-decoder" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b47b4c4e017b01abdc5bcc126d2d1002e5a75bbe3ce73f9f4f311a916363704" +checksum = "cc797adac5f083b8ff0ca6f6294a999393d76e197c36488e2ef732c4715f6fa3" dependencies = [ "byteorder", ] [[package]] name = "js-sys" -version = "0.3.40" +version = "0.3.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce10c23ad2ea25ceca0093bd3192229da4c5b3c0f2de499c1ecac0d98d452177" +checksum = "52732a3d3ad72c58ad2dc70624f9c17b46ecd0943b9a4f1ee37c4c18c5d983e2" dependencies = [ "wasm-bindgen", ] @@ -736,39 +738,28 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.71" +version = "0.2.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9457b06509d27052635f90d6466700c65095fdf75409b3fbdd903e988b886f49" +checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" [[package]] name = "lock_api" -version = "0.3.4" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" +checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" dependencies = [ "scopeguard", ] [[package]] name = "log" -version = "0.4.8" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ "cfg-if", ] -[[package]] -name = "loom" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" -dependencies = [ - "cfg-if", - "generator", - "scoped-tls", -] - [[package]] name = "lzw" version = "0.10.0" @@ -795,9 +786,9 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "memoffset" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4fc2c02a7e374099d4ee95a193111f72d2110197fe200272371758f6c3643d8" +checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" dependencies = [ "autocfg", ] @@ -827,6 +818,15 @@ dependencies = [ "adler32", ] +[[package]] +name = "miniz_oxide" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be0f75932c1f6cfae3c04000e40114adf955636e19040f9c0a2c380702aa1c7f" +dependencies = [ + "adler", +] + [[package]] name = "mio" version = "0.6.22" @@ -996,22 +996,24 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e" +checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" dependencies = [ + "instant", "lock_api", "parking_lot_core", ] [[package]] name = "parking_lot_core" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ "cfg-if", "cloudabi", + "instant", "libc", "redox_syscall", "smallvec", @@ -1069,7 +1071,7 @@ checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] @@ -1086,20 +1088,20 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05da548ad6865900e60eaba7f589cc0783590a92e940c26953ff81ddbab2d677" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" [[package]] name = "png" -version = "0.16.5" +version = "0.16.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ccdd66f6fe4b2433b07e4728e9a013e43233120427046e93ceb709c3a439bf" +checksum = "c150bf7479fafe3dd8740dbe48cc33b2a3efb7b0fe3483aced8bbc39f6d0238d" dependencies = [ "bitflags", "crc32fast", "deflate", - "miniz_oxide", + "miniz_oxide 0.3.7", ] [[package]] @@ -1199,9 +1201,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84" +checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_users" @@ -1333,7 +1335,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.1.0" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "ruma-api", "ruma-client-api", @@ -1347,7 +1349,7 @@ dependencies = [ [[package]] name = "ruma-api" version = "0.16.1" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "http", "percent-encoding 2.1.0", @@ -1362,17 +1364,18 @@ dependencies = [ [[package]] name = "ruma-api-macros" version = "0.16.1" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ + "matches", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] name = "ruma-client-api" version = "0.9.0" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "http", "js_int", @@ -1389,7 +1392,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.1.3" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "js_int", "matches", @@ -1402,7 +1405,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.21.3" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "js_int", "ruma-common", @@ -1417,21 +1420,23 @@ dependencies = [ [[package]] name = "ruma-events-macros" version = "0.21.3" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ + "matches", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] name = "ruma-federation-api" version = "0.0.2" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "js_int", "matches", "ruma-api", + "ruma-common", "ruma-events", "ruma-identifiers", "ruma-serde", @@ -1441,9 +1446,10 @@ dependencies = [ [[package]] name = "ruma-identifiers" -version = "0.16.2" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +version = "0.17.0-pre.1" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ + "matches", "rand", "serde", "strum", @@ -1452,7 +1458,7 @@ dependencies = [ [[package]] name = "ruma-serde" version = "0.2.2" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "form_urlencoded", "itoa", @@ -1464,7 +1470,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.6.0-dev.1" -source = "git+https://github.com/DevinR528/ruma?branch=key-sign#00edba94afa930c3a9674ac5565aa0c930b1d592" +source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" dependencies = [ "base64 0.12.3", "ring", @@ -1502,15 +1508,6 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver", -] - [[package]] name = "rustls" version = "0.16.0" @@ -1540,12 +1537,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "scoped-tls" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" - [[package]] name = "scopeguard" version = "1.1.0" @@ -1585,21 +1576,6 @@ dependencies = [ "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.114" @@ -1617,14 +1593,14 @@ checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] name = "serde_json" -version = "1.0.55" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2c5d7e739bc07a3e73381a39d61fdb5f671c60c1df26a130690665803d8226" +checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" dependencies = [ "itoa", "ryu", @@ -1661,10 +1637,11 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "sled" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdad3dc85d888056d3bd9954ffdf22d8a22701b6cd3aca4f6df4c436111898c4" +checksum = "7e3dbbb8ee10611bd1d020767c27599ccbbf8365f7e0ed7e54429cc8b9433ad8" dependencies = [ + "array-init", "backtrace", "crc32fast", "crossbeam-epoch", @@ -1678,9 +1655,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4" +checksum = "3757cb9d89161a2f24e1cf78efa0c1fcff485d18e3f55e0aa3480824ddaa0f3f" [[package]] name = "socket2" @@ -1724,7 +1701,7 @@ dependencies = [ "heck", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] @@ -1740,9 +1717,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8d5d96e8cbb005d6959f119f773bfaebb5684296108fb32600c00cde305b2cd" +checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", @@ -1780,7 +1757,7 @@ checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] @@ -1830,7 +1807,7 @@ checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", ] [[package]] @@ -1885,10 +1862,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] -name = "try-lock" -version = "0.2.2" +name = "tracing" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" +checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" +dependencies = [ + "cfg-if", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94ae75f0d28ae10786f3b1895c55fe72e79928fd5ccdebb5438c75e93fec178f" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "unicase" @@ -1982,9 +1979,9 @@ checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" [[package]] name = "wasm-bindgen" -version = "0.2.63" +version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2dc4aa152834bc334f506c1a06b866416a8b6697d5c9f75b9a689c8486def0" +checksum = "f3edbcc9536ab7eababcc6d2374a0b7bfe13a2b6d562c5e07f370456b1a8f33d" dependencies = [ "cfg-if", "serde", @@ -1994,24 +1991,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.63" +version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded84f06e0ed21499f6184df0e0cb3494727b0c5da89534e0fcc55c51d812101" +checksum = "89ed2fb8c84bfad20ea66b26a3743f3e7ba8735a69fe7d95118c33ec8fc1244d" dependencies = [ "bumpalo", "lazy_static", "log", "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.13" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64487204d863f109eb77e8462189d111f27cb5712cc9fdb3461297a76963a2f6" +checksum = "41ad6e4e8b2b7f8c90b6e09a9b590ea15cb0d1dbe28502b5a405cd95d1981671" dependencies = [ "cfg-if", "js-sys", @@ -2021,9 +2018,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.63" +version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "838e423688dac18d73e31edce74ddfac468e37b1506ad163ffaf0a46f703ffe3" +checksum = "eb071268b031a64d92fc6cf691715ca5a40950694d8f683c5bb43db7c730929e" dependencies = [ "quote 1.0.7", "wasm-bindgen-macro-support", @@ -2031,28 +2028,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.63" +version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3156052d8ec77142051a533cdd686cba889537b213f948cd1d20869926e68e92" +checksum = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6" dependencies = [ "proc-macro2 1.0.18", "quote 1.0.7", - "syn 1.0.33", + "syn 1.0.34", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.63" +version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ba19973a58daf4db6f352eda73dc0e289493cd29fb2632eb172085b6521acd" +checksum = "72b6c0220ded549d63860c78c38f3bcc558d1ca3f4efa74942c536ddbbb55e87" [[package]] name = "web-sys" -version = "0.3.40" +version = "0.3.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b72fe77fd39e4bd3eaa4412fd299a0be6b3dfe9d2597e2f1c20beb968f41d17" +checksum = "8be2398f326b7ba09815d0b403095f34dd708579220d099caae89be0b32137b2" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index f15c403..514a178 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,6 +29,6 @@ thiserror = "1.0.19" image = { version = "0.23.4", default-features = false, features = ["jpeg", "png", "gif"] } [dependencies.ruma] -git = "https://github.com/DevinR528/ruma" -branch = "key-sign" -features = ["rand", "client-api", "federation-api"] +git = "https://github.com/ruma/ruma" +features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"] +rev = "848b225" diff --git a/src/client_server.rs b/src/client_server.rs index 057db5b..efe6973 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -220,7 +220,7 @@ pub fn register_route( Ok(register::Response { access_token: Some(token), user_id, - device_id: Some(device_id), + device_id: Some(device_id.into_boxed_str()), } .into()) } @@ -268,7 +268,7 @@ pub fn login_route( .body .device_id .clone() - .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH)); + .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into_boxed_str()); // Generate a new token for the device let token = utils::random_string(TOKEN_LENGTH); @@ -285,7 +285,7 @@ pub fn login_route( user_id, access_token: token, home_server: Some(db.globals.server_name().to_string()), - device_id, + device_id: device_id.to_string(), well_known: None, } .into()) @@ -898,7 +898,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.to_owned(), keys); + container.insert(device_id.to_owned().into_boxed_str(), keys); } } device_keys.insert(user_id.clone(), container); @@ -917,7 +917,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.clone(), keys); + container.insert(device_id.to_string().into_boxed_str(), keys); } device_keys.insert(user_id.clone(), container); } @@ -1214,21 +1214,19 @@ pub fn create_room_route( } })?; + let mut content = ruma::events::room::create::CreateEventContent::new(user_id.clone()); + content.federate = body.creation_content.as_ref().map_or(true, |c| c.federate); + content.predecessor = body + .creation_content + .as_ref() + .and_then(|c| c.predecessor.clone()); + content.room_version = RoomVersionId::version_6(); // 1. The room create event db.rooms.append_pdu( room_id.clone(), user_id.clone(), EventType::RoomCreate, - serde_json::to_value(ruma::events::room::create::CreateEventContent { - creator: user_id.clone(), - federate: body.creation_content.as_ref().map_or(true, |c| c.federate), - predecessor: body - .creation_content - .as_ref() - .and_then(|c| c.predecessor.clone()), - room_version: RoomVersionId::version_6(), - }) - .expect("event is valid, we just created it"), + serde_json::to_value(content).expect("event is valid, we just created it"), None, Some("".to_owned()), None, @@ -1329,9 +1327,9 @@ pub fn create_room_route( room_id.clone(), user_id.clone(), EventType::RoomHistoryVisibility, - serde_json::to_value(history_visibility::HistoryVisibilityEventContent { - history_visibility: history_visibility::HistoryVisibility::Shared, - }) + serde_json::to_value(history_visibility::HistoryVisibilityEventContent::new( + history_visibility::HistoryVisibility::Shared, + )) .expect("event is valid, we just created it"), None, Some("".to_owned()), @@ -1345,15 +1343,13 @@ pub fn create_room_route( user_id.clone(), EventType::RoomGuestAccess, match preset { - create_room::RoomPreset::PublicChat => { - serde_json::to_value(guest_access::GuestAccessEventContent { - guest_access: guest_access::GuestAccess::Forbidden, - }) - .expect("event is valid, we just created it") - } - _ => serde_json::to_value(guest_access::GuestAccessEventContent { - guest_access: guest_access::GuestAccess::CanJoin, - }) + create_room::RoomPreset::PublicChat => serde_json::to_value( + guest_access::GuestAccessEventContent::new(guest_access::GuestAccess::Forbidden), + ) + .expect("event is valid, we just created it"), + _ => serde_json::to_value(guest_access::GuestAccessEventContent::new( + guest_access::GuestAccess::CanJoin, + )) .expect("event is valid, we just created it"), }, None, @@ -2567,11 +2563,7 @@ pub fn sync_route( notification_count, }, timeline: sync_events::Timeline { - limited: if limited || joined_since_last_sync { - Some(true) - } else { - None - }, + limited: limited || joined_since_last_sync, prev_batch, events: room_events, }, @@ -2620,7 +2612,7 @@ pub fn sync_route( { edus.push( serde_json::from_str( - &serde_json::to_string(&ruma::events::AnyEphemeralRoomEventStub::Typing( + &serde_json::to_string(&ruma::events::AnySyncEphemeralRoomEvent::Typing( db.rooms.edus.roomactives_all(&room_id)?, )) .expect("event is valid, we just created it"), @@ -2632,7 +2624,7 @@ pub fn sync_route( let left_room = sync_events::LeftRoom { account_data: sync_events::AccountData { events: Vec::new() }, timeline: sync_events::Timeline { - limited: Some(false), + limited: false, prev_batch: Some(next_batch.clone()), events: room_events, }, diff --git a/src/database/globals.rs b/src/database/globals.rs index b04eebb..d307150 100644 --- a/src/database/globals.rs +++ b/src/database/globals.rs @@ -1,14 +1,14 @@ -use std::convert::TryFrom; +use std::convert::TryInto; use crate::{utils, Error, Result}; -use ruma::identifiers::{ServerName, ServerNameRef}; +use ruma::identifiers::ServerName; pub const COUNTER: &str = "c"; pub struct Globals { pub(super) globals: sled::Tree, keypair: ruma::signatures::Ed25519KeyPair, reqwest_client: reqwest::Client, - server_name: ServerName, + server_name: Box, registration_disabled: bool, } @@ -26,13 +26,12 @@ impl Globals { globals, keypair, reqwest_client: reqwest::Client::new(), - server_name: ServerName::try_from( - config - .get_str("server_name") - .unwrap_or("localhost") - .to_owned(), - ) - .map_err(|_| Error::BadConfig("Invalid server name"))?, + server_name: config + .get_str("server_name") + .unwrap_or("localhost") + .to_string() + .try_into() + .map_err(|_| crate::Error::bad_database("Private or public keys are invalid."))?, registration_disabled: config.get_bool("registration_disabled").unwrap_or(false), }) } @@ -64,7 +63,7 @@ impl Globals { }) } - pub fn server_name(&self) -> ServerNameRef<'_> { + pub fn server_name(&self) -> &ServerName { self.server_name.as_ref() } diff --git a/src/database/key_backups.rs b/src/database/key_backups.rs index 991931b..eb31b8d 100644 --- a/src/database/key_backups.rs +++ b/src/database/key_backups.rs @@ -2,7 +2,7 @@ use crate::{utils, Error, Result}; use ruma::{ api::client::{ error::ErrorKind, - r0::backup::{get_backup_keys::Sessions, BackupAlgorithm, KeyData}, + r0::backup::{BackupAlgorithm, KeyData, Sessions}, }, identifiers::{RoomId, UserId}, }; diff --git a/src/database/rooms/edus.rs b/src/database/rooms/edus.rs index 10f893a..0b3ac57 100644 --- a/src/database/rooms/edus.rs +++ b/src/database/rooms/edus.rs @@ -61,7 +61,7 @@ impl RoomEdus { &self, room_id: &RoomId, since: u64, - ) -> Result>>> + ) -> Result>>> { let mut prefix = room_id.to_string().as_bytes().to_vec(); prefix.push(0xff); diff --git a/src/database/users.rs b/src/database/users.rs index 4e2e1a2..b755b18 100644 --- a/src/database/users.rs +++ b/src/database/users.rs @@ -9,7 +9,7 @@ use ruma::{ }, }, events::{AnyToDeviceEvent, EventJson, EventType}, - identifiers::UserId, + identifiers::{DeviceId, UserId}, }; use std::{collections::BTreeMap, convert::TryFrom, time::SystemTime}; @@ -168,7 +168,7 @@ impl Users { pub fn create_device( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, token: &str, initial_device_display_name: Option, ) -> Result<()> { @@ -182,7 +182,7 @@ impl Users { self.userdeviceid_metadata.insert( userdeviceid, serde_json::to_string(&Device { - device_id: device_id.to_owned(), + device_id: device_id.to_string().into_boxed_str(), display_name: initial_device_display_name, last_seen_ip: None, // TODO last_seen_ts: Some(SystemTime::now()), diff --git a/src/pdu.rs b/src/pdu.rs index 2fcc3df..403e699 100644 --- a/src/pdu.rs +++ b/src/pdu.rs @@ -2,8 +2,8 @@ use crate::{Error, Result}; use js_int::UInt; use ruma::{ events::{ - pdu::EventHash, room::member::MemberEventContent, AnyRoomEvent, AnyRoomEventStub, - AnyStateEvent, AnyStateEventStub, AnyStrippedStateEventStub, EventJson, EventType, + pdu::EventHash, room::member::MemberEventContent, AnyRoomEvent, AnyStateEvent, + AnyStrippedStateEvent, AnySyncRoomEvent, AnySyncStateEvent, EventJson, EventType, StateEvent, }, identifiers::{EventId, RoomId, UserId}, @@ -79,9 +79,9 @@ impl PduEvent { Ok(()) } - pub fn to_room_event_stub(&self) -> EventJson { + pub fn to_room_event_stub(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) + serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } pub fn to_room_event(&self) -> EventJson { @@ -94,14 +94,14 @@ impl PduEvent { serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } - pub fn to_state_event_stub(&self) -> EventJson { + pub fn to_state_event_stub(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) + serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } - pub fn to_stripped_state_event(&self) -> EventJson { + pub fn to_stripped_state_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) + serde_json::from_str::>(&json) .expect("EventJson::from_str always works") } pub fn to_member_event(&self) -> EventJson> { From 59cbf202e47e729dafb474ef46b4825fbd9af37d Mon Sep 17 00:00:00 2001 From: Devin R Date: Fri, 17 Jul 2020 16:05:53 -0400 Subject: [PATCH 07/14] Cargo.lock updated while rebasing --- Cargo.lock | 425 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 409 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d23fac..79973c0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -21,6 +21,61 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" +[[package]] +name = "aead" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" +dependencies = [ + "aes-soft", + "aesni", + "block-cipher-trait", +] + +[[package]] +name = "aes-gcm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" +dependencies = [ + "aead", + "aes", + "block-cipher-trait", + "ghash", + "subtle 2.2.3", + "zeroize", +] + +[[package]] +name = "aes-soft" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" +dependencies = [ + "block-cipher-trait", + "byteorder", + "opaque-debug", +] + +[[package]] +name = "aesni" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +dependencies = [ + "block-cipher-trait", + "opaque-debug", +] + [[package]] name = "arc-swap" version = "0.4.7" @@ -56,6 +111,12 @@ dependencies = [ "syn 1.0.34", ] +[[package]] +name = "atomic" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64f46ca51dca4837f1520754d1c8c36636356b81553d928dc9c177025369a06e" + [[package]] name = "atty" version = "0.2.14" @@ -88,10 +149,10 @@ dependencies = [ ] [[package]] -name = "base16" -version = "0.2.1" +name = "base-x" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d27c3610c36aee21ce8ac510e6224498de4228ad772a171ed65643a24693a5a8" +checksum = "1b20b618342cf9891c292c4f5ac2cde7287cc5c87e87e9c769d617793607dec1" [[package]] name = "base64" @@ -114,6 +175,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff" +[[package]] +name = "binascii" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "383d29d513d8764dcdc42ea295d979eb99c3c9f00607b3692cf68a431f7dca72" + [[package]] name = "bitflags" version = "1.2.1" @@ -131,12 +198,48 @@ dependencies = [ "constant_time_eq", ] +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array", +] + +[[package]] +name = "block-cipher-trait" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + [[package]] name = "bumpalo" version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "bytemuck" version = "1.2.0" @@ -212,13 +315,17 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "cookie" -version = "0.12.0" -source = "git+https://github.com/SergioBenitez/cookie-rs?rev=e0f3e6c#e0f3e6c4daea108d55838c56da777b36898bd223" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca761767cf3fa9068cc893ec8c247a22d0fd0535848e65640c0548bd1f8bbb36" dependencies = [ - "base64 0.10.1", + "aes-gcm", + "base64 0.12.3", + "hkdf", "percent-encoding 2.1.0", - "ring", - "time", + "rand", + "sha2", + "time 0.2.16", ] [[package]] @@ -272,6 +379,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "crypto-mac" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +dependencies = [ + "generic-array", + "subtle 1.0.0", +] + [[package]] name = "deflate" version = "0.8.6" @@ -311,6 +428,15 @@ dependencies = [ "syn 1.0.34", ] +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array", +] + [[package]] name = "directories" version = "2.0.2" @@ -332,6 +458,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "dtoa" version = "0.4.6" @@ -347,6 +479,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + [[package]] name = "fnv" version = "1.0.7" @@ -508,6 +646,15 @@ dependencies = [ "byteorder", ] +[[package]] +name = "generic-array" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +dependencies = [ + "typenum", +] + [[package]] name = "getrandom" version = "0.1.14" @@ -519,6 +666,15 @@ dependencies = [ "wasi", ] +[[package]] +name = "ghash" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" +dependencies = [ + "polyval", +] + [[package]] name = "gif" version = "0.10.3" @@ -535,6 +691,12 @@ version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aaf91faf136cb47367fa430cd46e37a788775e7fa104f8b4bcb3861dc389b724" +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + [[package]] name = "h2" version = "0.2.6" @@ -572,6 +734,26 @@ dependencies = [ "libc", ] +[[package]] +name = "hkdf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" +dependencies = [ + "digest", + "hmac", +] + +[[package]] +name = "hmac" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +dependencies = [ + "crypto-mac", + "digest", +] + [[package]] name = "http" version = "0.2.1" @@ -616,7 +798,7 @@ dependencies = [ "itoa", "pin-project", "socket2", - "time", + "time 0.1.43", "tokio", "tower-service", "tracing", @@ -961,6 +1143,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b631f7e854af39a1739f401cf34a8a013dfe09eac4fa4dba91e9768bd28168d" +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + [[package]] name = "openssl" version = "0.10.30" @@ -1104,6 +1292,16 @@ dependencies = [ "miniz_oxide 0.3.7", ] +[[package]] +name = "polyval" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" +dependencies = [ + "cfg-if", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.8" @@ -1216,6 +1414,26 @@ dependencies = [ "rust-argon2 0.7.0", ] +[[package]] +name = "ref-cast" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "745c1787167ddae5569661d5ffb8b25ae5fedbf46717eaa92d652221cec72623" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "syn 1.0.34", +] + [[package]] name = "remove_dir_all" version = "0.5.3" @@ -1277,21 +1495,22 @@ dependencies = [ [[package]] name = "rocket" version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4928e35ec5c4b9242f50d644282d9896d0160a10#4928e35ec5c4b9242f50d644282d9896d0160a10" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=33e95f49008dcbc8dc51da7d37e0570059176b73#33e95f49008dcbc8dc51da7d37e0570059176b73" dependencies = [ "async-trait", + "atomic", "atty", - "base16", - "base64 0.11.0", + "binascii", "futures", "log", "memchr", "num_cpus", "pear", + "ref-cast", "rocket_codegen", "rocket_http", "state", - "time", + "time 0.2.16", "tokio", "toml", "version_check", @@ -1301,9 +1520,10 @@ dependencies = [ [[package]] name = "rocket_codegen" version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4928e35ec5c4b9242f50d644282d9896d0160a10#4928e35ec5c4b9242f50d644282d9896d0160a10" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=33e95f49008dcbc8dc51da7d37e0570059176b73#33e95f49008dcbc8dc51da7d37e0570059176b73" dependencies = [ "devise", + "glob", "indexmap", "quote 1.0.7", "rocket_http", @@ -1314,7 +1534,7 @@ dependencies = [ [[package]] name = "rocket_http" version = "0.5.0-dev" -source = "git+https://github.com/SergioBenitez/Rocket.git?rev=4928e35ec5c4b9242f50d644282d9896d0160a10#4928e35ec5c4b9242f50d644282d9896d0160a10" +source = "git+https://github.com/SergioBenitez/Rocket.git?rev=33e95f49008dcbc8dc51da7d37e0570059176b73#33e95f49008dcbc8dc51da7d37e0570059176b73" dependencies = [ "cookie", "http", @@ -1324,9 +1544,10 @@ dependencies = [ "mime", "pear", "percent-encoding 1.0.1", + "ref-cast", "smallvec", "state", - "time", + "time 0.2.16", "tokio", "tokio-rustls", "unicode-xid 0.2.1", @@ -1508,6 +1729,15 @@ version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c691c0e608126e00913e33f0ccf3727d5fc84573623b8d65b2df340b5201783" +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" +dependencies = [ + "semver", +] + [[package]] name = "rustls" version = "0.16.0" @@ -1576,6 +1806,21 @@ dependencies = [ "libc", ] +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" + [[package]] name = "serde" version = "1.0.114" @@ -1619,6 +1864,24 @@ dependencies = [ "url", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + +[[package]] +name = "sha2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +dependencies = [ + "block-buffer", + "digest", + "fake-simd", + "opaque-debug", +] + [[package]] name = "signal-hook-registry" version = "1.2.0" @@ -1677,12 +1940,70 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "standback" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0437cfb83762844799a60e1e3b489d5ceb6a650fbacb86437badc1b6d87b246" +dependencies = [ + "version_check", +] + [[package]] name = "state" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028" +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2 1.0.18", + "quote 1.0.7", + "serde", + "serde_derive", + "syn 1.0.34", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2 1.0.18", + "quote 1.0.7", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn 1.0.34", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "strum" version = "0.18.0" @@ -1704,6 +2025,18 @@ dependencies = [ "syn 1.0.34", ] +[[package]] +name = "subtle" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" + +[[package]] +name = "subtle" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" + [[package]] name = "syn" version = "0.15.44" @@ -1770,6 +2103,44 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "time" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a51cadc5b1eec673a685ff7c33192ff7b7603d0b75446fb354939ee615acb15" +dependencies = [ + "cfg-if", + "libc", + "standback", + "stdweb", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9b6e9f095bc105e183e3cd493d72579be3181ad4004fceb01adbe9eecab2d" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" +dependencies = [ + "proc-macro-hack", + "proc-macro2 1.0.18", + "quote 1.0.7", + "standback", + "syn 1.0.34", +] + [[package]] name = "tinyvec" version = "0.3.3" @@ -1887,6 +2258,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" +[[package]] +name = "typenum" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" + [[package]] name = "unicase" version = "2.6.0" @@ -1932,6 +2309,16 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" +[[package]] +name = "universal-hash" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" +dependencies = [ + "generic-array", + "subtle 2.2.3", +] + [[package]] name = "untrusted" version = "0.7.1" @@ -2123,3 +2510,9 @@ name = "yansi" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" + +[[package]] +name = "zeroize" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" From 029c60be783519249aeba845fd5ceff10b239d43 Mon Sep 17 00:00:00 2001 From: Devin R Date: Fri, 17 Jul 2020 19:52:04 -0400 Subject: [PATCH 08/14] Replace to_string into_boxed_str with into --- src/client_server.rs | 8 ++++---- src/database/users.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/client_server.rs b/src/client_server.rs index efe6973..1300bff 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -220,7 +220,7 @@ pub fn register_route( Ok(register::Response { access_token: Some(token), user_id, - device_id: Some(device_id.into_boxed_str()), + device_id: Some(device_id.into()), } .into()) } @@ -268,7 +268,7 @@ pub fn login_route( .body .device_id .clone() - .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into_boxed_str()); + .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into()); // Generate a new token for the device let token = utils::random_string(TOKEN_LENGTH); @@ -898,7 +898,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.to_owned().into_boxed_str(), keys); + container.insert(device_id.into(), keys); } } device_keys.insert(user_id.clone(), container); @@ -917,7 +917,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.to_string().into_boxed_str(), keys); + container.insert(device_id.as_ref().into(), keys); } device_keys.insert(user_id.clone(), container); } diff --git a/src/database/users.rs b/src/database/users.rs index b755b18..b103691 100644 --- a/src/database/users.rs +++ b/src/database/users.rs @@ -182,7 +182,7 @@ impl Users { self.userdeviceid_metadata.insert( userdeviceid, serde_json::to_string(&Device { - device_id: device_id.to_string().into_boxed_str(), + device_id: device_id.into(), display_name: initial_device_display_name, last_seen_ip: None, // TODO last_seen_ts: Some(SystemTime::now()), From 75959cdc10f5e2036107ad02d68ee782e452ab53 Mon Sep 17 00:00:00 2001 From: Devin R Date: Sat, 18 Jul 2020 08:21:25 -0400 Subject: [PATCH 09/14] Resolve stying review issues --- Cargo.toml | 6 +---- src/client_server.rs | 45 +++++++++++++++++++------------------- src/database.rs | 1 - src/database/globals.rs | 2 +- src/database/rooms/edus.rs | 36 ++++++++++++++++++++++++++++-- 5 files changed, 59 insertions(+), 31 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 514a178..80785c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,8 +27,4 @@ reqwest = "0.10.6" base64 = "0.12.1" thiserror = "1.0.19" image = { version = "0.23.4", default-features = false, features = ["jpeg", "png", "gif"] } - -[dependencies.ruma] -git = "https://github.com/ruma/ruma" -features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"] -rev = "848b225" +ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"], rev = "848b225" } diff --git a/src/client_server.rs b/src/client_server.rs index 1300bff..c83f9e2 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -64,7 +64,7 @@ use ruma::{ canonical_alias, guest_access, history_visibility, join_rules, member, name, redaction, topic, }, - AnyBasicEvent, AnyEphemeralRoomEvent, AnyEvent as EduEvent, EventJson, EventType, + AnyBasicEvent, AnyEphemeralRoomEvent, AnyEvent, EventJson, EventType, }, identifiers::{RoomAliasId, RoomId, RoomVersionId, UserId}, }; @@ -285,7 +285,7 @@ pub fn login_route( user_id, access_token: token, home_server: Some(db.globals.server_name().to_string()), - device_id: device_id.to_string(), + device_id: device_id.into(), well_known: None, } .into()) @@ -479,7 +479,7 @@ pub fn get_pushrules_all_route( ) -> ConduitResult { let user_id = body.user_id.as_ref().expect("user is authenticated"); - if let EduEvent::Basic(AnyBasicEvent::PushRules(pushrules)) = db + if let AnyEvent::Basic(AnyBasicEvent::PushRules(pushrules)) = db .account_data .get(None, &user_id, &EventType::PushRules)? .ok_or(Error::BadRequest( @@ -602,13 +602,13 @@ pub fn get_global_account_data_route( )? .ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?; - let data: Result = data + let data: AnyEvent = data .deserialize() - .map_err(|_| Error::bad_database("Deserialization of account data failed")); + .map_err(|_| Error::bad_database("Deserialization of account data failed"))?; - if let EduEvent::Basic(data) = data? { + if let AnyEvent::Basic(data) = data { Ok(get_global_account_data::Response { - account_data: EventJson::from(data), + account_data: data.into(), } .into()) } else { @@ -1145,7 +1145,7 @@ pub fn set_read_marker_route( db.rooms.edus.roomlatest_update( &user_id, &body.room_id, - EduEvent::Ephemeral(AnyEphemeralRoomEvent::Receipt( + AnyEvent::Ephemeral(AnyEphemeralRoomEvent::Receipt( ruma::events::receipt::ReceiptEvent { content: ruma::events::receipt::ReceiptEventContent(receipt_content), room_id: body.room_id.clone(), @@ -1221,6 +1221,7 @@ pub fn create_room_route( .as_ref() .and_then(|c| c.predecessor.clone()); content.room_version = RoomVersionId::version_6(); + // 1. The room create event db.rooms.append_pdu( room_id.clone(), @@ -2511,7 +2512,7 @@ pub fn sync_route( let room_events = pdus .into_iter() - .map(|pdu| pdu.to_room_event_stub()) + .map(|pdu| pdu.to_sync_room_event()) .collect::>(); let mut edus = db @@ -2529,7 +2530,7 @@ pub fn sync_route( { edus.push( serde_json::from_str( - &serde_json::to_string(&EduEvent::Ephemeral(AnyEphemeralRoomEvent::Typing( + &serde_json::to_string(&AnyEvent::Ephemeral(AnyEphemeralRoomEvent::Typing( db.rooms.edus.roomactives_all(&room_id)?, ))) .expect("event is valid, we just created it"), @@ -2544,14 +2545,14 @@ pub fn sync_route( .account_data .changes_since(Some(&room_id), &user_id, since)? .into_iter() - .filter_map(|(_, v)| { - if let Ok(EduEvent::Basic(account_event)) = v.deserialize() { - Some(EventJson::from(account_event)) + .map(|(_, v)| { + if let Ok(AnyEvent::Basic(account_event)) = v.deserialize() { + Ok(EventJson::from(account_event)) } else { - None + Err(Error::bad_database("found invalid event")) } }) - .collect(), + .collect::, _>>()?, }, summary: sync_events::RoomSummary { heroes, @@ -2573,7 +2574,7 @@ pub fn sync_route( db.rooms .room_state_full(&room_id)? .into_iter() - .map(|(_, pdu)| pdu.to_state_event_stub()) + .map(|(_, pdu)| pdu.to_sync_state_event()) .collect() } else { Vec::new() @@ -2593,7 +2594,7 @@ pub fn sync_route( let pdus = db.rooms.pdus_since(&user_id, &room_id, since)?; let room_events = pdus .filter_map(|pdu| pdu.ok()) // Filter out buggy events - .map(|pdu| pdu.to_room_event_stub()) + .map(|pdu| pdu.to_sync_room_event()) .collect(); // TODO: Only until leave point @@ -2688,14 +2689,14 @@ pub fn sync_route( .account_data .changes_since(None, &user_id, since)? .into_iter() - .filter_map(|(_, v)| { - if let Ok(EduEvent::Basic(account_event)) = v.deserialize() { - Some(EventJson::from(account_event)) + .map(|(_, v)| { + if let Ok(AnyEvent::Basic(account_event)) = v.deserialize() { + Ok(EventJson::from(account_event)) } else { - None + Err(Error::bad_database("found invalid event")) } }) - .collect(), + .collect::, _>>()?, }, device_lists: sync_events::DeviceLists { changed: if since != 0 { diff --git a/src/database.rs b/src/database.rs index fcda5af..370fde7 100644 --- a/src/database.rs +++ b/src/database.rs @@ -62,7 +62,6 @@ impl Database { .to_owned()) })?; - println!("{:?}", path); let db = sled::open(&path)?; info!("Opened sled database at {}", path); diff --git a/src/database/globals.rs b/src/database/globals.rs index d307150..1654636 100644 --- a/src/database/globals.rs +++ b/src/database/globals.rs @@ -31,7 +31,7 @@ impl Globals { .unwrap_or("localhost") .to_string() .try_into() - .map_err(|_| crate::Error::bad_database("Private or public keys are invalid."))?, + .map_err(|_| Error::bad_database("Private or public keys are invalid."))?, registration_disabled: config.get_bool("registration_disabled").unwrap_or(false), }) } diff --git a/src/database/rooms/edus.rs b/src/database/rooms/edus.rs index 0b3ac57..3ee1e75 100644 --- a/src/database/rooms/edus.rs +++ b/src/database/rooms/edus.rs @@ -1,6 +1,6 @@ use crate::{utils, Error, Result}; use ruma::{ - events::{AnyEvent as EduEvent, EventJson}, + events::{AnyEvent as EduEvent, EventJson, SyncEphemeralRoomEvent}, identifiers::{RoomId, UserId}, }; use std::convert::TryFrom; @@ -236,9 +236,41 @@ impl RoomEdus { Ok(ruma::events::typing::TypingEvent { content: ruma::events::typing::TypingEventContent { user_ids }, - room_id: room_id.clone(), // Can be inferred + room_id: room_id.clone(), }) } + // REMOVE the above method and uncomment the bottom when ruma/ruma PR #141 is merged + // pub fn roomactives_all( + // &self, + // room_id: &RoomId, + // ) -> Result> { + // let mut prefix = room_id.to_string().as_bytes().to_vec(); + // prefix.push(0xff); + + // let mut user_ids = Vec::new(); + + // for user_id in self + // .roomactiveid_userid + // .scan_prefix(prefix) + // .values() + // .map(|user_id| { + // Ok::<_, Error>( + // UserId::try_from(utils::string_from_bytes(&user_id?).map_err(|_| { + // Error::bad_database("User ID in roomactiveid_userid is invalid unicode.") + // })?) + // .map_err(|_| { + // Error::bad_database("User ID in roomactiveid_userid is invalid.") + // })?, + // ) + // }) + // { + // user_ids.push(user_id?); + // } + + // Ok(SyncEphemeralRoomEvent { + // content: ruma::events::typing::TypingEventContent { user_ids }, + // }) + // } /// Sets a private read marker at `count`. pub fn room_read_set(&self, room_id: &RoomId, user_id: &UserId, count: u64) -> Result<()> { From 9a993fa7c1597a56d289378ab3ad7f766d3e8a57 Mon Sep 17 00:00:00 2001 From: Devin R Date: Sat, 18 Jul 2020 08:22:30 -0400 Subject: [PATCH 10/14] Convert Pdu to a validated ruma type when calling to_*_event --- src/pdu.rs | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/pdu.rs b/src/pdu.rs index 403e699..f55acaf 100644 --- a/src/pdu.rs +++ b/src/pdu.rs @@ -79,34 +79,40 @@ impl PduEvent { Ok(()) } - pub fn to_room_event_stub(&self) -> EventJson { + pub fn to_sync_room_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) - .expect("EventJson::from_str always works") + serde_json::from_str::(&json) + .map(EventJson::from) + .expect("AnySyncRoomEvent can always be built from a full PDU event") } pub fn to_room_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) - .expect("EventJson::from_str always works") + serde_json::from_str::(&json) + .map(EventJson::from) + .expect("AnyRoomEvent can always be built from a full PDU event") } pub fn to_state_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) - .expect("EventJson::from_str always works") + serde_json::from_str::(&json) + .map(EventJson::from) + .expect("AnyStateEvent can always be built from a full PDU event") } - pub fn to_state_event_stub(&self) -> EventJson { + pub fn to_sync_state_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) - .expect("EventJson::from_str always works") + serde_json::from_str::(&json) + .map(EventJson::from) + .expect("AnySyncStateEvent can always be built from a full PDU event") } pub fn to_stripped_state_event(&self) -> EventJson { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>(&json) - .expect("EventJson::from_str always works") + serde_json::from_str::(&json) + .map(EventJson::from) + .expect("AnyStrippedStateEvent can always be built from a full PDU event") } pub fn to_member_event(&self) -> EventJson> { let json = serde_json::to_string(&self).expect("PDUs are always valid"); - serde_json::from_str::>>(&json) - .expect("EventJson::from_str always works") + serde_json::from_str::>(&json) + .map(EventJson::from) + .expect("StateEvent can always be built from a full PDU event") } } From 33bc666859ccbe939684c9e908b17be37cf6a7ed Mon Sep 17 00:00:00 2001 From: Devin R Date: Tue, 21 Jul 2020 14:04:39 -0400 Subject: [PATCH 11/14] Use sync ephemeral events in sync Resposne (remove room_id) Bump ruma to latest master which also fixes some server name as String to now being of type Box. --- Cargo.lock | 124 ++++++++++++++++++++----------------- Cargo.toml | 2 +- src/client_server.rs | 11 ++-- src/database/rooms.rs | 2 +- src/database/rooms/edus.rs | 41 ++---------- src/pdu.rs | 4 +- 6 files changed, 82 insertions(+), 102 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 79973c0..8800c5e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -106,9 +106,9 @@ version = "0.1.36" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a265e3abeffdce30b2e26b7a11b222fe37c6067404001b434101457d0385eb92" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -423,9 +423,9 @@ version = "0.3.0" source = "git+https://github.com/SergioBenitez/Devise.git?rev=e58b3ac9a#e58b3ac9afc3b6ff10a8aaf02a3e768a8f530089" dependencies = [ "bitflags", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -597,9 +597,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -716,6 +716,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "hashbrown" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34f595585f103464d8d2f6e9864682d74c1601fed5e07d62b1c9058dba8246fb" +dependencies = [ + "autocfg", +] + [[package]] name = "heck" version = "0.3.1" @@ -847,11 +856,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c398b2b113b55809ceb9ee3e753fcbac793f1956663f3c36549c1346015c2afe" +checksum = "5b88cd59ee5f71fea89a62248fc8f387d44400cefe05ef548466d61ced9029a7" dependencies = [ "autocfg", + "hashbrown", ] [[package]] @@ -895,9 +905,9 @@ dependencies = [ [[package]] name = "js_int" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b2b63d60564122f2a7d6592c2f1d6c1c60e7a266b4d24715950a1ddad784f66" +checksum = "b96797f53235a1d6dc985f244a69de54b04c45b7e0e357a35c85a45a847d92f2" dependencies = [ "serde", ] @@ -920,9 +930,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.72" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9f8082297d534141b30c8d39e9b1773713ab50fdbe4ff30f750d063b3bfd701" +checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" [[package]] name = "lock_api" @@ -1257,9 +1267,9 @@ version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -1282,9 +1292,9 @@ checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" [[package]] name = "png" -version = "0.16.6" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c150bf7479fafe3dd8740dbe48cc33b2a3efb7b0fe3483aced8bbc39f6d0238d" +checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970" dependencies = [ "bitflags", "crc32fast", @@ -1331,9 +1341,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "beae6331a816b1f65d04c45b078fd8e6c93e8071771f41b8163255bbd8d7c8fa" +checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" dependencies = [ "unicode-xid 0.2.1", ] @@ -1353,7 +1363,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", ] [[package]] @@ -1429,9 +1439,9 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7d21b475ab879ef0e315ad99067fa25778c3b0377f57f1b00207448dac1a3144" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -1556,7 +1566,7 @@ dependencies = [ [[package]] name = "ruma" version = "0.1.0" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "ruma-api", "ruma-client-api", @@ -1570,7 +1580,7 @@ dependencies = [ [[package]] name = "ruma-api" version = "0.16.1" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "http", "percent-encoding 2.1.0", @@ -1585,18 +1595,18 @@ dependencies = [ [[package]] name = "ruma-api-macros" version = "0.16.1" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "matches", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] name = "ruma-client-api" version = "0.9.0" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "http", "js_int", @@ -1613,7 +1623,7 @@ dependencies = [ [[package]] name = "ruma-common" version = "0.1.3" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "js_int", "matches", @@ -1626,7 +1636,7 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.21.3" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "js_int", "ruma-common", @@ -1641,18 +1651,18 @@ dependencies = [ [[package]] name = "ruma-events-macros" version = "0.21.3" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "matches", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] name = "ruma-federation-api" version = "0.0.2" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "js_int", "matches", @@ -1668,7 +1678,7 @@ dependencies = [ [[package]] name = "ruma-identifiers" version = "0.17.0-pre.1" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "matches", "rand", @@ -1679,7 +1689,7 @@ dependencies = [ [[package]] name = "ruma-serde" version = "0.2.2" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "form_urlencoded", "itoa", @@ -1691,7 +1701,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.6.0-dev.1" -source = "git+https://github.com/ruma/ruma?rev=848b225#848b22568106d05c5444f3fe46070d5aa16e422b" +source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" dependencies = [ "base64 0.12.3", "ring", @@ -1836,9 +1846,9 @@ version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -1975,11 +1985,11 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", "serde", "serde_derive", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -1989,13 +1999,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" dependencies = [ "base-x", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", "serde", "serde_derive", "serde_json", "sha1", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -2020,9 +2030,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" dependencies = [ "heck", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -2050,11 +2060,11 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cae2873c940d92e697597c5eee105fb570cd5689c695806f672883653349b" +checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", "unicode-xid 0.2.1", ] @@ -2088,9 +2098,9 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd80fc12f73063ac132ac92aceea36734f04a1d93c1240c6944e23a3b8841793" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -2135,10 +2145,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" dependencies = [ "proc-macro-hack", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", "standback", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -2176,9 +2186,9 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", ] [[package]] @@ -2385,9 +2395,9 @@ dependencies = [ "bumpalo", "lazy_static", "log", - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", "wasm-bindgen-shared", ] @@ -2419,9 +2429,9 @@ version = "0.2.65" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf592c807080719d1ff2f245a687cbadb3ed28b2077ed7084b47aba8b691f2c6" dependencies = [ - "proc-macro2 1.0.18", + "proc-macro2 1.0.19", "quote 1.0.7", - "syn 1.0.34", + "syn 1.0.35", "wasm-bindgen-backend", "wasm-bindgen-shared", ] diff --git a/Cargo.toml b/Cargo.toml index 80785c8..adf7a98 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,4 +27,4 @@ reqwest = "0.10.6" base64 = "0.12.1" thiserror = "1.0.19" image = { version = "0.23.4", default-features = false, features = ["jpeg", "png", "gif"] } -ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"], rev = "848b225" } +ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"], rev = "b55f827" } diff --git a/src/client_server.rs b/src/client_server.rs index c83f9e2..48c03c3 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -64,7 +64,8 @@ use ruma::{ canonical_alias, guest_access, history_visibility, join_rules, member, name, redaction, topic, }, - AnyBasicEvent, AnyEphemeralRoomEvent, AnyEvent, EventJson, EventType, + AnyBasicEvent, AnyEphemeralRoomEvent, AnyEvent, AnySyncEphemeralRoomEvent, EventJson, + EventType, }, identifiers::{RoomAliasId, RoomId, RoomVersionId, UserId}, }; @@ -284,7 +285,7 @@ pub fn login_route( Ok(login::Response { user_id, access_token: token, - home_server: Some(db.globals.server_name().to_string()), + home_server: Some(db.globals.server_name().to_owned()), device_id: device_id.into(), well_known: None, } @@ -2530,9 +2531,9 @@ pub fn sync_route( { edus.push( serde_json::from_str( - &serde_json::to_string(&AnyEvent::Ephemeral(AnyEphemeralRoomEvent::Typing( + &serde_json::to_string(&AnySyncEphemeralRoomEvent::Typing( db.rooms.edus.roomactives_all(&room_id)?, - ))) + )) .expect("event is valid, we just created it"), ) .expect("event is valid, we just created it"), @@ -2613,7 +2614,7 @@ pub fn sync_route( { edus.push( serde_json::from_str( - &serde_json::to_string(&ruma::events::AnySyncEphemeralRoomEvent::Typing( + &serde_json::to_string(&AnySyncEphemeralRoomEvent::Typing( db.rooms.edus.roomactives_all(&room_id)?, )) .expect("event is valid, we just created it"), diff --git a/src/database/rooms.rs b/src/database/rooms.rs index d29ab42..7e6036d 100644 --- a/src/database/rooms.rs +++ b/src/database/rooms.rs @@ -515,7 +515,7 @@ impl Rooms { event_id: EventId::try_from("$thiswillbefilledinlater").expect("we know this is valid"), room_id: room_id.clone(), sender: sender.clone(), - origin: globals.server_name().to_string(), + origin: globals.server_name().to_owned(), origin_server_ts: utils::millis_since_unix_epoch() .try_into() .expect("time is valid"), diff --git a/src/database/rooms/edus.rs b/src/database/rooms/edus.rs index 3ee1e75..b96f1b1 100644 --- a/src/database/rooms/edus.rs +++ b/src/database/rooms/edus.rs @@ -209,8 +209,10 @@ impl RoomEdus { .unwrap_or(0)) } - /// Returns an iterator over all active events (e.g. typing notifications). - pub fn roomactives_all(&self, room_id: &RoomId) -> Result { + pub fn roomactives_all( + &self, + room_id: &RoomId, + ) -> Result> { let mut prefix = room_id.to_string().as_bytes().to_vec(); prefix.push(0xff); @@ -234,43 +236,10 @@ impl RoomEdus { user_ids.push(user_id?); } - Ok(ruma::events::typing::TypingEvent { + Ok(SyncEphemeralRoomEvent { content: ruma::events::typing::TypingEventContent { user_ids }, - room_id: room_id.clone(), }) } - // REMOVE the above method and uncomment the bottom when ruma/ruma PR #141 is merged - // pub fn roomactives_all( - // &self, - // room_id: &RoomId, - // ) -> Result> { - // let mut prefix = room_id.to_string().as_bytes().to_vec(); - // prefix.push(0xff); - - // let mut user_ids = Vec::new(); - - // for user_id in self - // .roomactiveid_userid - // .scan_prefix(prefix) - // .values() - // .map(|user_id| { - // Ok::<_, Error>( - // UserId::try_from(utils::string_from_bytes(&user_id?).map_err(|_| { - // Error::bad_database("User ID in roomactiveid_userid is invalid unicode.") - // })?) - // .map_err(|_| { - // Error::bad_database("User ID in roomactiveid_userid is invalid.") - // })?, - // ) - // }) - // { - // user_ids.push(user_id?); - // } - - // Ok(SyncEphemeralRoomEvent { - // content: ruma::events::typing::TypingEventContent { user_ids }, - // }) - // } /// Sets a private read marker at `count`. pub fn room_read_set(&self, room_id: &RoomId, user_id: &UserId, count: u64) -> Result<()> { diff --git a/src/pdu.rs b/src/pdu.rs index f55acaf..0db77a1 100644 --- a/src/pdu.rs +++ b/src/pdu.rs @@ -6,7 +6,7 @@ use ruma::{ AnyStrippedStateEvent, AnySyncRoomEvent, AnySyncStateEvent, EventJson, EventType, StateEvent, }, - identifiers::{EventId, RoomId, UserId}, + identifiers::{EventId, RoomId, ServerName, UserId}, }; use serde::{Deserialize, Serialize}; use serde_json::json; @@ -17,7 +17,7 @@ pub struct PduEvent { pub event_id: EventId, pub room_id: RoomId, pub sender: UserId, - pub origin: String, + pub origin: Box, pub origin_server_ts: UInt, #[serde(rename = "type")] pub kind: EventType, From 84d47da392f323a0b35bf5ce35ee6414b85efd47 Mon Sep 17 00:00:00 2001 From: Devin R Date: Tue, 21 Jul 2020 16:26:01 -0400 Subject: [PATCH 12/14] Simplify deserialization and deconstruction for Responses --- src/client_server.rs | 47 +++++++++++++++-------------------------- src/database/globals.rs | 2 +- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/src/client_server.rs b/src/client_server.rs index 48c03c3..208e360 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -594,27 +594,18 @@ pub fn get_global_account_data_route( ) -> ConduitResult { let user_id = body.user_id.as_ref().expect("user is authenticated"); - let data = db - .account_data + db.account_data .get( None, user_id, &EventType::try_from(&body.event_type).expect("EventType::try_from can never fail"), )? - .ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?; - - let data: AnyEvent = data - .deserialize() - .map_err(|_| Error::bad_database("Deserialization of account data failed"))?; - - if let AnyEvent::Basic(data) = data { - Ok(get_global_account_data::Response { - account_data: data.into(), - } - .into()) - } else { - Err(Error::bad_database("Encountered a non account data event.")) - } + .and_then(|ev| { + serde_json::from_str(ev.json().get()) + .map(|data| get_global_account_data::Response { account_data: data }.into()) + .ok() + }) + .ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found.")) } #[put("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")] @@ -2546,14 +2537,12 @@ pub fn sync_route( .account_data .changes_since(Some(&room_id), &user_id, since)? .into_iter() - .map(|(_, v)| { - if let Ok(AnyEvent::Basic(account_event)) = v.deserialize() { - Ok(EventJson::from(account_event)) - } else { - Err(Error::bad_database("found invalid event")) - } + .filter_map(|(_, v)| { + serde_json::from_str(v.json().get()) + .map_err(|_| Error::bad_database("Invalid account event in database.")) + .ok() }) - .collect::, _>>()?, + .collect::>(), }, summary: sync_events::RoomSummary { heroes, @@ -2690,14 +2679,12 @@ pub fn sync_route( .account_data .changes_since(None, &user_id, since)? .into_iter() - .map(|(_, v)| { - if let Ok(AnyEvent::Basic(account_event)) = v.deserialize() { - Ok(EventJson::from(account_event)) - } else { - Err(Error::bad_database("found invalid event")) - } + .filter_map(|(_, v)| { + serde_json::from_str(v.json().get()) + .map_err(|_| Error::bad_database("Invalid account event in database.")) + .ok() }) - .collect::, _>>()?, + .collect::>(), }, device_lists: sync_events::DeviceLists { changed: if since != 0 { diff --git a/src/database/globals.rs b/src/database/globals.rs index 1654636..d59e1c3 100644 --- a/src/database/globals.rs +++ b/src/database/globals.rs @@ -31,7 +31,7 @@ impl Globals { .unwrap_or("localhost") .to_string() .try_into() - .map_err(|_| Error::bad_database("Private or public keys are invalid."))?, + .map_err(|_| Error::BadConfig("Invalid server name found."))?, registration_disabled: config.get_bool("registration_disabled").unwrap_or(false), }) } From 60381ddcf42eb1d55b5f817810af4e47dc0fffed Mon Sep 17 00:00:00 2001 From: Devin Ragotzy Date: Sat, 25 Jul 2020 14:25:24 -0400 Subject: [PATCH 13/14] Update to latest ruma/master rev --- Cargo.lock | 242 ++++++++++++++++++++++-------------------- Cargo.toml | 2 +- src/client_server.rs | 46 ++++---- src/database/uiaa.rs | 21 ++-- src/database/users.rs | 63 ++++++----- src/push_rules.rs | 83 ++++++++------- src/ruma_wrapper.rs | 9 +- 7 files changed, 248 insertions(+), 218 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b2d93d3..d9865b4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,57 +23,56 @@ checksum = "567b077b825e468cc974f0020d4082ee6e03132512f207ef1a02fd5d00d1f32d" [[package]] name = "aead" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cf01b9b56e767bb57b94ebf91a58b338002963785cdd7013e21c0d4679471e4" +checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" dependencies = [ "generic-array", ] [[package]] name = "aes" -version = "0.3.2" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" +checksum = "f7001367fde4c768a19d1029f0a8be5abd9308e1119846d5bd9ad26297b8faf5" dependencies = [ "aes-soft", "aesni", - "block-cipher-trait", + "block-cipher", ] [[package]] name = "aes-gcm" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "834a6bda386024dbb7c8fc51322856c10ffe69559f972261c868485f5759c638" +checksum = "86f5007801316299f922a6198d1d09a0bae95786815d066d5880d13f7c45ead1" dependencies = [ "aead", "aes", - "block-cipher-trait", + "block-cipher", "ghash", - "subtle 2.2.3", - "zeroize", + "subtle", ] [[package]] name = "aes-soft" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" +checksum = "4925647ee64e5056cf231608957ce7c81e12d6d6e316b9ce1404778cc1d35fa7" dependencies = [ - "block-cipher-trait", + "block-cipher", "byteorder", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] name = "aesni" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +checksum = "d050d39b0b7688b3a3254394c3e30a9d66c41dcf9b05b0e2dbdc623f6505d264" dependencies = [ - "block-cipher-trait", - "opaque-debug", + "block-cipher", + "opaque-debug 0.2.3", ] [[package]] @@ -191,32 +190,20 @@ dependencies = [ [[package]] name = "block-buffer" -version = "0.7.3" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding", - "byte-tools", - "byteorder", - "generic-array", -] - -[[package]] -name = "block-cipher-trait" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "generic-array", ] [[package]] -name = "block-padding" -version = "0.1.5" +name = "block-cipher" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +checksum = "fa136449e765dc7faa244561ccae839c394048667929af599b5d931ebe7b7f10" dependencies = [ - "byte-tools", + "generic-array", ] [[package]] @@ -225,17 +212,11 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "bytemuck" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37fa13df2292ecb479ec23aa06f4507928bef07839be9ef15281411076629431" +checksum = "d40636046a60a45ee5185e885a3ccb771f7a2065fb7cbcc2a7ecfd9896d1c365" [[package]] name = "byteorder" @@ -306,9 +287,9 @@ checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] name = "cookie" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca761767cf3fa9068cc893ec8c247a22d0fd0535848e65640c0548bd1f8bbb36" +checksum = "1373a16a4937bc34efec7b391f9c1500c30b8478a701a4f44c9165cc0475a6e0" dependencies = [ "aes-gcm", "base64 0.12.3", @@ -317,6 +298,7 @@ dependencies = [ "rand", "sha2", "time 0.2.16", + "version_check", ] [[package]] @@ -335,6 +317,12 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + [[package]] name = "crc32fast" version = "1.2.0" @@ -372,12 +360,12 @@ dependencies = [ [[package]] name = "crypto-mac" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" dependencies = [ "generic-array", - "subtle 1.0.0", + "subtle", ] [[package]] @@ -422,9 +410,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ "generic-array", ] @@ -471,12 +459,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fnv" version = "1.0.7" @@ -505,7 +487,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -640,11 +622,12 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.12.3" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +checksum = "60fb4bb6bba52f78a471264d9a3b7d026cc0af47b22cd2cffbc0b787ca003e63" dependencies = [ "typenum", + "version_check", ] [[package]] @@ -660,9 +643,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.2.3" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f0930ed19a7184089ea46d2fedead2f6dc2b674c5db4276b7da336c7cd83252" +checksum = "d6e27f0689a6e15944bdce7e45425efb87eaa8ab0c6e87f11d0987a9133e2531" dependencies = [ "polyval", ] @@ -737,9 +720,9 @@ dependencies = [ [[package]] name = "hkdf" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa08a006102488bd9cd5b8013aabe84955cf5ae22e304c2caf655b633aefae3" +checksum = "fe1149865383e4526a43aee8495f9a325f0b806c63ce6427d06336a590abbbc9" dependencies = [ "digest", "hmac", @@ -747,9 +730,9 @@ dependencies = [ [[package]] name = "hmac" -version = "0.7.1" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" dependencies = [ "crypto-mac", "digest", @@ -862,6 +845,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb6ee2a7da03bfc3b66ca47c92c2e392fcc053ea040a85561749b026f7aad09a" +[[package]] +name = "instant" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b141fdc7836c525d4d594027d318c84161ca17aaf8113ab1f81ab93ae897485" + [[package]] name = "iovec" version = "0.1.4" @@ -871,6 +860,12 @@ dependencies = [ "libc", ] +[[package]] +name = "ipnet" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" + [[package]] name = "itoa" version = "0.4.6" @@ -1151,6 +1146,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "openssl" version = "0.10.30" @@ -1289,9 +1290,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ec3341498978de3bfd12d1b22f1af1de22818f5473a11e8a6ef997989e3a212" +checksum = "d9a50142b55ab3ed0e9f68dfb3709f1d90d29da24e91033f28b96330643107dc" dependencies = [ "cfg-if", "universal-hash", @@ -1317,7 +1318,7 @@ checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" dependencies = [ @@ -1434,9 +1435,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b82c9238b305f26f53443e3a4bc8528d64b8d0bee408ec949eb7bf5635ec680" +checksum = "12427a5577082c24419c9c417db35cfeb65962efc7675bb6b0d5f1f9d315bfe6" dependencies = [ "base64 0.12.3", "bytes", @@ -1447,6 +1448,7 @@ dependencies = [ "http-body", "hyper", "hyper-tls", + "ipnet", "js-sys", "lazy_static", "log", @@ -1543,26 +1545,27 @@ dependencies = [ [[package]] name = "ruma" version = "0.1.0" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "ruma-api", "ruma-client-api", "ruma-common", "ruma-events", "ruma-federation-api", - "ruma-identifiers", + "ruma-identifiers 0.17.0 (git+https://github.com/ruma/ruma?rev=08fbace)", + "ruma-identifiers-macros", "ruma-signatures", ] [[package]] name = "ruma-api" version = "0.16.1" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "http", "percent-encoding", "ruma-api-macros", - "ruma-identifiers", + "ruma-identifiers 0.17.0 (git+https://github.com/ruma/ruma?rev=08fbace)", "ruma-serde", "serde", "serde_json", @@ -1572,7 +1575,7 @@ dependencies = [ [[package]] name = "ruma-api-macros" version = "0.16.1" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "proc-macro2", "quote", @@ -1582,14 +1585,14 @@ dependencies = [ [[package]] name = "ruma-client-api" version = "0.9.0" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "http", "js_int", "ruma-api", "ruma-common", "ruma-events", - "ruma-identifiers", + "ruma-identifiers 0.17.0 (git+https://github.com/ruma/ruma?rev=08fbace)", "ruma-serde", "serde", "serde_json", @@ -1598,11 +1601,10 @@ dependencies = [ [[package]] name = "ruma-common" -version = "0.1.3" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +version = "0.2.0" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "js_int", - "matches", "ruma-serde", "serde", "serde_json", @@ -1612,12 +1614,12 @@ dependencies = [ [[package]] name = "ruma-events" version = "0.21.3" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "js_int", "ruma-common", "ruma-events-macros", - "ruma-identifiers", + "ruma-identifiers 0.17.0 (git+https://github.com/ruma/ruma?rev=08fbace)", "ruma-serde", "serde", "serde_json", @@ -1627,7 +1629,7 @@ dependencies = [ [[package]] name = "ruma-events-macros" version = "0.21.3" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "proc-macro2", "quote", @@ -1637,14 +1639,13 @@ dependencies = [ [[package]] name = "ruma-federation-api" version = "0.0.2" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "js_int", - "matches", "ruma-api", "ruma-common", "ruma-events", - "ruma-identifiers", + "ruma-identifiers 0.17.0 (git+https://github.com/ruma/ruma?rev=08fbace)", "ruma-serde", "serde", "serde_json", @@ -1652,19 +1653,39 @@ dependencies = [ [[package]] name = "ruma-identifiers" -version = "0.17.0-pre.1" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +version = "0.17.0" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ - "matches", "rand", "serde", "strum", ] +[[package]] +name = "ruma-identifiers" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7046d6ff26cf4f5b8bc77af68527544c61e32cab5810c40035c6491c08da0d3" +dependencies = [ + "serde", + "strum", +] + +[[package]] +name = "ruma-identifiers-macros" +version = "0.17.0" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" +dependencies = [ + "proc-macro2", + "quote", + "ruma-identifiers 0.17.0 (registry+https://github.com/rust-lang/crates.io-index)", + "syn", +] + [[package]] name = "ruma-serde" version = "0.2.2" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "form_urlencoded", "itoa", @@ -1676,7 +1697,7 @@ dependencies = [ [[package]] name = "ruma-signatures" version = "0.6.0-dev.1" -source = "git+https://github.com/ruma/ruma?rev=b55f827#b55f82742c88ea6d8744f37bacac5cbfa17a9029" +source = "git+https://github.com/ruma/ruma?rev=08fbace#08fbace022f732319b9c5d2b97954b935bf39bf2" dependencies = [ "base64 0.12.3", "ring", @@ -1857,14 +1878,15 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "sha2" -version = "0.8.2" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" +checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" dependencies = [ "block-buffer", + "cfg-if", + "cpuid-bool", "digest", - "fake-simd", - "opaque-debug", + "opaque-debug 0.3.0", ] [[package]] @@ -2010,12 +2032,6 @@ dependencies = [ "syn", ] -[[package]] -name = "subtle" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" - [[package]] name = "subtle" version = "2.2.3" @@ -2024,7 +2040,7 @@ checksum = "502d53007c02d7605a05df1c1a73ee436952781653da5d0bf57ad608f66932c1" [[package]] name = "syn" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" dependencies = [ @@ -2123,9 +2139,9 @@ checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" [[package]] name = "tokio" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" dependencies = [ "bytes", "fnv", @@ -2208,9 +2224,9 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e2a2de6b0d5cbb13fc21193a2296888eaab62b6044479aafb3c54c01c29fcd" +checksum = "dbdf4ccd1652592b01286a5dbe1e2a77d78afaa34beadd9872a5f7396f92aaa9" dependencies = [ "cfg-if", "log", @@ -2279,12 +2295,12 @@ checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564" [[package]] name = "universal-hash" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0c900f2f9b4116803415878ff48b63da9edb268668e08cf9292d7503114a01" +checksum = "8326b2c654932e3e4f9196e69d08fdf7cfd718e1dc6f66b347e6024a0c961402" dependencies = [ "generic-array", - "subtle 2.2.3", + "subtle", ] [[package]] @@ -2478,9 +2494,3 @@ name = "yansi" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fc79f4a1e39857fc00c3f662cbf2651c771f00e9c15fe2abc341806bd46bd71" - -[[package]] -name = "zeroize" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cbac2ed2ba24cc90f5e06485ac8c7c1e5449fe8911aef4d8877218af021a5b8" diff --git a/Cargo.toml b/Cargo.toml index c805d71..e0f246e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,4 +27,4 @@ reqwest = "0.10.6" base64 = "0.12.1" thiserror = "1.0.19" image = { version = "0.23.4", default-features = false, features = ["jpeg", "png", "gif"] } -ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"], rev = "b55f827" } +ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"], rev = "08fbace" } diff --git a/src/client_server.rs b/src/client_server.rs index da29599..f13d6fd 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -169,14 +169,14 @@ pub fn register_route( if let Some(auth) = &body.auth { let (worked, uiaainfo) = db.uiaa - .try_auth(&user_id, "", auth, &uiaainfo, &db.users, &db.globals)?; + .try_auth(&user_id, "".into(), auth, &uiaainfo, &db.users, &db.globals)?; if !worked { return Err(Error::Uiaa(uiaainfo)); } // Success! } else { uiaainfo.session = Some(utils::random_string(SESSION_ID_LENGTH)); - db.uiaa.create(&user_id, "", &uiaainfo)?; + db.uiaa.create(&user_id, "".into(), &uiaainfo)?; return Err(Error::Uiaa(uiaainfo)); } @@ -189,7 +189,7 @@ pub fn register_route( let device_id = body .device_id .clone() - .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH)); + .unwrap_or_else(|| utils::random_string(DEVICE_ID_LENGTH).into()); // Generate new token for the device let token = utils::random_string(TOKEN_LENGTH); @@ -300,7 +300,7 @@ pub fn logout_route( let user_id = body.user_id.as_ref().expect("user is authenticated"); let device_id = body.device_id.as_ref().expect("user is authenticated"); - db.users.remove_device(&user_id, &device_id)?; + db.users.remove_device(&user_id, device_id)?; Ok(logout::Response.into()) } @@ -340,14 +340,9 @@ pub fn change_password_route( }; if let Some(auth) = &body.auth { - let (worked, uiaainfo) = db.uiaa.try_auth( - &user_id, - &device_id, - auth, - &uiaainfo, - &db.users, - &db.globals, - )?; + let (worked, uiaainfo) = + db.uiaa + .try_auth(&user_id, device_id, auth, &uiaainfo, &db.users, &db.globals)?; if !worked { return Err(Error::Uiaa(uiaainfo)); } @@ -452,11 +447,11 @@ pub fn deactivate_route( pub fn get_capabilities_route() -> ConduitResult { let mut available = BTreeMap::new(); available.insert( - RoomVersionId::version_5(), + RoomVersionId::Version5, get_capabilities::RoomVersionStability::Stable, ); available.insert( - RoomVersionId::version_6(), + RoomVersionId::Version6, get_capabilities::RoomVersionStability::Stable, ); @@ -890,7 +885,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.into(), keys); + container.insert(device_id, keys); } } device_keys.insert(user_id.clone(), container); @@ -909,7 +904,7 @@ pub fn get_keys_route( device_display_name: metadata.display_name, }); - container.insert(device_id.as_ref().into(), keys); + container.insert(device_id.clone(), keys); } device_keys.insert(user_id.clone(), container); } @@ -1212,7 +1207,7 @@ pub fn create_room_route( .creation_content .as_ref() .and_then(|c| c.predecessor.clone()); - content.room_version = RoomVersionId::version_6(); + content.room_version = RoomVersionId::Version6; // 1. The room create event db.rooms.append_pdu( @@ -1298,15 +1293,14 @@ pub fn create_room_route( user_id.clone(), EventType::RoomJoinRules, match preset { - create_room::RoomPreset::PublicChat => { - serde_json::to_value(join_rules::JoinRulesEventContent { - join_rule: join_rules::JoinRule::Public, - }) - .expect("event is valid, we just created it") - } - _ => serde_json::to_value(join_rules::JoinRulesEventContent { - join_rule: join_rules::JoinRule::Invite, - }) + create_room::RoomPreset::PublicChat => serde_json::to_value( + join_rules::JoinRulesEventContent::new(join_rules::JoinRule::Public), + ) + .expect("event is valid, we just created it"), + // according to spec "invite" is the default + _ => serde_json::to_value(join_rules::JoinRulesEventContent::new( + join_rules::JoinRule::Invite, + )) .expect("event is valid, we just created it"), }, None, diff --git a/src/database/uiaa.rs b/src/database/uiaa.rs index 1272d5f..d490499 100644 --- a/src/database/uiaa.rs +++ b/src/database/uiaa.rs @@ -4,7 +4,7 @@ use ruma::{ error::ErrorKind, r0::uiaa::{AuthData, UiaaInfo}, }, - identifiers::UserId, + identifiers::{DeviceId, UserId}, }; pub struct Uiaa { @@ -13,14 +13,19 @@ pub struct Uiaa { impl Uiaa { /// Creates a new Uiaa session. Make sure the session token is unique. - pub fn create(&self, user_id: &UserId, device_id: &str, uiaainfo: &UiaaInfo) -> Result<()> { + pub fn create( + &self, + user_id: &UserId, + device_id: &DeviceId, + uiaainfo: &UiaaInfo, + ) -> Result<()> { self.update_uiaa_session(user_id, device_id, Some(uiaainfo)) } pub fn try_auth( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, auth: &AuthData, uiaainfo: &UiaaInfo, users: &super::users::Users, @@ -130,7 +135,7 @@ impl Uiaa { // UIAA was successful! Remove this session and return true self.update_uiaa_session(user_id, device_id, None)?; - return Ok((true, uiaainfo)); + Ok((true, uiaainfo)) } else { panic!("FallbackAcknowledgement is not supported yet"); } @@ -139,12 +144,12 @@ impl Uiaa { fn update_uiaa_session( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, uiaainfo: Option<&UiaaInfo>, ) -> Result<()> { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); if let Some(uiaainfo) = uiaainfo { self.userdeviceid_uiaainfo.insert( @@ -161,12 +166,12 @@ impl Uiaa { fn get_uiaa_session( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, session: &str, ) -> Result { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); let uiaainfo = serde_json::from_slice::( &self diff --git a/src/database/users.rs b/src/database/users.rs index b103691..3a02a9d 100644 --- a/src/database/users.rs +++ b/src/database/users.rs @@ -177,7 +177,7 @@ impl Users { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); self.userdeviceid_metadata.insert( userdeviceid, @@ -191,16 +191,16 @@ impl Users { .as_bytes(), )?; - self.set_token(user_id, device_id, token)?; + self.set_token(user_id, &device_id, token)?; Ok(()) } /// Removes a device from a user. - pub fn remove_device(&self, user_id: &UserId, device_id: &str) -> Result<()> { + pub fn remove_device(&self, user_id: &UserId, device_id: &DeviceId) -> Result<()> { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); // Remove tokens if let Some(old_token) = self.userdeviceid_token.remove(&userdeviceid)? { @@ -223,7 +223,7 @@ impl Users { } /// Returns an iterator over all device ids of this user. - pub fn all_device_ids(&self, user_id: &UserId) -> impl Iterator> { + pub fn all_device_ids(&self, user_id: &UserId) -> impl Iterator>> { let mut prefix = user_id.to_string().as_bytes().to_vec(); prefix.push(0xff); // All devices have metadata @@ -237,17 +237,16 @@ impl Users { .next() .ok_or_else(|| Error::bad_database("UserDevice ID in db is invalid."))?, ) - .map_err(|_| { - Error::bad_database("Device ID in userdeviceid_metadata is invalid.") - })?) + .map_err(|_| Error::bad_database("Device ID in userdeviceid_metadata is invalid."))? + .into()) }) } /// Replaces the access token of one device. - fn set_token(&self, user_id: &UserId, device_id: &str, token: &str) -> Result<()> { + fn set_token(&self, user_id: &UserId, device_id: &DeviceId, token: &str) -> Result<()> { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); // All devices have metadata assert!(self.userdeviceid_metadata.get(&userdeviceid)?.is_some()); @@ -268,13 +267,13 @@ impl Users { pub fn add_one_time_key( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, one_time_key_key: &AlgorithmAndDeviceId, one_time_key_value: &OneTimeKey, ) -> Result<()> { let mut key = user_id.to_string().as_bytes().to_vec(); key.push(0xff); - key.extend_from_slice(device_id.as_bytes()); + key.extend_from_slice(device_id.as_str().as_bytes()); // All devices have metadata // Only existing devices should be able to call this. @@ -301,12 +300,12 @@ impl Users { pub fn take_one_time_key( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, key_algorithm: &KeyAlgorithm, ) -> Result> { let mut prefix = user_id.to_string().as_bytes().to_vec(); prefix.push(0xff); - prefix.extend_from_slice(device_id.as_bytes()); + prefix.extend_from_slice(device_id.as_str().as_bytes()); prefix.push(0xff); prefix.push(b'"'); // Annoying quotation mark prefix.extend_from_slice(key_algorithm.to_string().as_bytes()); @@ -337,11 +336,11 @@ impl Users { pub fn count_one_time_keys( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, ) -> Result> { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); let mut counts = BTreeMap::new(); @@ -370,13 +369,13 @@ impl Users { pub fn add_device_keys( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, device_keys: &DeviceKeys, globals: &super::globals::Globals, ) -> Result<()> { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); self.keyid_key.insert( &userdeviceid, @@ -550,10 +549,14 @@ impl Users { }) } - pub fn get_device_keys(&self, user_id: &UserId, device_id: &str) -> Result> { + pub fn get_device_keys( + &self, + user_id: &UserId, + device_id: &DeviceId, + ) -> Result> { let mut key = user_id.to_string().as_bytes().to_vec(); key.push(0xff); - key.extend_from_slice(device_id.as_bytes()); + key.extend_from_slice(device_id.as_str().as_bytes()); self.keyid_key.get(key)?.map_or(Ok(None), |bytes| { Ok(Some(serde_json::from_slice(&bytes).map_err(|_| { @@ -633,14 +636,14 @@ impl Users { &self, sender: &UserId, target_user_id: &UserId, - target_device_id: &str, + target_device_id: &DeviceId, event_type: &EventType, content: serde_json::Value, globals: &super::globals::Globals, ) -> Result<()> { let mut key = target_user_id.to_string().as_bytes().to_vec(); key.push(0xff); - key.extend_from_slice(target_device_id.as_bytes()); + key.extend_from_slice(target_device_id.as_str().as_bytes()); key.push(0xff); key.extend_from_slice(&globals.next_count()?.to_be_bytes()); @@ -660,14 +663,14 @@ impl Users { pub fn take_to_device_events( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, max: usize, ) -> Result>> { let mut events = Vec::new(); let mut prefix = user_id.to_string().as_bytes().to_vec(); prefix.push(0xff); - prefix.extend_from_slice(device_id.as_bytes()); + prefix.extend_from_slice(device_id.as_str().as_bytes()); prefix.push(0xff); for result in self.todeviceid_events.scan_prefix(&prefix).take(max) { @@ -685,12 +688,12 @@ impl Users { pub fn update_device_metadata( &self, user_id: &UserId, - device_id: &str, + device_id: &DeviceId, device: &Device, ) -> Result<()> { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); // Only existing devices should be able to call this. assert!(self.userdeviceid_metadata.get(&userdeviceid)?.is_some()); @@ -706,10 +709,14 @@ impl Users { } /// Get device metadata. - pub fn get_device_metadata(&self, user_id: &UserId, device_id: &str) -> Result> { + pub fn get_device_metadata( + &self, + user_id: &UserId, + device_id: &DeviceId, + ) -> Result> { let mut userdeviceid = user_id.to_string().as_bytes().to_vec(); userdeviceid.push(0xff); - userdeviceid.extend_from_slice(device_id.as_bytes()); + userdeviceid.extend_from_slice(device_id.as_str().as_bytes()); self.userdeviceid_metadata .get(&userdeviceid)? diff --git a/src/push_rules.rs b/src/push_rules.rs index cb277b9..5bc0d74 100644 --- a/src/push_rules.rs +++ b/src/push_rules.rs @@ -2,47 +2,46 @@ use js_int::uint; use ruma::{ identifiers::UserId, push::{ - Action, ConditionalPushRule, PatternedPushRule, PushCondition, RoomMemberCountIs, Ruleset, - Tweak, + Action, ConditionalPushRule, ConditionalPushRuleInit, PatternedPushRule, + PatternedPushRuleInit, PushCondition, RoomMemberCountIs, Ruleset, Tweak, }, }; pub fn default_pushrules(user_id: &UserId) -> Ruleset { - Ruleset { - content: vec![contains_user_name_rule(&user_id)], - override_: vec![ - master_rule(), - suppress_notices_rule(), - invite_for_me_rule(), - member_event_rule(), - contains_display_name_rule(), - tombstone_rule(), - roomnotif_rule(), - ], - room: vec![], - sender: vec![], - underride: vec![ - call_rule(), - encrypted_room_one_to_one_rule(), - room_one_to_one_rule(), - message_rule(), - encrypted_rule(), - ], - } + let mut rules = Ruleset::default(); + rules.content = vec![contains_user_name_rule(&user_id)]; + rules.override_ = vec![ + master_rule(), + suppress_notices_rule(), + invite_for_me_rule(), + member_event_rule(), + contains_display_name_rule(), + tombstone_rule(), + roomnotif_rule(), + ]; + rules.underride = vec![ + call_rule(), + encrypted_room_one_to_one_rule(), + room_one_to_one_rule(), + message_rule(), + encrypted_rule(), + ]; + rules } pub fn master_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![Action::DontNotify], default: true, enabled: false, rule_id: ".m.rule.master".to_owned(), conditions: vec![], } + .into() } pub fn suppress_notices_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![Action::DontNotify], default: true, enabled: true, @@ -52,10 +51,11 @@ pub fn suppress_notices_rule() -> ConditionalPushRule { pattern: "m.notice".to_owned(), }], } + .into() } pub fn invite_for_me_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![ Action::Notify, Action::SetTweak(Tweak::Sound("default".to_owned())), @@ -69,10 +69,11 @@ pub fn invite_for_me_rule() -> ConditionalPushRule { pattern: "m.invite".to_owned(), }], } + .into() } pub fn member_event_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![Action::DontNotify], default: true, enabled: true, @@ -82,10 +83,11 @@ pub fn member_event_rule() -> ConditionalPushRule { pattern: "type".to_owned(), }], } + .into() } pub fn contains_display_name_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![ Action::Notify, Action::SetTweak(Tweak::Sound("default".to_owned())), @@ -96,10 +98,11 @@ pub fn contains_display_name_rule() -> ConditionalPushRule { rule_id: ".m.rule.contains_display_name".to_owned(), conditions: vec![PushCondition::ContainsDisplayName], } + .into() } pub fn tombstone_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![Action::Notify, Action::SetTweak(Tweak::Highlight(true))], default: true, enabled: true, @@ -115,10 +118,11 @@ pub fn tombstone_rule() -> ConditionalPushRule { }, ], } + .into() } pub fn roomnotif_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![Action::Notify, Action::SetTweak(Tweak::Highlight(true))], default: true, enabled: true, @@ -133,10 +137,11 @@ pub fn roomnotif_rule() -> ConditionalPushRule { }, ], } + .into() } pub fn contains_user_name_rule(user_id: &UserId) -> PatternedPushRule { - PatternedPushRule { + PatternedPushRuleInit { actions: vec![ Action::Notify, Action::SetTweak(Tweak::Sound("default".to_owned())), @@ -147,10 +152,11 @@ pub fn contains_user_name_rule(user_id: &UserId) -> PatternedPushRule { rule_id: ".m.rule.contains_user_name".to_owned(), pattern: user_id.localpart().to_owned(), } + .into() } pub fn call_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![ Action::Notify, Action::SetTweak(Tweak::Sound("ring".to_owned())), @@ -164,10 +170,11 @@ pub fn call_rule() -> ConditionalPushRule { pattern: "m.call.invite".to_owned(), }], } + .into() } pub fn encrypted_room_one_to_one_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![ Action::Notify, Action::SetTweak(Tweak::Sound("default".to_owned())), @@ -186,10 +193,11 @@ pub fn encrypted_room_one_to_one_rule() -> ConditionalPushRule { }, ], } + .into() } pub fn room_one_to_one_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![ Action::Notify, Action::SetTweak(Tweak::Sound("default".to_owned())), @@ -208,10 +216,11 @@ pub fn room_one_to_one_rule() -> ConditionalPushRule { }, ], } + .into() } pub fn message_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![Action::Notify, Action::SetTweak(Tweak::Highlight(false))], default: true, enabled: true, @@ -221,10 +230,11 @@ pub fn message_rule() -> ConditionalPushRule { pattern: "m.room.message".to_owned(), }], } + .into() } pub fn encrypted_rule() -> ConditionalPushRule { - ConditionalPushRule { + ConditionalPushRuleInit { actions: vec![Action::Notify, Action::SetTweak(Tweak::Highlight(false))], default: true, enabled: true, @@ -234,4 +244,5 @@ pub fn encrypted_rule() -> ConditionalPushRule { pattern: "m.room.encrypted".to_owned(), }], } + .into() } diff --git a/src/ruma_wrapper.rs b/src/ruma_wrapper.rs index 48f5487..cd2d21e 100644 --- a/src/ruma_wrapper.rs +++ b/src/ruma_wrapper.rs @@ -7,7 +7,10 @@ use rocket::{ Outcome::*, Request, State, }; -use ruma::{api::Endpoint, identifiers::UserId}; +use ruma::{ + api::Endpoint, + identifiers::{DeviceId, UserId}, +}; use std::{convert::TryInto, io::Cursor, ops::Deref}; use tokio::io::AsyncReadExt; @@ -18,7 +21,7 @@ const MESSAGE_LIMIT: u64 = 20 * 1024 * 1024; // 20 MB pub struct Ruma { pub body: T, pub user_id: Option, - pub device_id: Option, + pub device_id: Option>, pub json_body: Option>, // This is None when body is not a valid string } @@ -63,7 +66,7 @@ impl<'a, T: Endpoint> FromTransformedData<'a> for Ruma { match db.users.find_from_token(&token).unwrap() { // TODO: M_UNKNOWN_TOKEN None => return Failure((Status::Unauthorized, ())), - Some((user_id, device_id)) => (Some(user_id), Some(device_id)), + Some((user_id, device_id)) => (Some(user_id), Some(device_id.into())), } } else { (None, None) From 87fd432527bcd9f442bd8228bb81cc330123a7f6 Mon Sep 17 00:00:00 2001 From: Devin Ragotzy Date: Sat, 25 Jul 2020 15:48:12 -0400 Subject: [PATCH 14/14] Refactor account_data to be more similar to other endpoints --- src/client_server.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/client_server.rs b/src/client_server.rs index f13d6fd..9676f7b 100644 --- a/src/client_server.rs +++ b/src/client_server.rs @@ -589,18 +589,19 @@ pub fn get_global_account_data_route( ) -> ConduitResult { let user_id = body.user_id.as_ref().expect("user is authenticated"); - db.account_data + let event = db + .account_data .get( None, user_id, &EventType::try_from(&body.event_type).expect("EventType::try_from can never fail"), )? - .and_then(|ev| { - serde_json::from_str(ev.json().get()) - .map(|data| get_global_account_data::Response { account_data: data }.into()) - .ok() - }) - .ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found.")) + .ok_or(Error::BadRequest(ErrorKind::NotFound, "Data not found."))?; + + let data = serde_json::from_str(event.json().get()) + .map_err(|_| Error::bad_database("Invalid account data event in db."))?; + + Ok(get_global_account_data::Response { account_data: data }.into()) } #[put("/_matrix/client/r0/profile/<_user_id>/displayname", data = "")]