Update ruma to latest, fix unstable origin feature in ruma

next
Devin Ragotzy 2020-10-27 19:10:09 -04:00 committed by Timo Kösters
parent 49f6ab503a
commit 96dd3b2880
No known key found for this signature in database
GPG Key ID: 24DA7517711A2BA4
13 changed files with 577 additions and 234 deletions

487
Cargo.lock generated
View File

@ -44,9 +44,9 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
[[package]] [[package]]
name = "arrayvec" name = "arrayvec"
version = "0.5.1" version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b"
[[package]] [[package]]
name = "assign" name = "assign"
@ -221,7 +221,7 @@ dependencies = [
"reqwest", "reqwest",
"ring", "ring",
"rocket", "rocket",
"ruma", "ruma 0.0.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"rust-argon2", "rust-argon2",
"serde", "serde",
"serde_json", "serde_json",
@ -273,11 +273,11 @@ checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac"
[[package]] [[package]]
name = "crc32fast" name = "crc32fast"
version = "1.2.0" version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
] ]
[[package]] [[package]]
@ -464,9 +464,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
[[package]] [[package]]
name = "futures" name = "futures"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d8e3078b7b2a8a671cb7a3d17b4760e4181ea243227776ba83fd043b4ca034e" checksum = "95314d38584ffbfda215621d723e0a3906f032e03ae5551e650058dac83d4797"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -479,9 +479,9 @@ dependencies = [
[[package]] [[package]]
name = "futures-channel" name = "futures-channel"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7a4d35f7401e948629c9c3d6638fb9bf94e0b2121e96c3b428cc4e631f3eb74" checksum = "0448174b01148032eed37ac4aed28963aaaa8cfa93569a08e5b479bbc6c2c151"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-sink", "futures-sink",
@ -489,15 +489,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-core" name = "futures-core"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d674eaa0056896d5ada519900dbf97ead2e46a7b6621e8160d79e2f2e1e2784b" checksum = "18eaa56102984bed2c88ea39026cff3ce3b4c7f508ca970cedf2450ea10d4e46"
[[package]] [[package]]
name = "futures-executor" name = "futures-executor"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc709ca1da6f66143b8c9bec8e6260181869893714e9b5a490b169b0414144ab" checksum = "f5f8e0c9258abaea85e78ebdda17ef9666d390e987f006be6080dfe354b708cb"
dependencies = [ dependencies = [
"futures-core", "futures-core",
"futures-task", "futures-task",
@ -506,15 +506,15 @@ dependencies = [
[[package]] [[package]]
name = "futures-io" name = "futures-io"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5fc94b64bb39543b4e432f1790b6bf18e3ee3b74653c5449f63310e9a74b123c" checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b"
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f57ed14da4603b2554682e9f2ff3c65d7567b53188db96cb71538217fc64581b" checksum = "e36fccf3fc58563b4a14d265027c627c3b665d7fed489427e88e7cc929559efe"
dependencies = [ dependencies = [
"proc-macro-hack", "proc-macro-hack",
"proc-macro2", "proc-macro2",
@ -524,24 +524,24 @@ dependencies = [
[[package]] [[package]]
name = "futures-sink" name = "futures-sink"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8764258ed64ebc5d9ed185cf86a95db5cac810269c5d20ececb32e0088abbd" checksum = "0e3ca3f17d6e8804ae5d3df7a7d35b2b3a6fe89dac84b31872720fc3060a0b11"
[[package]] [[package]]
name = "futures-task" name = "futures-task"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dd26820a9f3637f1302da8bceba3ff33adbe53464b54ca24d4e2d4f1db30f94" checksum = "96d502af37186c4fef99453df03e374683f8a1eec9dcc1e66b3b82dc8278ce3c"
dependencies = [ dependencies = [
"once_cell", "once_cell",
] ]
[[package]] [[package]]
name = "futures-util" name = "futures-util"
version = "0.3.6" version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a894a0acddba51a2d49a6f4263b1e64b8c579ece8af50fa86503d52cd1eea34" checksum = "abcb44342f62e6f3e8ac427b8aa815f724fd705dfad060b18ac7866c15bb8e34"
dependencies = [ dependencies = [
"futures-channel", "futures-channel",
"futures-core", "futures-core",
@ -550,7 +550,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-task", "futures-task",
"memchr", "memchr",
"pin-project", "pin-project 1.0.1",
"pin-utils", "pin-utils",
"proc-macro-hack", "proc-macro-hack",
"proc-macro-nested", "proc-macro-nested",
@ -566,6 +566,19 @@ dependencies = [
"byteorder", "byteorder",
] ]
[[package]]
name = "generator"
version = "0.6.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8cdc09201b2e8ca1b19290cf7e65de2246b8e91fb6874279722189c4de7b94dc"
dependencies = [
"cc",
"libc",
"log",
"rustc_version",
"winapi 0.3.9",
]
[[package]] [[package]]
name = "getrandom" name = "getrandom"
version = "0.1.15" version = "0.1.15"
@ -601,9 +614,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]] [[package]]
name = "h2" name = "h2"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "993f9e0baeed60001cf565546b0d3dbe6a6ad23f2bd31644a133c641eccf6d53" checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535"
dependencies = [ dependencies = [
"bytes", "bytes",
"fnv", "fnv",
@ -616,6 +629,7 @@ dependencies = [
"tokio", "tokio",
"tokio-util", "tokio-util",
"tracing", "tracing",
"tracing-futures",
] ]
[[package]] [[package]]
@ -702,7 +716,7 @@ dependencies = [
"httparse", "httparse",
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project", "pin-project 0.4.27",
"socket2", "socket2",
"tokio", "tokio",
"tower-service", "tower-service",
@ -736,12 +750,13 @@ dependencies = [
[[package]] [[package]]
name = "image" name = "image"
version = "0.23.10" version = "0.23.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "985fc06b1304d19c28d5c562ed78ef5316183f2b0053b46763a0b94862373c34" checksum = "b4f0a8345b33b082aedec2f4d7d4a926b845cee184cbe78b703413066564431b"
dependencies = [ dependencies = [
"bytemuck", "bytemuck",
"byteorder", "byteorder",
"color_quant",
"gif", "gif",
"jpeg-decoder", "jpeg-decoder",
"num-iter", "num-iter",
@ -768,11 +783,11 @@ checksum = "cb6ee2a7da03bfc3b66ca47c92c2e392fcc053ea040a85561749b026f7aad09a"
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.7" version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66" checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 1.0.0",
] ]
[[package]] [[package]]
@ -862,9 +877,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.79" version = "0.2.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2448f6066e80e3bfc792e9c98bf705b4b0fc6e8ef5b43e5889aff0eaa9c58743" checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614"
[[package]] [[package]]
name = "linked-hash-map" name = "linked-hash-map"
@ -890,6 +905,19 @@ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
] ]
[[package]]
name = "loom"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a0e8460f2f2121162705187214720353c517b97bdfb3494c0b1e33d83ebe4bed"
dependencies = [
"cfg-if 0.1.10",
"generator",
"scoped-tls",
"serde",
"serde_json",
]
[[package]] [[package]]
name = "lru-cache" name = "lru-cache"
version = "0.1.2" version = "0.1.2"
@ -1218,7 +1246,16 @@ version = "0.4.27"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15" checksum = "2ffbc8e94b38ea3d2d8ba92aea2983b503cd75d0888d75b86bb37970b5698e15"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal 0.4.27",
]
[[package]]
name = "pin-project"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ee41d838744f60d959d7074e3afb6b35c7456d0f61cad38a24e35e6553f73841"
dependencies = [
"pin-project-internal 1.0.1",
] ]
[[package]] [[package]]
@ -1233,10 +1270,21 @@ dependencies = [
] ]
[[package]] [[package]]
name = "pin-project-lite" name = "pin-project-internal"
version = "0.1.10" version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e555d9e657502182ac97b539fb3dae8b79cda19e3e4f8ffb5e8de4f18df93c95" checksum = "81a4ffa594b66bff340084d4081df649a7dc049ac8d7fc458d8e628bfbbb2f86"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "pin-project-lite"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b"
[[package]] [[package]]
name = "pin-utils" name = "pin-utils"
@ -1559,38 +1607,88 @@ dependencies = [
[[package]] [[package]]
name = "ruma" name = "ruma"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"ruma-api", "assign",
"ruma-appservice-api", "js_int",
"ruma-client-api", "ruma-api 0.17.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-common", "ruma-appservice-api 0.2.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-events", "ruma-client-api 0.10.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-federation-api", "ruma-common 0.2.0 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers", "ruma-events 0.22.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde", "ruma-federation-api 0.0.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-signatures", "ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-signatures 0.6.0-dev.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
]
[[package]]
name = "ruma"
version = "0.0.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"assign",
"js_int",
"ruma-api 0.17.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-appservice-api 0.2.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-client-api 0.10.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-common 0.2.0 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-events 0.22.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-federation-api 0.0.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-signatures 0.6.0-dev.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
] ]
[[package]] [[package]]
name = "ruma-api" name = "ruma-api"
version = "0.17.0-alpha.1" version = "0.17.0-alpha.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"http", "http",
"percent-encoding", "percent-encoding",
"ruma-api-macros", "ruma-api-macros 0.17.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers", "ruma-common 0.2.0 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde", "ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde", "serde",
"serde_json", "serde_json",
"strum", "strum",
"thiserror",
]
[[package]]
name = "ruma-api"
version = "0.17.0-alpha.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"http",
"percent-encoding",
"ruma-api-macros 0.17.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-common 0.2.0 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde",
"serde_json",
"strum",
"thiserror",
] ]
[[package]] [[package]]
name = "ruma-api-macros" name = "ruma-api-macros"
version = "0.17.0-alpha.1" version = "0.17.0-alpha.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "ruma-api-macros"
version = "0.17.0-alpha.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
@ -1601,12 +1699,25 @@ dependencies = [
[[package]] [[package]]
name = "ruma-appservice-api" name = "ruma-appservice-api"
version = "0.2.0-alpha.1" version = "0.2.0-alpha.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"ruma-api", "ruma-api 0.17.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-common", "ruma-common 0.2.0 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-events", "ruma-events 0.22.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers", "ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde",
"serde_json",
]
[[package]]
name = "ruma-appservice-api"
version = "0.2.0-alpha.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"ruma-api 0.17.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-common 0.2.0 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-events 0.22.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde", "serde",
"serde_json", "serde_json",
] ]
@ -1614,17 +1725,38 @@ dependencies = [
[[package]] [[package]]
name = "ruma-client-api" name = "ruma-client-api"
version = "0.10.0-alpha.1" version = "0.10.0-alpha.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"assign", "assign",
"http", "http",
"js_int", "js_int",
"maplit",
"percent-encoding", "percent-encoding",
"ruma-api", "ruma-api 0.17.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-common", "ruma-common 0.2.0 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-events", "ruma-events 0.22.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers", "ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde", "ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde",
"serde_json",
"strum",
]
[[package]]
name = "ruma-client-api"
version = "0.10.0-alpha.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"assign",
"http",
"js_int",
"maplit",
"percent-encoding",
"ruma-api 0.17.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-common 0.2.0 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-events 0.22.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde", "serde",
"serde_json", "serde_json",
"strum", "strum",
@ -1633,12 +1765,63 @@ dependencies = [
[[package]] [[package]]
name = "ruma-common" name = "ruma-common"
version = "0.2.0" version = "0.2.0"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"js_int", "js_int",
"ruma-api", "ruma-common-macros 0.2.0 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers", "ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde", "ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde",
"serde_json",
"strum",
]
[[package]]
name = "ruma-common"
version = "0.2.0"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"js_int",
"ruma-common-macros 0.2.0 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde",
"serde_json",
"strum",
]
[[package]]
name = "ruma-common-macros"
version = "0.2.0"
source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "ruma-common-macros"
version = "0.2.0"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "ruma-events"
version = "0.22.0-alpha.1"
source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [
"js_int",
"ruma-common 0.2.0 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-events-macros 0.22.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde", "serde",
"serde_json", "serde_json",
"strum", "strum",
@ -1647,13 +1830,13 @@ dependencies = [
[[package]] [[package]]
name = "ruma-events" name = "ruma-events"
version = "0.22.0-alpha.1" version = "0.22.0-alpha.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [ dependencies = [
"js_int", "js_int",
"ruma-common", "ruma-common 0.2.0 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-events-macros", "ruma-events-macros 0.22.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers", "ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde", "ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde", "serde",
"serde_json", "serde_json",
"strum", "strum",
@ -1662,7 +1845,18 @@ dependencies = [
[[package]] [[package]]
name = "ruma-events-macros" name = "ruma-events-macros"
version = "0.22.0-alpha.1" version = "0.22.0-alpha.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "ruma-events-macros"
version = "0.22.0-alpha.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [ dependencies = [
"proc-macro-crate", "proc-macro-crate",
"proc-macro2", "proc-macro2",
@ -1673,14 +1867,29 @@ dependencies = [
[[package]] [[package]]
name = "ruma-federation-api" name = "ruma-federation-api"
version = "0.0.3" version = "0.0.3"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"js_int", "js_int",
"ruma-api", "ruma-api 0.17.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-common", "ruma-common 0.2.0 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-events", "ruma-events 0.22.0-alpha.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers", "ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde", "ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde",
"serde_json",
]
[[package]]
name = "ruma-federation-api"
version = "0.0.3"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"js_int",
"ruma-api 0.17.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-common 0.2.0 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-events 0.22.0-alpha.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde", "serde",
"serde_json", "serde_json",
] ]
@ -1688,11 +1897,24 @@ dependencies = [
[[package]] [[package]]
name = "ruma-identifiers" name = "ruma-identifiers"
version = "0.17.4" version = "0.17.4"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [
"ruma-identifiers-macros 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-identifiers-validation 0.1.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde",
"strum",
]
[[package]]
name = "ruma-identifiers"
version = "0.17.4"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [ dependencies = [
"rand", "rand",
"ruma-identifiers-macros", "ruma-identifiers-macros 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-identifiers-validation", "ruma-identifiers-validation 0.1.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde", "serde",
"strum", "strum",
] ]
@ -1700,18 +1922,38 @@ dependencies = [
[[package]] [[package]]
name = "ruma-identifiers-macros" name = "ruma-identifiers-macros"
version = "0.17.4" version = "0.17.4"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
"ruma-identifiers-validation", "ruma-identifiers-validation 0.1.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"syn",
]
[[package]]
name = "ruma-identifiers-macros"
version = "0.17.4"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"proc-macro2",
"quote",
"ruma-identifiers-validation 0.1.1 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"syn", "syn",
] ]
[[package]] [[package]]
name = "ruma-identifiers-validation" name = "ruma-identifiers-validation"
version = "0.1.1" version = "0.1.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [
"serde",
"strum",
]
[[package]]
name = "ruma-identifiers-validation"
version = "0.1.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [ dependencies = [
"serde", "serde",
"strum", "strum",
@ -1720,7 +1962,19 @@ dependencies = [
[[package]] [[package]]
name = "ruma-serde" name = "ruma-serde"
version = "0.2.3" version = "0.2.3"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [
"form_urlencoded",
"itoa",
"js_int",
"serde",
"serde_json",
]
[[package]]
name = "ruma-serde"
version = "0.2.3"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [ dependencies = [
"form_urlencoded", "form_urlencoded",
"itoa", "itoa",
@ -1732,10 +1986,25 @@ dependencies = [
[[package]] [[package]]
name = "ruma-signatures" name = "ruma-signatures"
version = "0.6.0-dev.1" version = "0.6.0-dev.1"
source = "git+https://github.com/timokoesters/ruma?branch=timo-fed-fixes#47fab87325b71b7f6c2fb3cd276d1f813e42abf7" source = "git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889#c15382ca41262058302959eac4029ab4a1ea5889"
dependencies = [ dependencies = [
"base64", "base64",
"ring", "ring",
"ruma-identifiers 0.17.4 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"ruma-serde 0.2.3 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde_json",
"untrusted",
]
[[package]]
name = "ruma-signatures"
version = "0.6.0-dev.1"
source = "git+https://github.com/DevinR528/ruma?branch=unstable-join#424b138d84ccc47c0b212708a54f66bf88f7d57a"
dependencies = [
"base64",
"ring",
"ruma-identifiers 0.17.4 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"ruma-serde 0.2.3 (git+https://github.com/DevinR528/ruma?branch=unstable-join)",
"serde_json", "serde_json",
"untrusted", "untrusted",
] ]
@ -1754,9 +2023,9 @@ dependencies = [
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.17" version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2610b7f643d18c87dff3b489950269617e6601a51f1f05aa5daefee36f64f0b" checksum = "6e3bad0ee36814ca07d7968269dd4b7ec89ec2da10c4bb613928d3077083c232"
[[package]] [[package]]
name = "rustc_version" name = "rustc_version"
@ -1796,6 +2065,12 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "scoped-tls"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2"
[[package]] [[package]]
name = "scopeguard" name = "scopeguard"
version = "1.1.0" version = "1.1.0"
@ -1901,11 +2176,12 @@ checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d"
[[package]] [[package]]
name = "sharded-slab" name = "sharded-slab"
version = "0.0.9" version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06d5a3f5166fb5b42a5439f2eee8b9de149e235961e3eb21c5808fc3ea17ff3e" checksum = "7b4921be914e16899a80adefb821f8ddb7974e3f1250223575a44ed994882127"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"loom",
] ]
[[package]] [[package]]
@ -1982,12 +2258,11 @@ checksum = "7345c971d1ef21ffdbd103a75990a15eb03604fc8b8852ca8cb418ee1a099028"
[[package]] [[package]]
name = "state-res" name = "state-res"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/timokoesters/state-res?branch=spec-comp#a7d76935f12757aecfee305838069c9bcbe7d34a"
dependencies = [ dependencies = [
"itertools", "itertools",
"js_int", "js_int",
"maplit", "maplit",
"ruma", "ruma 0.0.1 (git+https://github.com/ruma/ruma?rev=c15382ca41262058302959eac4029ab4a1ea5889)",
"serde", "serde",
"serde_json", "serde_json",
"thiserror", "thiserror",
@ -2067,9 +2342,9 @@ dependencies = [
[[package]] [[package]]
name = "syn" name = "syn"
version = "1.0.44" version = "1.0.48"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e03e57e4fcbfe7749842d53e24ccb9aa12b7252dbe5e91d2acad31834c8b8fdd" checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -2292,6 +2567,16 @@ dependencies = [
"lazy_static", "lazy_static",
] ]
[[package]]
name = "tracing-futures"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ab7bb6f14721aa00656086e9335d363c5c8747bae02ebe32ea2c7dece5689b4c"
dependencies = [
"pin-project 0.4.27",
"tracing",
]
[[package]] [[package]]
name = "tracing-log" name = "tracing-log"
version = "0.1.1" version = "0.1.1"
@ -2315,9 +2600,9 @@ dependencies = [
[[package]] [[package]]
name = "tracing-subscriber" name = "tracing-subscriber"
version = "0.2.13" version = "0.2.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ef0a5e15477aa303afbfac3a44cba9b6430fdaad52423b1e6c0dbbe28c3eedd" checksum = "2810660b9d5b18895d140caba6401765749a6a162e5d0736cfc44ea50db9d79d"
dependencies = [ dependencies = [
"ansi_term", "ansi_term",
"chrono", "chrono",
@ -2561,9 +2846,9 @@ dependencies = [
[[package]] [[package]]
name = "weezl" name = "weezl"
version = "0.1.1" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0e26e7a4d998e3d7949c69444b8b4916bac810da0d3a82ae612c89e952782f4" checksum = "8795d6e0e17485803cc10ef126bb8c0d59b7c61b219d66cfe0b3216dd0e8580a"
[[package]] [[package]]
name = "widestring" name = "widestring"

View File

@ -19,12 +19,13 @@ rocket = { git = "https://github.com/timokoesters/Rocket.git", branch = "empty_p
# Used for matrix spec type definitions and helpers # Used for matrix spec type definitions and helpers
#ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"], rev = "aff914050eb297bd82b8aafb12158c88a9e480e1" } #ruma = { git = "https://github.com/ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"], rev = "aff914050eb297bd82b8aafb12158c88a9e480e1" }
ruma = { git = "https://github.com/timokoesters/ruma", features = ["rand", "client-api", "federation-api", "unstable-exhaustive-types", "unstable-pre-spec", "unstable-synapse-quirks"], branch = "timo-fed-fixes" } ruma = { git = "https://github.com/DevinR528/ruma", features = ["rand", "client-api", "federation-api", "unstable-exhaustive-types", "unstable-pre-spec", "unstable-synapse-quirks"], branch = "unstable-join" }
#ruma = { path = "../ruma/ruma", features = ["unstable-exhaustive-types", "rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"] } # ruma = { path = "../ruma/ruma", features = ["unstable-exhaustive-types", "rand", "client-api", "federation-api", "unstable-pre-spec", "unstable-synapse-quirks"] }
# Used when doing state resolution # Used when doing state resolution
state-res = { git = "https://github.com/timokoesters/state-res", branch = "spec-comp", features = ["unstable-pre-spec"] } # state-res = { git = "https://github.com/timokoesters/state-res", branch = "spec-comp", features = ["unstable-pre-spec"] }
#state-res = { path = "../state-res", features = ["unstable-pre-spec"] } state-res = { git = "https://github.com/ruma/state-res", branch = "timo-spec-comp", features = ["unstable-pre-spec"] }
# state-res = { path = "../../state-res", features = ["unstable-pre-spec"] }
# Used for long polling # Used for long polling
tokio = "0.2.22" tokio = "0.2.22"
@ -72,3 +73,11 @@ required-features = ["conduit_bin"]
[lib] [lib]
name = "conduit" name = "conduit"
path = "src/lib.rs" path = "src/lib.rs"
# [patch."https://github.com/timokoesters/ruma"]
# ruma = { path = "../ruma/ruma", features = ["rand", "client-api", "federation-api", "unstable-exhaustive-types", "unstable-pre-spec", "unstable-synapse-quirks"] }
# # ruma = { git = "https://github.com/ruma/ruma", rev = "64b9c646d15a359d62ab464a95176ff94adb2554", features = ["rand", "client-api", "federation-api", "unstable-exhaustive-types", "unstable-pre-spec", "unstable-synapse-quirks"]}
[patch."https://github.com/ruma/state-res"]
state-res = { path = "../../state-res", features = ["unstable-pre-spec"] }
# state-res = { git = "https://github.com/ruma/state-res", branch = "timo-spec-comp" }

View File

@ -107,7 +107,7 @@ pub async fn get_backup_route(
)] )]
pub async fn delete_backup_route( pub async fn delete_backup_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup::Request>, body: Ruma<delete_backup::Request<'_>>,
) -> ConduitResult<delete_backup::Response> { ) -> ConduitResult<delete_backup::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
@ -158,7 +158,7 @@ pub async fn add_backup_keys_route(
)] )]
pub async fn add_backup_key_sessions_route( pub async fn add_backup_key_sessions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<add_backup_key_sessions::Request>, body: Ruma<add_backup_key_sessions::Request<'_>>,
) -> ConduitResult<add_backup_key_sessions::Response> { ) -> ConduitResult<add_backup_key_sessions::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
@ -189,7 +189,7 @@ pub async fn add_backup_key_sessions_route(
)] )]
pub async fn add_backup_key_session_route( pub async fn add_backup_key_session_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<add_backup_key_session::Request>, body: Ruma<add_backup_key_session::Request<'_>>,
) -> ConduitResult<add_backup_key_session::Response> { ) -> ConduitResult<add_backup_key_session::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
@ -232,7 +232,7 @@ pub async fn get_backup_keys_route(
)] )]
pub async fn get_backup_key_sessions_route( pub async fn get_backup_key_sessions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_backup_key_sessions::Request>, body: Ruma<get_backup_key_sessions::Request<'_>>,
) -> ConduitResult<get_backup_key_sessions::Response> { ) -> ConduitResult<get_backup_key_sessions::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
@ -249,13 +249,14 @@ pub async fn get_backup_key_sessions_route(
)] )]
pub async fn get_backup_key_session_route( pub async fn get_backup_key_session_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_backup_key_session::Request>, body: Ruma<get_backup_key_session::Request<'_>>,
) -> ConduitResult<get_backup_key_session::Response> { ) -> ConduitResult<get_backup_key_session::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let key_data = let key_data = db
db.key_backups .key_backups
.get_session(&sender_user, &body.version, &body.room_id, &body.session_id)?; .get_session(&sender_user, &body.version, &body.room_id, &body.session_id)?
.ok_or_else(|| Error::BadDatabase("Backup key not found for this user's session"))?;
Ok(get_backup_key_session::Response { key_data }.into()) Ok(get_backup_key_session::Response { key_data }.into())
} }
@ -266,7 +267,7 @@ pub async fn get_backup_key_session_route(
)] )]
pub async fn delete_backup_keys_route( pub async fn delete_backup_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup_keys::Request>, body: Ruma<delete_backup_keys::Request<'_>>,
) -> ConduitResult<delete_backup_keys::Response> { ) -> ConduitResult<delete_backup_keys::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
@ -288,7 +289,7 @@ pub async fn delete_backup_keys_route(
)] )]
pub async fn delete_backup_key_sessions_route( pub async fn delete_backup_key_sessions_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup_key_sessions::Request>, body: Ruma<delete_backup_key_sessions::Request<'_>>,
) -> ConduitResult<delete_backup_key_sessions::Response> { ) -> ConduitResult<delete_backup_key_sessions::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
@ -310,7 +311,7 @@ pub async fn delete_backup_key_sessions_route(
)] )]
pub async fn delete_backup_key_session_route( pub async fn delete_backup_key_session_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<delete_backup_key_session::Request>, body: Ruma<delete_backup_key_session::Request<'_>>,
) -> ConduitResult<delete_backup_key_session::Response> { ) -> ConduitResult<delete_backup_key_session::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");

View File

@ -22,11 +22,11 @@ pub async fn get_capabilities_route() -> ConduitResult<get_capabilities::Respons
Ok(get_capabilities::Response { Ok(get_capabilities::Response {
capabilities: get_capabilities::Capabilities { capabilities: get_capabilities::Capabilities {
change_password: None, // None means it is possible change_password: get_capabilities::ChangePasswordCapability::default(), // enabled by default
room_versions: Some(get_capabilities::RoomVersionsCapability { room_versions: get_capabilities::RoomVersionsCapability {
default: "6".to_owned(), default: RoomVersionId::Version6,
available, available,
}), },
custom_capabilities: BTreeMap::new(), custom_capabilities: BTreeMap::new(),
}, },
} }

View File

@ -9,10 +9,10 @@ pub async fn get_filter_route() -> ConduitResult<get_filter::Response> {
// TODO // TODO
Ok(get_filter::Response::new(filter::IncomingFilterDefinition { Ok(get_filter::Response::new(filter::IncomingFilterDefinition {
event_fields: None, event_fields: None,
event_format: None, event_format: filter::EventFormat::default(),
account_data: None, account_data: filter::IncomingFilter::default(),
room: None, room: filter::IncomingRoomFilter::default(),
presence: None, presence: filter::IncomingFilter::default(),
}) })
.into()) .into())
} }

View File

@ -11,7 +11,7 @@ use ruma::{
uiaa::{AuthFlow, UiaaInfo}, uiaa::{AuthFlow, UiaaInfo},
}, },
}, },
encryption::IncomingUnsignedDeviceInfo, encryption::UnsignedDeviceInfo,
}; };
use std::collections::{BTreeMap, HashSet}; use std::collections::{BTreeMap, HashSet};
@ -24,7 +24,7 @@ use rocket::{get, post};
)] )]
pub async fn upload_keys_route( pub async fn upload_keys_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<upload_keys::Request<'_>>, body: Ruma<upload_keys::Request>,
) -> ConduitResult<upload_keys::Response> { ) -> ConduitResult<upload_keys::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
let sender_device = body.sender_device.as_ref().expect("user is authenticated"); let sender_device = body.sender_device.as_ref().expect("user is authenticated");
@ -94,7 +94,7 @@ pub async fn get_keys_route(
Error::bad_database("all_device_keys contained nonexistent device.") Error::bad_database("all_device_keys contained nonexistent device.")
})?; })?;
keys.unsigned = IncomingUnsignedDeviceInfo { keys.unsigned = UnsignedDeviceInfo {
device_display_name: metadata.display_name, device_display_name: metadata.display_name,
}; };
@ -113,7 +113,7 @@ pub async fn get_keys_route(
), ),
)?; )?;
keys.unsigned = IncomingUnsignedDeviceInfo { keys.unsigned = UnsignedDeviceInfo {
device_display_name: metadata.display_name, device_display_name: metadata.display_name,
}; };

View File

@ -39,7 +39,7 @@ pub async fn create_content_route(
db.media.create( db.media.create(
mxc.clone(), mxc.clone(),
&body.filename.as_deref(), &body.filename.as_deref(),
&body.content_type, body.content_type.as_deref().unwrap_or("img"), // TODO this is now optional handle
&body.file, &body.file,
)?; )?;
@ -66,8 +66,8 @@ pub async fn get_content_route(
{ {
Ok(get_content::Response { Ok(get_content::Response {
file, file,
content_type, content_type: Some(content_type),
content_disposition: filename.unwrap_or_default(), // TODO: Spec says this should be optional content_disposition: filename,
} }
.into()) .into())
} else if &*body.server_name != db.globals.server_name() && body.allow_remote { } else if &*body.server_name != db.globals.server_name() && body.allow_remote {
@ -84,8 +84,11 @@ pub async fn get_content_route(
db.media.create( db.media.create(
mxc, mxc,
&Some(&get_content_response.content_disposition), &get_content_response.content_disposition.as_deref(),
&get_content_response.content_type, get_content_response // TODO this is now optional handle
.content_type
.as_deref()
.unwrap_or("img"),
&get_content_response.file, &get_content_response.file,
)?; )?;
@ -116,7 +119,11 @@ pub async fn get_content_thumbnail_route(
.try_into() .try_into()
.map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Width is invalid."))?, .map_err(|_| Error::BadRequest(ErrorKind::InvalidParam, "Width is invalid."))?,
)? { )? {
Ok(get_content_thumbnail::Response { file, content_type }.into()) Ok(get_content_thumbnail::Response {
file,
content_type: Some(content_type),
}
.into())
} else if &*body.server_name != db.globals.server_name() && body.allow_remote { } else if &*body.server_name != db.globals.server_name() && body.allow_remote {
let get_thumbnail_response = server_server::send_request( let get_thumbnail_response = server_server::send_request(
&db.globals, &db.globals,
@ -135,7 +142,10 @@ pub async fn get_content_thumbnail_route(
db.media.upload_thumbnail( db.media.upload_thumbnail(
mxc, mxc,
&None, &None,
&get_thumbnail_response.content_type, get_thumbnail_response
.content_type
.as_deref()
.unwrap_or("img"), // TODO now optional, deal with it somehow
body.width.try_into().expect("all UInts are valid u32s"), body.width.try_into().expect("all UInts are valid u32s"),
body.height.try_into().expect("all UInts are valid u32s"), body.height.try_into().expect("all UInts are valid u32s"),
&get_thumbnail_response.file, &get_thumbnail_response.file,

View File

@ -23,7 +23,11 @@ use ruma::{
}; };
use state_res::StateEvent; use state_res::StateEvent;
use std::{ use std::{
collections::BTreeMap, collections::HashMap, collections::HashSet, convert::TryFrom, iter, collections::BTreeMap,
collections::HashMap,
collections::HashSet,
convert::{TryFrom, TryInto},
iter,
sync::Arc, sync::Arc,
}; };
@ -509,31 +513,42 @@ async fn join_room_by_id_helper(
.expect("event is valid, we just created it"), .expect("event is valid, we just created it"),
); );
// TODO fixup CanonicalJsonValue
// use that instead of serde_json::Map... maybe?
let mut canon_json_stub =
serde_json::from_value(join_event_stub_value).expect("json Value is canonical JSON");
// Generate event id // Generate event id
let event_id = EventId::try_from(&*format!( let event_id = EventId::try_from(&*format!(
"${}", "${}",
ruma::signatures::reference_hash(&join_event_stub_value) ruma::signatures::reference_hash(&canon_json_stub, &RoomVersionId::Version6)
.expect("ruma can calculate reference hashes") .expect("ruma can calculate reference hashes")
)) ))
.expect("ruma's reference hashes are valid event ids"); .expect("ruma's reference hashes are valid event ids");
// We don't leave the event id into the pdu because that's only allowed in v1 or v2 rooms // We don't leave the event id into the pdu because that's only allowed in v1 or v2 rooms
let join_event_stub = join_event_stub_value.as_object_mut().unwrap(); // let join_event_stub = join_event_stub_value.as_object_mut().unwrap();
join_event_stub.remove("event_id"); // join_event_stub.remove("event_id");
canon_json_stub.remove("event_id");
ruma::signatures::hash_and_sign_event( ruma::signatures::hash_and_sign_event(
db.globals.server_name().as_str(), db.globals.server_name().as_str(),
db.globals.keypair(), db.globals.keypair(),
&mut join_event_stub_value, &mut canon_json_stub,
&RoomVersionId::Version6,
) )
.expect("event is valid, we just created it"); .expect("event is valid, we just created it");
// Add event_id back // Add event_id back
let join_event_stub = join_event_stub_value.as_object_mut().unwrap(); canon_json_stub.insert(
join_event_stub.insert("event_id".to_owned(), event_id.to_string().into()); "event_id".to_owned(),
serde_json::json!(event_id)
.try_into()
.expect("EventId is a valid CanonicalJsonValue"),
);
// It has enough fields to be called a proper event now // It has enough fields to be called a proper event now
let join_event = join_event_stub_value; let join_event = canon_json_stub;
let send_join_response = server_server::send_request( let send_join_response = server_server::send_request(
&db.globals, &db.globals,
@ -541,27 +556,31 @@ async fn join_room_by_id_helper(
federation::membership::create_join_event::v2::Request { federation::membership::create_join_event::v2::Request {
room_id, room_id,
event_id: &event_id, event_id: &event_id,
pdu_stub: PduEvent::convert_to_outgoing_federation_event(join_event.clone()), pdu_stub: PduEvent::convert_to_outgoing_federation_event(
serde_json::to_value(&join_event)
.expect("we just validated and ser/de this event"),
),
}, },
) )
.await?; .await?;
let add_event_id = |pdu: &Raw<Pdu>| { let add_event_id = |pdu: &Raw<Pdu>| -> Result<(EventId, serde_json::Value)> {
let mut value = serde_json::from_str(pdu.json().get()) let mut value = serde_json::from_str(pdu.json().get())
.expect("converting raw jsons to values always works"); .expect("converting raw jsons to values always works");
let event_id = EventId::try_from(&*format!( let event_id = EventId::try_from(&*format!(
"${}", "${}",
ruma::signatures::reference_hash(&value) ruma::signatures::reference_hash(&value, &RoomVersionId::Version6)
.expect("ruma can calculate reference hashes") .expect("ruma can calculate reference hashes")
)) ))
.expect("ruma's reference hashes are valid event ids"); .expect("ruma's reference hashes are valid event ids");
value value.insert(
.as_object_mut() "event_id".to_owned(),
.ok_or_else(|| Error::BadServerResponse("PDU is not an object."))? serde_json::from_value(serde_json::json!(event_id))
.insert("event_id".to_owned(), event_id.to_string().into()); .expect("a valid EventId can be converted to CanonicalJsonValue"),
);
Ok((event_id, value)) Ok((event_id, serde_json::json!(value))) // TODO CanonicalJsonValue fixup?
}; };
let room_state = send_join_response.room_state.state.iter().map(add_event_id); let room_state = send_join_response.room_state.state.iter().map(add_event_id);
@ -580,7 +599,10 @@ async fn join_room_by_id_helper(
let mut event_map = room_state let mut event_map = room_state
.chain(auth_chain) .chain(auth_chain)
.chain(iter::once(Ok((event_id, join_event)))) // Add join event we just created .chain(iter::once(Ok((
event_id,
serde_json::to_value(join_event).unwrap(),
)))) // Add join event we just created
.map(|r| { .map(|r| {
let (event_id, value) = r?; let (event_id, value) = r?;
serde_json::from_value::<StateEvent>(value.clone()) serde_json::from_value::<StateEvent>(value.clone())
@ -595,7 +617,7 @@ async fn join_room_by_id_helper(
let control_events = event_map let control_events = event_map
.values() .values()
.filter(|pdu| pdu.is_power_event()) .filter(|pdu| pdu.is_power_event())
.map(|pdu| pdu.event_id().clone()) .map(|pdu| pdu.event_id())
.collect::<Vec<_>>(); .collect::<Vec<_>>();
// These events are not guaranteed to be sorted but they are resolved according to spec // These events are not guaranteed to be sorted but they are resolved according to spec

View File

@ -99,14 +99,14 @@ pub async fn send_state_event_for_empty_key_route(
)] )]
pub async fn get_state_events_route( pub async fn get_state_events_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_state_events::Request>, body: Ruma<get_state_events::Request<'_>>,
) -> ConduitResult<get_state_events::Response> { ) -> ConduitResult<get_state_events::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
// Users not in the room should not be able to access the state unless history_visibility is // Users not in the room should not be able to access the state unless history_visibility is
// WorldReadable // WorldReadable
if !db.rooms.is_joined(sender_user, &body.room_id)? { if !db.rooms.is_joined(sender_user, &body.room_id)?
if !matches!( && !matches!(
db.rooms db.rooms
.room_state_get(&body.room_id, &EventType::RoomHistoryVisibility, "")? .room_state_get(&body.room_id, &EventType::RoomHistoryVisibility, "")?
.map(|(_, event)| { .map(|(_, event)| {
@ -119,12 +119,12 @@ pub async fn get_state_events_route(
.map(|e| e.history_visibility) .map(|e| e.history_visibility)
}), }),
Some(Ok(HistoryVisibility::WorldReadable)) Some(Ok(HistoryVisibility::WorldReadable))
) { )
return Err(Error::BadRequest( {
ErrorKind::Forbidden, return Err(Error::BadRequest(
"You don't have permission to view the room state.", ErrorKind::Forbidden,
)); "You don't have permission to view the room state.",
} ));
} }
Ok(get_state_events::Response { Ok(get_state_events::Response {
@ -144,14 +144,14 @@ pub async fn get_state_events_route(
)] )]
pub async fn get_state_events_for_key_route( pub async fn get_state_events_for_key_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_state_events_for_key::Request>, body: Ruma<get_state_events_for_key::Request<'_>>,
) -> ConduitResult<get_state_events_for_key::Response> { ) -> ConduitResult<get_state_events_for_key::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
// Users not in the room should not be able to access the state unless history_visibility is // Users not in the room should not be able to access the state unless history_visibility is
// WorldReadable // WorldReadable
if !db.rooms.is_joined(sender_user, &body.room_id)? { if !db.rooms.is_joined(sender_user, &body.room_id)?
if !matches!( && !matches!(
db.rooms db.rooms
.room_state_get(&body.room_id, &EventType::RoomHistoryVisibility, "")? .room_state_get(&body.room_id, &EventType::RoomHistoryVisibility, "")?
.map(|(_, event)| { .map(|(_, event)| {
@ -164,12 +164,12 @@ pub async fn get_state_events_for_key_route(
.map(|e| e.history_visibility) .map(|e| e.history_visibility)
}), }),
Some(Ok(HistoryVisibility::WorldReadable)) Some(Ok(HistoryVisibility::WorldReadable))
) { )
return Err(Error::BadRequest( {
ErrorKind::Forbidden, return Err(Error::BadRequest(
"You don't have permission to view the room state.", ErrorKind::Forbidden,
)); "You don't have permission to view the room state.",
} ));
} }
let event = db let event = db
@ -194,14 +194,14 @@ pub async fn get_state_events_for_key_route(
)] )]
pub async fn get_state_events_for_empty_key_route( pub async fn get_state_events_for_empty_key_route(
db: State<'_, Database>, db: State<'_, Database>,
body: Ruma<get_state_events_for_empty_key::Request>, body: Ruma<get_state_events_for_empty_key::Request<'_>>,
) -> ConduitResult<get_state_events_for_empty_key::Response> { ) -> ConduitResult<get_state_events_for_empty_key::Response> {
let sender_user = body.sender_user.as_ref().expect("user is authenticated"); let sender_user = body.sender_user.as_ref().expect("user is authenticated");
// Users not in the room should not be able to access the state unless history_visibility is // Users not in the room should not be able to access the state unless history_visibility is
// WorldReadable // WorldReadable
if !db.rooms.is_joined(sender_user, &body.room_id)? { if !db.rooms.is_joined(sender_user, &body.room_id)?
if !matches!( && !matches!(
db.rooms db.rooms
.room_state_get(&body.room_id, &EventType::RoomHistoryVisibility, "")? .room_state_get(&body.room_id, &EventType::RoomHistoryVisibility, "")?
.map(|(_, event)| { .map(|(_, event)| {
@ -214,12 +214,12 @@ pub async fn get_state_events_for_empty_key_route(
.map(|e| e.history_visibility) .map(|e| e.history_visibility)
}), }),
Some(Ok(HistoryVisibility::WorldReadable)) Some(Ok(HistoryVisibility::WorldReadable))
) { )
return Err(Error::BadRequest( {
ErrorKind::Forbidden, return Err(Error::BadRequest(
"You don't have permission to view the room state.", ErrorKind::Forbidden,
)); "You don't have permission to view the room state.",
} ));
} }
let event = db let event = db

View File

@ -15,7 +15,7 @@ use ruma::{
}, },
EventType, EventType,
}, },
EventId, Raw, RoomAliasId, RoomId, ServerName, UserId, EventId, Raw, RoomAliasId, RoomId, RoomVersionId, ServerName, UserId,
}; };
use sled::IVec; use sled::IVec;
use state_res::{event_auth, Error as StateError, Requester, StateEvent, StateMap, StateStore}; use state_res::{event_auth, Error as StateError, Requester, StateEvent, StateMap, StateStore};
@ -196,7 +196,7 @@ impl Rooms {
Ok(self.pduid_statehash.get(pdu_id)?) Ok(self.pduid_statehash.get(pdu_id)?)
} }
/// Returns the last state hash key added to the db. /// Returns the last state hash key added to the db for the given room.
pub fn current_state_hash(&self, room_id: &RoomId) -> Result<Option<StateHashId>> { pub fn current_state_hash(&self, room_id: &RoomId) -> Result<Option<StateHashId>> {
Ok(self.roomid_statehash.get(room_id.as_bytes())?) Ok(self.roomid_statehash.get(room_id.as_bytes())?)
} }
@ -249,7 +249,7 @@ impl Rooms {
.is_some()) .is_some())
} }
/// Returns the full room state. /// Force the creation of a new StateHash and insert it into the db.
pub fn force_state( pub fn force_state(
&self, &self,
room_id: &RoomId, room_id: &RoomId,
@ -436,6 +436,7 @@ impl Rooms {
Ok(()) Ok(())
} }
#[allow(clippy::too_many_arguments)]
/// Creates a new persisted data unit and adds it to a room. /// Creates a new persisted data unit and adds it to a room.
pub fn append_pdu( pub fn append_pdu(
&self, &self,
@ -687,7 +688,7 @@ impl Rooms {
} }
EventType::RoomMember => { EventType::RoomMember => {
let prev_event = self let prev_event = self
.get_pdu(prev_events.iter().next().ok_or(Error::BadRequest( .get_pdu(prev_events.get(0).ok_or(Error::BadRequest(
ErrorKind::Unknown, ErrorKind::Unknown,
"Membership can't be the first event", "Membership can't be the first event",
))?)? ))?)?
@ -703,7 +704,7 @@ impl Rooms {
sender: &sender, sender: &sender,
}, },
prev_event, prev_event,
None, None, // TODO: third party invite
&auth_events &auth_events
.iter() .iter()
.map(|((ty, key), pdu)| { .map(|((ty, key), pdu)| {
@ -761,7 +762,7 @@ impl Rooms {
} }
let mut pdu = PduEvent { let mut pdu = PduEvent {
event_id: EventId::try_from("$thiswillbefilledinlater").expect("we know this is valid"), event_id: ruma::event_id!("$thiswillbefilledinlater"),
room_id: room_id.clone(), room_id: room_id.clone(),
sender: sender.clone(), sender: sender.clone(),
origin_server_ts: utils::millis_since_unix_epoch() origin_server_ts: utils::millis_since_unix_epoch()
@ -787,37 +788,42 @@ impl Rooms {
}; };
// Hash and sign // Hash and sign
let mut pdu_json = serde_json::to_value(&pdu).expect("event is valid, we just created it"); let mut pdu_json: BTreeMap<String, ruma::serde::CanonicalJsonValue> =
pdu_json serde_json::from_value(serde_json::json!(&pdu))
.as_object_mut() .expect("event is valid, we just created it");
.expect("json is object")
.remove("event_id"); pdu_json.remove("event_id");
// Add origin because synapse likes that (and it's required in the spec) // Add origin because synapse likes that (and it's required in the spec)
pdu_json pdu_json.insert(
.as_object_mut() "origin".to_owned(),
.expect("json is object") serde_json::json!(globals.server_name())
.insert("origin".to_owned(), globals.server_name().as_str().into()); .try_into()
.expect("server name is a valid CanonicalJsonValue"),
);
ruma::signatures::hash_and_sign_event( ruma::signatures::hash_and_sign_event(
globals.server_name().as_str(), globals.server_name().as_str(),
globals.keypair(), globals.keypair(),
&mut pdu_json, &mut pdu_json,
&RoomVersionId::Version6,
) )
.expect("event is valid, we just created it"); .expect("event is valid, we just created it");
// Generate event id // Generate event id
pdu.event_id = EventId::try_from(&*format!( pdu.event_id = EventId::try_from(&*format!(
"${}", "${}",
ruma::signatures::reference_hash(&pdu_json) ruma::signatures::reference_hash(&pdu_json, &RoomVersionId::Version6)
.expect("ruma can calculate reference hashes") .expect("ruma can calculate reference hashes")
)) ))
.expect("ruma's reference hashes are valid event ids"); .expect("ruma's reference hashes are valid event ids");
pdu_json pdu_json.insert(
.as_object_mut() "event_id".to_owned(),
.expect("json is object") serde_json::json!(pdu.event_id)
.insert("event_id".to_owned(), pdu.event_id.to_string().into()); .try_into()
.expect("EventId is a valid CanonicalJsonValue"),
);
// Increment the last index and use that // Increment the last index and use that
// This is also the next_batch/since value // This is also the next_batch/since value
@ -832,7 +838,7 @@ impl Rooms {
self.append_pdu( self.append_pdu(
&pdu, &pdu,
&pdu_json, &serde_json::json!(pdu_json), // TODO fixup CanonicalJsonValue
count, count,
pdu_id.clone().into(), pdu_id.clone().into(),
globals, globals,

View File

@ -8,7 +8,7 @@ use ruma::{
keys::{CrossSigningKey, OneTimeKey}, keys::{CrossSigningKey, OneTimeKey},
}, },
}, },
encryption::IncomingDeviceKeys, encryption::DeviceKeys,
events::{AnyToDeviceEvent, EventType}, events::{AnyToDeviceEvent, EventType},
DeviceId, DeviceKeyAlgorithm, DeviceKeyId, Raw, UserId, DeviceId, DeviceKeyAlgorithm, DeviceKeyId, Raw, UserId,
}; };
@ -401,7 +401,7 @@ impl Users {
&self, &self,
user_id: &UserId, user_id: &UserId,
device_id: &DeviceId, device_id: &DeviceId,
device_keys: &IncomingDeviceKeys, device_keys: &DeviceKeys,
rooms: &super::rooms::Rooms, rooms: &super::rooms::Rooms,
globals: &super::globals::Globals, globals: &super::globals::Globals,
) -> Result<()> { ) -> Result<()> {
@ -631,7 +631,7 @@ impl Users {
&self, &self,
user_id: &UserId, user_id: &UserId,
device_id: &DeviceId, device_id: &DeviceId,
) -> Result<Option<IncomingDeviceKeys>> { ) -> Result<Option<DeviceKeys>> {
let mut key = user_id.to_string().as_bytes().to_vec(); let mut key = user_id.to_string().as_bytes().to_vec();
key.push(0xff); key.push(0xff);
key.extend_from_slice(device_id.as_bytes()); key.extend_from_slice(device_id.as_bytes());

View File

@ -1,7 +1,8 @@
use crate::Error; use crate::Error;
use ruma::{ use ruma::{
api::{Outgoing, OutgoingRequest}, api::{AuthScheme, OutgoingRequest},
identifiers::{DeviceId, UserId}, identifiers::{DeviceId, UserId},
Outgoing,
}; };
use std::{convert::TryFrom, convert::TryInto, ops::Deref}; use std::{convert::TryFrom, convert::TryInto, ops::Deref};
@ -61,28 +62,30 @@ where
.await .await
.expect("database was loaded"); .expect("database was loaded");
let (sender_user, sender_device) = if T::METADATA.requires_authentication { let (sender_user, sender_device) =
// Get token from header or query value // TODO: Do we need to matches! anything else here? ServerSignatures
let token = match request if matches!(T::METADATA.authentication, AuthScheme::AccessToken | AuthScheme::QueryOnlyAccessToken) {
.headers() // Get token from header or query value
.get_one("Authorization") let token = match request
.map(|s| s[7..].to_owned()) // Split off "Bearer " .headers()
.or_else(|| request.get_query_value("access_token").and_then(|r| r.ok())) .get_one("Authorization")
{ .map(|s| s[7..].to_owned()) // Split off "Bearer "
// TODO: M_MISSING_TOKEN .or_else(|| request.get_query_value("access_token").and_then(|r| r.ok()))
None => return Failure((Status::Unauthorized, ())), {
Some(token) => token, // TODO: M_MISSING_TOKEN
}; None => return Failure((Status::Unauthorized, ())),
Some(token) => token,
};
// Check if token is valid // Check if token is valid
match db.users.find_from_token(&token).unwrap() { match db.users.find_from_token(&token).unwrap() {
// TODO: M_UNKNOWN_TOKEN // TODO: M_UNKNOWN_TOKEN
None => return Failure((Status::Unauthorized, ())), None => return Failure((Status::Unauthorized, ())),
Some((user_id, device_id)) => (Some(user_id), Some(device_id.into())), Some((user_id, device_id)) => (Some(user_id), Some(device_id.into())),
} }
} else { } else {
(None, None) (None, None)
}; };
let mut http_request = http::Request::builder() let mut http_request = http::Request::builder()
.uri(request.uri().to_string()) .uri(request.uri().to_string())

View File

@ -17,11 +17,11 @@ use ruma::{
OutgoingRequest, OutgoingRequest,
}, },
directory::{IncomingFilter, IncomingRoomNetwork}, directory::{IncomingFilter, IncomingRoomNetwork},
EventId, ServerName, EventId, RoomVersionId, ServerName,
}; };
use std::{ use std::{
collections::BTreeMap, collections::BTreeMap,
convert::TryFrom, convert::{TryFrom, TryInto},
fmt::Debug, fmt::Debug,
time::{Duration, SystemTime}, time::{Duration, SystemTime},
}; };
@ -95,7 +95,7 @@ where
let mut http_request = request let mut http_request = request
.try_into_http_request(&actual_destination, Some("")) .try_into_http_request(&actual_destination, Some(""))
.map_err(|e| { .map_err(|e| {
warn!("{}: {}", actual_destination, e); warn!("failed to find destination {}: {}", actual_destination, e);
Error::BadServerResponse("Invalid destination") Error::BadServerResponse("Invalid destination")
})?; })?;
@ -122,7 +122,9 @@ where
request_map.insert("origin".to_owned(), globals.server_name().as_str().into()); request_map.insert("origin".to_owned(), globals.server_name().as_str().into());
request_map.insert("destination".to_owned(), destination.as_str().into()); request_map.insert("destination".to_owned(), destination.as_str().into());
let mut request_json = request_map.into(); let mut request_json =
serde_json::from_value(request_map.into()).expect("valid JSON is valid BTreeMap");
ruma::signatures::sign_json( ruma::signatures::sign_json(
globals.server_name().as_str(), globals.server_name().as_str(),
globals.keypair(), globals.keypair(),
@ -130,6 +132,9 @@ where
) )
.expect("our request json is what ruma expects"); .expect("our request json is what ruma expects");
let request_json: serde_json::Map<String, serde_json::Value> =
serde_json::from_slice(&serde_json::to_vec(&request_json).unwrap()).unwrap();
let signatures = request_json["signatures"] let signatures = request_json["signatures"]
.as_object() .as_object()
.unwrap() .unwrap()
@ -234,7 +239,9 @@ pub fn get_server_keys(db: State<'_, Database>) -> Json<String> {
let mut verify_keys = BTreeMap::new(); let mut verify_keys = BTreeMap::new();
verify_keys.insert( verify_keys.insert(
format!("ed25519:{}", db.globals.keypair().version()), format!("ed25519:{}", db.globals.keypair().version())
.try_into()
.expect("DB stores valid ServerKeyId's"),
VerifyKey { VerifyKey {
key: base64::encode_config(db.globals.keypair().public_key(), base64::STANDARD_NO_PAD), key: base64::encode_config(db.globals.keypair().public_key(), base64::STANDARD_NO_PAD),
}, },
@ -259,7 +266,7 @@ pub fn get_server_keys(db: State<'_, Database>) -> Json<String> {
&mut response, &mut response,
) )
.unwrap(); .unwrap();
Json(response.to_string()) Json(ruma::serde::to_canonical_json_string(&response).expect("JSON is canonical"))
} }
#[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server/<_>"))] #[cfg_attr(feature = "conduit_bin", get("/_matrix/key/v2/server/<_>"))]
@ -365,7 +372,7 @@ pub async fn get_public_rooms_route(
feature = "conduit_bin", feature = "conduit_bin",
put("/_matrix/federation/v1/send/<_>", data = "<body>") put("/_matrix/federation/v1/send/<_>", data = "<body>")
)] )]
pub fn send_transaction_message_route<'a>( pub async fn send_transaction_message_route<'a>(
db: State<'a, Database>, db: State<'a, Database>,
body: Ruma<send_transaction_message::v1::Request<'_>>, body: Ruma<send_transaction_message::v1::Request<'_>>,
) -> ConduitResult<send_transaction_message::v1::Response> { ) -> ConduitResult<send_transaction_message::v1::Response> {
@ -451,7 +458,7 @@ pub fn get_missing_events_route<'a>(
) )
.map_err(|_| Error::bad_database("Invalid prev_events content in pdu in db."))?, .map_err(|_| Error::bad_database("Invalid prev_events content in pdu in db."))?,
); );
events.push(PduEvent::convert_to_outgoing_federation_event(pdu)); events.push(serde_json::from_value(pdu).expect("Raw<..> is always valid"));
} }
i += 1; i += 1;
} }