commit d17c3a202afa5021ec554917a102261b12a0f6c1 Author: Patrick Michl Date: Sun Apr 24 22:04:15 2022 +0200 initial commit diff --git a/.env b/.env new file mode 100644 index 0000000..d06daa9 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +DATABASE_URL=sqlite://db.sqlite3 \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..738db7b --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +/db.sqlite* \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..beb981d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1572 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc" + +[[package]] +name = "async-trait" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed6aa3524a2dfcf9fe180c51eae2b58738348d819517ceadf95789c51fff7600" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atoi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616896e05fc0e2649463a93a15183c6a16bf03413a7af88ef1285ddedfa9cda5" +dependencies = [ + "num-traits", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "axum" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f523b4e98ba6897ae90994bc18423d9877c54f9047b06a00ddc8122a957b1c70" +dependencies = [ + "async-trait", + "axum-core", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-http", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3ddbd16eabff8b45f21b98671fddcc93daaa7ac4c84f8473693437226040de5" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", +] + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "block-buffer" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf7fe51849ea569fd452f37822f606a5cabb684dc918707a0193fd4664ff324" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + +[[package]] +name = "cc" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cpufeatures" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59a6001667ab124aebae2a495118e11d30984c3a653e99d86d58971708cf5e4b" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49fc9a695bca7f35f5f4c15cddc84415f66a74ea78eef08e90c5024f2b540e23" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccaeedb56da03b09f598226e25e80088cb4cd25f316e6e4df7d695f0feeb1403" + +[[package]] +name = "crossbeam-queue" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf124c720b7686e3c2663cf54062ab0f68a88af2fb6a030e87e30bf721fcb38" +dependencies = [ + "cfg-if", + "lazy_static", +] + +[[package]] +name = "crypto-common" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "digest" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2fb860ca6fafa5552fb6d0e816a69c8e49f0908bf524e30a90d97c85892d506" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dotenv" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77c90badedccf4105eca100756a0b1289e191f6fcbdadd3cee1d2f614f97da8f" + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "event-listener" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" + +[[package]] +name = "flume" +version = "0.10.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843c03199d0c0ca54bc1ea90ac0d507274c28abcc4f691ae8b4eaa375087c76a" +dependencies = [ + "futures-core", + "futures-sink", + "pin-project", + "spin 0.9.3", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3083ce4b914124575708913bca19bfe887522d6e2e6d0952943f5eac4a74010" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c09fd04b7e4073ac7156a9539b57a484a8ea920f79c7c675d05d289ab6110d3" + +[[package]] +name = "futures-executor" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9420b90cfa29e327d0429f19be13e7ddb68fa1cccb09d65e5706b8c7a749b8a6" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62007592ac46aa7c2b6416f7deb9a8a8f63a01e0f1d6e1787d5630170db2b63e" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot 0.11.2", +] + +[[package]] +name = "futures-sink" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21163e139fa306126e6eedaf49ecdb4588f939600f0b1e770f4205ee4b7fa868" + +[[package]] +name = "futures-task" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c66a976bf5909d801bbef33416c41372779507e7a6b3a5e25e4749c58f776a" + +[[package]] +name = "futures-util" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b7abd5d659d9b90c8cba917f6ec750a74e2dc23902ef9cd4cc8c8b22e6036a" +dependencies = [ + "futures-core", + "futures-sink", + "futures-task", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9be70c98951c83b8d2f8f60d7065fa6d5146873094452a1008da8c2f1e4205ad" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", +] + +[[package]] +name = "hashbrown" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashlink" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7249a3129cbc1ffccd74857f81464a323a152173cdb134e0fd81bc803b29facf" +dependencies = [ + "hashbrown", +] + +[[package]] +name = "heck" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "http" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31f4c6746584866f0feabcc69893c5b51beef3831656a968ed7ae254cdc4fd03" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfe8eed0a9285ef776bb792479ea3834e8b94e13d615c2f66d03dd50a435a29" + +[[package]] +name = "httparse" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6330e8a36bd8c859f3fa6d9382911fbb7147ec39807f63b923933a247240b9ba" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b26ae0a80afebe130861d90abf98e3814a4f28a4c6ffeb5ab8ebb2be311e0ef2" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "indexmap" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f647032dfaa1f8b6dc29bd3edb7bbef4861b8b8007ebb118d6db284fd59f6ee" +dependencies = [ + "autocfg", + "hashbrown", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + +[[package]] +name = "js-sys" +version = "0.3.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "671a26f820db17c2a2750743f1dd03bafd15b98c9f30c7c2628c024c05d73397" +dependencies = [ + "wasm-bindgen", +] + +[[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.124" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21a41fed9d98f27ab1c6d161da622a4fa35e8a54a8adc24bbf3ddd0ef70b0e50" + +[[package]] +name = "libsqlite3-sys" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "898745e570c7d0453cc1fbc4a701eb6c662ed54e8fec8b7d14be137ebeeb9d14" +dependencies = [ + "cc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "lock_api" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327fa5b6a6940e4699ec49a9beae1ea4845c6bab9314e4f84ac68742139d8c53" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6389c490849ff5bc16be905ae24bc913a9c8892e19b2341dbc175e14c341c2b8" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "matchit" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73cbba799671b762df5a175adf59ce145165747bb891505c43d09aefbbf38beb" + +[[package]] +name = "matrix" +version = "0.1.0" +dependencies = [ + "anyhow", + "axum", + "serde", + "sqlx", + "thiserror", + "tokio", + "tower-http", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "mio" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52da4364ffb0e4fe33a9841a98a3f3014fb964045ce4f7a45a398243c8d6b0c9" +dependencies = [ + "libc", + "log", + "miow", + "ntapi", + "wasi 0.11.0+wasi-snapshot-preview1", + "winapi", +] + +[[package]] +name = "miow" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +dependencies = [ + "winapi", +] + +[[package]] +name = "nom" +version = "7.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8903e5a29a317527874d0402f867152a3d21c908bb0b933e416c65e301d4c36" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "ntapi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28774a7fd2fbb4f0babd8237ce554b73af68021b5f695a3cebd6c59bac0980f" +dependencies = [ + "winapi", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "once_cell" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core 0.8.5", +] + +[[package]] +name = "parking_lot" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87f5ec2493a61ac0506c0f4199f99070cbe83857b0337006a30f3e6719b8ef58" +dependencies = [ + "lock_api", + "parking_lot_core 0.9.2", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "995f667a6c822200b0433ac218e05582f0e2efa1b922a3fd2fbaadc5f87bab37" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-sys", +] + +[[package]] +name = "paste" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c520e05135d6e763148b6426a837e239041653ba7becd2e538c076c738025fc" + +[[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 = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744b6f092ba29c3650faf274db506afd39944f48420f6c86b17cfe0ee1cb36bb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e280fbe77cc62c91527259e9442153f4688736748d24660126286329742b4c6c" + +[[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.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" + +[[package]] +name = "proc-macro2" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec757218438d5fda206afc041538b2f6d889286160d649a86a24d37e1235afd1" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1feb54ed693b93a84e14094943b84b7c4eae204c512b7ccb95ab0c66d278ad1" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "redox_syscall" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin 0.5.2", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustls" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +dependencies = [ + "base64", + "log", + "ring", + "sct", + "webpki", +] + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" + +[[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.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "serde" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.136" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55deaec60f81eefe3cce0dc50bda92d6d8e88f2a27df7c5033b42afeb1ed2676" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "signal-hook-registry" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +dependencies = [ + "libc", +] + +[[package]] +name = "slab" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" + +[[package]] +name = "smallvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" + +[[package]] +name = "socket2" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "spin" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c530c2b0d0bf8b69304b39fe2001993e267461948b890cd037d8ad4293fa1a0d" +dependencies = [ + "lock_api", +] + +[[package]] +name = "sqlformat" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4b7922be017ee70900be125523f38bdd644f4f06a1b16e8fa5a8ee8c34bffd4" +dependencies = [ + "itertools", + "nom", + "unicode_categories", +] + +[[package]] +name = "sqlx" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "551873805652ba0d912fec5bbb0f8b4cdd96baf8e2ebf5970e5671092966019b" +dependencies = [ + "sqlx-core", + "sqlx-macros", +] + +[[package]] +name = "sqlx-core" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48c61941ccf5ddcada342cd59e3e5173b007c509e1e8e990dafc830294d9dc5" +dependencies = [ + "ahash", + "atoi", + "bitflags", + "byteorder", + "bytes", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "flume", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "hashlink", + "hex", + "indexmap", + "itoa", + "libc", + "libsqlite3-sys", + "log", + "memchr", + "once_cell", + "paste", + "percent-encoding", + "rustls", + "sha2", + "smallvec", + "sqlformat", + "sqlx-rt", + "stringprep", + "thiserror", + "tokio-stream", + "url", + "webpki", + "webpki-roots", +] + +[[package]] +name = "sqlx-macros" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc0fba2b0cae21fc00fe6046f8baa4c7fcb49e379f0f592b04696607f69ed2e1" +dependencies = [ + "dotenv", + "either", + "heck", + "once_cell", + "proc-macro2", + "quote", + "sha2", + "sqlx-core", + "sqlx-rt", + "syn", + "url", +] + +[[package]] +name = "sqlx-rt" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db708cd3e459078f85f39f96a00960bd841f66ee2a669e90bf36907f5a79aae" +dependencies = [ + "once_cell", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "stringprep" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ee348cb74b87454fff4b551cbf727025810a004f88aeacae7f85b87f4e9a1c1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "syn" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b683b2b825c8eef438b77c36a06dc262294da3d5a5813fac20da149241dcd44d" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20518fe4a4c9acf048008599e464deb21beeae3d3578418951a189c235a7a9a8" + +[[package]] +name = "thiserror" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tinyvec" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af73ac49756f3f7c01172e34a23e5d0216f6c32333757c2c61feb2bbff5a5ee" +dependencies = [ + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "parking_lot 0.12.0", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "winapi", +] + +[[package]] +name = "tokio-macros" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-rustls" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +dependencies = [ + "rustls", + "tokio", + "webpki", +] + +[[package]] +name = "tokio-stream" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50145484efff8818b5ccd256697f36863f587da82cf8b409c53adf1e840798e3" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0edfdeb067411dba2044da6d1cb2df793dd35add7888d73c16e3381ded401764" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tower" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a89fd63ad6adf737582df5db40d286574513c69a11dac5214dc3b5603d6713e" +dependencies = [ + "futures-core", + "futures-util", + "pin-project", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aba3f3efabf7fb41fae8534fc20a817013dd1c12cb45441efb6c82e6556b4cd8" +dependencies = [ + "bitflags", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-range-header", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" + +[[package]] +name = "tower-service" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6" + +[[package]] +name = "tracing" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0ecdcb44a79f0fe9844f0c4f33a342cbcbb5117de8001e6ba0dc2351327d09" +dependencies = [ + "cfg-if", + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e65ce065b4b5c53e73bb28912318cb8c9e9ad3921f1d669eb0e68b4c8143a2b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f54c8ca710e81886d498c2fd3331b56c93aa248d49de2222ad2742247c60072f" +dependencies = [ + "lazy_static", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bc28f93baff38037f64e6f43d34cfa1605f27a49c34e8a04c5e78b0babf2596" +dependencies = [ + "ansi_term", + "lazy_static", + "matchers", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "unicode-bidi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "unicode_categories" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[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.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27370197c907c55e3f1a9fbe26f44e937fe6451368324e009cba39e139dc08ad" +dependencies = [ + "cfg-if", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53e04185bfa3a779273da532f5025e33398409573f348985af9a1cbf3774d3f4" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cae7ff784d7e83a2fe7611cfe766ecf034111b49deb850a3dc7699c08251f5" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99ec0dc7a4756fffc231aab1b9f2f578d23cd391390ab27f952ae0c9b3ece20b" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.80" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d554b7f530dee5964d9a9468d95c1f8b8acae4f282807e7d27d4b03099a46744" + +[[package]] +name = "web-sys" +version = "0.3.57" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b17e741662c70c8bd24ac5c5b18de314a2c26c32bf8346ee1e6f53de919c283" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki" +version = "0.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] + +[[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-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 = "windows-sys" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5acdd78cb4ba54c0045ac14f62d8f94a03d10047904ae2a40afa1e99d8f70825" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17cffbe740121affb56fad0fc0e421804adf0ae00891205213b5cecd30db881d" + +[[package]] +name = "windows_i686_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2564fde759adb79129d9b4f54be42b32c89970c18ebf93124ca8870a498688ed" + +[[package]] +name = "windows_i686_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cd9d32ba70453522332c14d38814bceeb747d80b3958676007acadd7e166956" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfce6deae227ee8d356d19effc141a509cc503dfd1f850622ec4b0f84428e1f4" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d19538ccc21819d01deaf88d6a17eae6596a12e9aafdbb97916fb49896d89de9" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..a57a17b --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "matrix" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +tokio = { version = "1.17.0", features = ["full"] } +axum = "0.5.3" +tracing = "0.1.34" +tracing-subscriber = { version = "0.3.11", features = ["env-filter"] } +serde = {version = "1.0.136", features = ["derive"] } +tower-http = { version = "0.2.5", features = ["cors", "trace"]} +sqlx = { version = "0.5.13", features = ["sqlite", "macros", "runtime-tokio-rustls"] } +anyhow = "1.0" +thiserror = "1.0" \ No newline at end of file diff --git a/migrations/20220423204756_add_user.sql b/migrations/20220423204756_add_user.sql new file mode 100644 index 0000000..25a5aba --- /dev/null +++ b/migrations/20220423204756_add_user.sql @@ -0,0 +1,9 @@ +-- Add migration script here +CREATE TABLE users( + id INTEGER PRIMARY KEY NOT NULL, + user_id CHAR(255) NOT NULL, + display_name TEXT NOT NULL, + password TEXT NOT NULL +); + +CREATE INDEX user_id_index ON users (user_id); \ No newline at end of file diff --git a/migrations/20220424172900_add_devices.sql b/migrations/20220424172900_add_devices.sql new file mode 100644 index 0000000..99a6cf8 --- /dev/null +++ b/migrations/20220424172900_add_devices.sql @@ -0,0 +1,11 @@ +-- Add migration script here + +CREATE TABLE devices( + id INTEGER PRIMARY KEY NOT NULL, + user_id INT NOT NULL, + device_id TEXT NOT NULL, + display_name TEXT NOT NULL, + FOREIGN KEY(user_id) REFERENCES users(id) +); + +CREATE INDEX device_id_index ON devices (device_id); \ No newline at end of file diff --git a/migrations/20220424175554_add_sessions.sql b/migrations/20220424175554_add_sessions.sql new file mode 100644 index 0000000..d51295a --- /dev/null +++ b/migrations/20220424175554_add_sessions.sql @@ -0,0 +1,10 @@ +-- Add migration script here + +CREATE TABLE sessions( + id INTEGER PRIMARY KEY NOT NULL, + device_id INT NOT NULL, + value TEXT NOT NULL, + FOREIGN KEY(device_id) REFERENCES devices(id) +); + +CREATE INDEX value_index ON sessions (value); \ No newline at end of file diff --git a/src/api/client_server/auth.rs b/src/api/client_server/auth.rs new file mode 100644 index 0000000..35bcc59 --- /dev/null +++ b/src/api/client_server/auth.rs @@ -0,0 +1,110 @@ +use std::{collections::HashMap, sync::Arc}; + +use axum::{ + extract::Query, + http::StatusCode, + routing::{get, post}, + Extension, Json, +}; +use sqlx::SqlitePool; + +use crate::responses::registration::RegistrationResponse; +use crate::{ + models::devices::Device, + responses::{flow::Flows, registration::RegistrationSuccess}, +}; +use crate::{ + models::users::User, + requests::registration::RegistrationRequest, + responses::username_available::UsernameAvailable, + types::{ + authentication_data::AuthenticationData, identifier::Identifier, matrix_user_id::UserId, + }, + Config, +}; + +pub fn routes() -> axum::Router { + axum::Router::new() + .route("/r0/login", get(get_login).post(post_login)) + .route("/r0/register", post(post_register)) + .route("/r0/register/available", get(get_username_available)) +} + +#[tracing::instrument] +async fn get_login() -> Json { + Json(Flows::new()) +} + +#[tracing::instrument(skip_all)] +async fn post_login(body: String) -> StatusCode { + dbg!(body); + StatusCode::INTERNAL_SERVER_ERROR +} + +#[tracing::instrument(skip_all)] +async fn get_username_available( + Extension(config): Extension>, + Extension(db): Extension, + Query(params): Query>, +) -> Json { + let username = params.get("username").unwrap(); + let user_id = UserId::new(&username, &config.homeserver_name).unwrap(); + let exists = User::exists(&db, &user_id).await.unwrap(); + Json(UsernameAvailable::new(!exists)) +} + +#[tracing::instrument(skip_all)] +async fn post_register( + Extension(config): Extension>, + Extension(db): Extension, + Json(body): Json, + Query(params): Query>, +) -> (StatusCode, Json) { + // Client tries to get available flows + if *&body.auth().is_none() { + return ( + StatusCode::UNAUTHORIZED, + Json(RegistrationResponse::user_interactive_authorization_info()), + ); + } + + let (user, device) = match &body.auth().unwrap() { + AuthenticationData::Password(auth_data) => { + // let username = match auth_data.identifier() { + // Identifier::User(user_identifier) => user_identifier.user().unwrap(), + // }; + let username = body.username().unwrap(); + let user_id = UserId::new(&username, &config.homeserver_name).unwrap(); + if User::exists(&db, &user_id).await.unwrap() { + todo!("Error out") + } + let password = auth_data.password(); + let display_name = match *&body.initial_device_display_name() { + Some(display_name) => display_name.as_ref(), + None => "Random displayname", + }; + + let user = User::create(&db, &user_id, &user_id.to_string(), &password) + .await + .unwrap(); + let device = Device::create(&db, &user, "test", display_name) + .await + .unwrap(); + + (user, device) + } + }; + + // dont log in the user after registration + if *&body.inhibit_login().is_some() && *&body.inhibit_login().unwrap() { + let resp = RegistrationSuccess::new(None, device.device_id(), user.user_id()); + + (StatusCode::OK, Json(RegistrationResponse::Success(resp))) + } else { + let session = device.create_session(&db).await.unwrap(); + let resp = + RegistrationSuccess::new(Some(session.value()), device.device_id(), user.user_id()); + + (StatusCode::OK, Json(RegistrationResponse::Success(resp))) + } +} diff --git a/src/api/client_server/mod.rs b/src/api/client_server/mod.rs new file mode 100644 index 0000000..dfe7033 --- /dev/null +++ b/src/api/client_server/mod.rs @@ -0,0 +1,2 @@ +pub mod auth; +pub mod versions; \ No newline at end of file diff --git a/src/api/client_server/versions.rs b/src/api/client_server/versions.rs new file mode 100644 index 0000000..07c90fe --- /dev/null +++ b/src/api/client_server/versions.rs @@ -0,0 +1,12 @@ +use axum::{routing::get, Json}; + +use crate::responses::versions::Versions; + +pub fn routes() -> axum::Router { + axum::Router::new().route("/versions", get(get_client_versions)) +} + +#[tracing::instrument] +async fn get_client_versions() -> Json { + Json(Versions::default()) +} diff --git a/src/api/mod.rs b/src/api/mod.rs new file mode 100644 index 0000000..3abd782 --- /dev/null +++ b/src/api/mod.rs @@ -0,0 +1 @@ +pub mod client_server; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..8c82746 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,73 @@ +#![allow(unused)] + +use std::sync::Arc; + +use axum::{ + body::Body, + handler::Handler, + http::{Request, StatusCode}, + Router, Extension, +}; +use tower_http::{ + cors::CorsLayer, + trace::{DefaultOnRequest, TraceLayer, DefaultOnResponse}, +}; +use tracing::Level; + +mod api; +mod responses; +mod requests; +mod types; +mod models; + +struct Config { + db_path: String, + homeserver_name: String, +} + +impl Default for Config { + fn default() -> Self { + Self { db_path: "sqlite://db.sqlite3".into(), homeserver_name: "fuckwit.dev".into() } + } +} + +#[tokio::main] +async fn main() { + if std::env::var("RUST_LOG").is_err() { + std::env::set_var("RUST_LOG", "debug"); + } + tracing_subscriber::fmt::init(); + + // init config + let config = Arc::new(Config::default()); + + let pool = sqlx::SqlitePool::connect("sqlite://db.sqlite3").await.unwrap(); + + let cors = CorsLayer::new() + .allow_origin(tower_http::cors::Any) + .allow_methods(tower_http::cors::Any) + .allow_headers(tower_http::cors::Any); + + let tracing_layer = TraceLayer::new_for_http(); + + let client_server = Router::new() + .merge(api::client_server::versions::routes()) + .merge(api::client_server::auth::routes()); + + let router = Router::new() + .nest("/_matrix/client", client_server) + .layer(cors) + .layer(tracing_layer) + .layer(Extension(pool)) + .layer(Extension(config)) + .fallback(fallback.into_service()); + + let _ = axum::Server::bind(&"127.0.0.1:3000".parse().unwrap()) + .serve(router.into_make_service()) + .await; +} + +async fn fallback(request: Request) -> StatusCode { + dbg!(request); + StatusCode::INTERNAL_SERVER_ERROR +} diff --git a/src/models/devices.rs b/src/models/devices.rs new file mode 100644 index 0000000..ff12d2e --- /dev/null +++ b/src/models/devices.rs @@ -0,0 +1,50 @@ +use sqlx::SqlitePool; + +use super::{users::User, sessions::Session}; + +pub struct Device { + id: i64, + user_id: i64, + device_id: String, + display_name: String +} + +impl Device { + pub async fn create(conn: &SqlitePool, user: &User, device_id: &str, display_name: &str) -> anyhow::Result { + let user_id = user.id(); + Ok(sqlx::query_as!(Self, "insert into devices(user_id, device_id, display_name) values(?, ?, ?) returning id, user_id, device_id, display_name", user_id, device_id, display_name).fetch_one(conn).await?) + } + + pub async fn by_user(conn: &SqlitePool, user: &User) -> anyhow::Result { + let user_id = user.id(); + Ok(sqlx::query_as!(Self, "select id, user_id, device_id, display_name from devices where user_id = ?", user_id).fetch_one(conn).await?) + } + + pub async fn create_session(&self, conn: &SqlitePool) -> anyhow::Result { + Ok(Session::create(conn, self, "random_session_id").await?) + } + + /// Get the device's id. + #[must_use] + pub fn id(&self) -> i64 { + self.id + } + + /// Get the device's user id. + #[must_use] + pub fn user_id(&self) -> i64 { + self.user_id + } + + /// Get a reference to the device's device id. + #[must_use] + pub fn device_id(&self) -> &str { + self.device_id.as_ref() + } + + /// Get a reference to the device's display name. + #[must_use] + pub fn display_name(&self) -> &str { + self.display_name.as_ref() + } +} diff --git a/src/models/mod.rs b/src/models/mod.rs new file mode 100644 index 0000000..a28301e --- /dev/null +++ b/src/models/mod.rs @@ -0,0 +1,3 @@ +pub mod users; +pub mod devices; +pub mod sessions; diff --git a/src/models/sessions.rs b/src/models/sessions.rs new file mode 100644 index 0000000..cfed214 --- /dev/null +++ b/src/models/sessions.rs @@ -0,0 +1,34 @@ +use sqlx::SqlitePool; + +use super::devices::Device; + +pub struct Session { + id: i64, + device_id: i64, + value: String, +} + +impl Session { + pub async fn create(conn: &SqlitePool, device: &Device, value: &str) -> anyhow::Result { + let device_id = device.id(); + Ok(sqlx::query_as!(Self, "insert into sessions(device_id, value) values(?, ?) returning id, device_id, value", device_id, value).fetch_one(conn).await?) + } + + /// Get the session's id. + #[must_use] + pub fn id(&self) -> i64 { + self.id + } + + /// Get the session's device id. + #[must_use] + pub fn device_id(&self) -> i64 { + self.device_id + } + + /// Get a reference to the session's value. + #[must_use] + pub fn value(&self) -> &str { + self.value.as_ref() + } +} diff --git a/src/models/users.rs b/src/models/users.rs new file mode 100644 index 0000000..851d486 --- /dev/null +++ b/src/models/users.rs @@ -0,0 +1,42 @@ +use sqlx::SqlitePool; + +use crate::types::matrix_user_id::UserId; + +pub struct User { + id: i64, + user_id: String, + display_name: String, + password: String, +} + +impl User { + pub async fn exists(conn: &SqlitePool, user_id: &UserId) -> anyhow::Result { + Ok(sqlx::query!("select user_id from users where user_id = ?", user_id).fetch_optional(conn).await?.is_some()) + } + + pub async fn create(conn: &SqlitePool, user_id: &UserId, display_name: &str, password: &str) -> anyhow::Result { + Ok(sqlx::query_as!(Self, "insert into users(user_id, display_name, password) values (?, ?, ?) returning id, user_id, display_name, password", user_id, display_name, password).fetch_one(conn).await?) + } + + pub async fn by_user_id(conn: &SqlitePool, user_id: &UserId) -> anyhow::Result { + Ok(sqlx::query_as!(Self, "select id, user_id, display_name, password from users where user_id = ?", user_id).fetch_one(conn).await?) + } + + /// Get the user's id. + #[must_use] + pub fn id(&self) -> i64 { + self.id + } + + /// Get a reference to the user's user id. + #[must_use] + pub fn user_id(&self) -> &str { + self.user_id.as_ref() + } + + /// Get a reference to the user's password. + #[must_use] + pub fn password(&self) -> &str { + self.password.as_ref() + } +} diff --git a/src/requests/mod.rs b/src/requests/mod.rs new file mode 100644 index 0000000..9b90583 --- /dev/null +++ b/src/requests/mod.rs @@ -0,0 +1 @@ +pub mod registration; \ No newline at end of file diff --git a/src/requests/registration.rs b/src/requests/registration.rs new file mode 100644 index 0000000..1d7532e --- /dev/null +++ b/src/requests/registration.rs @@ -0,0 +1,59 @@ +use crate::types::{flow::Flow, identifier::Identifier, authentication_data::AuthenticationData}; + +#[derive(Debug, serde::Deserialize)] +pub struct RegistrationRequest { + #[serde(skip_serializing_if = "Option::is_none")] + auth: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + device_id: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + inhibit_login: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + initial_device_display_name: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + password: Option, + + #[serde(skip_serializing_if = "Option::is_none")] + username: Option, +} + +impl RegistrationRequest { + #[must_use] + pub fn auth(&self) -> Option<&AuthenticationData> { + self.auth.as_ref() + } + + /// Get a reference to the registration request's device id. + #[must_use] + pub fn device_id(&self) -> Option<&String> { + self.device_id.as_ref() + } + + /// Get the registration request's inhibit login. + #[must_use] + pub fn inhibit_login(&self) -> Option { + self.inhibit_login + } + + /// Get a reference to the registration request's initial device display name. + #[must_use] + pub fn initial_device_display_name(&self) -> Option<&String> { + self.initial_device_display_name.as_ref() + } + + /// Get a reference to the registration request's password. + #[must_use] + pub fn password(&self) -> Option<&String> { + self.password.as_ref() + } + + /// Get a reference to the registration request's username. + #[must_use] + pub fn username(&self) -> Option<&String> { + self.username.as_ref() + } +} diff --git a/src/responses/flow.rs b/src/responses/flow.rs new file mode 100644 index 0000000..f15957d --- /dev/null +++ b/src/responses/flow.rs @@ -0,0 +1,20 @@ +use crate::types::flow::Flow; + +#[derive(Debug, Clone, serde::Serialize)] +struct FlowWrapper { + #[serde(rename = "type")] + _type: Flow +} + +#[derive(Debug, Clone, serde::Serialize)] +pub struct Flows { + flows: Vec, +} + +impl Flows { + pub fn new() -> Self { + Self { + flows: vec![FlowWrapper{ _type: Flow::Password }], + } + } +} diff --git a/src/responses/mod.rs b/src/responses/mod.rs new file mode 100644 index 0000000..2bfa6bf --- /dev/null +++ b/src/responses/mod.rs @@ -0,0 +1,4 @@ +pub mod flow; +pub mod registration; +pub mod username_available; +pub mod versions; diff --git a/src/responses/registration.rs b/src/responses/registration.rs new file mode 100644 index 0000000..399723c --- /dev/null +++ b/src/responses/registration.rs @@ -0,0 +1,34 @@ +use crate::types::user_interactive_authorization::UserInteractiveAuthorizationInfo; + +#[derive(Debug, serde::Serialize)] +#[serde(untagged)] +pub enum RegistrationResponse { + Success(RegistrationSuccess), + UserInteractiveAuthorizationInfo(UserInteractiveAuthorizationInfo), +} + +impl RegistrationResponse { + pub fn user_interactive_authorization_info() -> Self { + RegistrationResponse::UserInteractiveAuthorizationInfo( + UserInteractiveAuthorizationInfo::new(), + ) + } +} + +#[derive(Debug, serde::Serialize)] +pub struct RegistrationSuccess { + #[serde(skip_serializing_if = "Option::is_none")] + access_token: Option, + device_id: String, + user_id: String, +} + +impl RegistrationSuccess { + pub fn new(access_token: Option<&str>, device_id: &str, user_id: &str) -> Self { + Self { + access_token: access_token.and_then(|v| Some(v.to_owned())), + device_id: device_id.to_owned(), + user_id: user_id.to_owned(), + } + } +} diff --git a/src/responses/username_available.rs b/src/responses/username_available.rs new file mode 100644 index 0000000..b5b9875 --- /dev/null +++ b/src/responses/username_available.rs @@ -0,0 +1,10 @@ +#[derive(Debug, serde::Serialize)] +pub struct UsernameAvailable { + available: bool, +} + +impl UsernameAvailable { + pub fn new(available: bool) -> Self { + Self { available } + } +} \ No newline at end of file diff --git a/src/responses/versions.rs b/src/responses/versions.rs new file mode 100644 index 0000000..07be3cd --- /dev/null +++ b/src/responses/versions.rs @@ -0,0 +1,17 @@ +use std::collections::HashMap; + +#[derive(Debug, serde::Serialize, serde::Deserialize)] +pub struct Versions { + #[serde(skip_serializing_if = "Option::is_none")] + unstable_features: Option>, + versions: Vec, +} + +impl Default for Versions { + fn default() -> Self { + Self { + unstable_features: None, + versions: vec!["v1.2".into()], + } + } +} diff --git a/src/types/authentication_data.rs b/src/types/authentication_data.rs new file mode 100644 index 0000000..a140ab7 --- /dev/null +++ b/src/types/authentication_data.rs @@ -0,0 +1,36 @@ +use super::{flow::Flow, identifier::Identifier}; + +#[derive(Debug, Clone, serde::Deserialize)] +#[serde(untagged)] +pub enum AuthenticationData { + Password(AuthenticationPassword) +} + +#[derive(Debug, Clone, serde::Deserialize)] +pub struct AuthenticationPassword { + #[serde(rename = "type")] + _type: Flow, + identifier: Identifier, + password: String, + user: Option +} + +impl AuthenticationPassword { + /// Get a reference to the authentication password's identifier. + #[must_use] + pub fn identifier(&self) -> &Identifier { + &self.identifier + } + + /// Get a reference to the authentication password's password. + #[must_use] + pub fn password(&self) -> &str { + self.password.as_ref() + } + + /// Get a reference to the authentication password's user. + #[must_use] + pub fn user(&self) -> Option<&String> { + self.user.as_ref() + } +} \ No newline at end of file diff --git a/src/types/flow.rs b/src/types/flow.rs new file mode 100644 index 0000000..1098d6a --- /dev/null +++ b/src/types/flow.rs @@ -0,0 +1,44 @@ +#[derive(Debug, Clone)] +pub enum Flow { + Password, +} + +impl serde::Serialize for Flow { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(match self { + Flow::Password => "m.login.password", + }) + } +} + +impl<'de> serde::Deserialize<'de> for Flow { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + struct FlowVisitor; + + impl<'de> serde::de::Visitor<'de> for FlowVisitor { + type Value = Flow; + + fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + formatter.write_str("Flow") + } + + fn visit_borrowed_str(self, v: &'de str) -> Result + where + E: serde::de::Error, + { + match v { + "m.login.password" => Ok(Flow::Password), + _ => Err(serde::de::Error::custom("Unknown flow")), + } + } + } + + deserializer.deserialize_str(FlowVisitor {}) + } +} \ No newline at end of file diff --git a/src/types/identifier.rs b/src/types/identifier.rs new file mode 100644 index 0000000..852ce13 --- /dev/null +++ b/src/types/identifier.rs @@ -0,0 +1,22 @@ +use super::identifier_type::IdentifierType; + +#[derive(Debug, Clone, serde::Deserialize)] +#[serde(untagged)] +pub enum Identifier { + User(IdentifierUser) +} + +#[derive(Debug, Clone, serde::Deserialize)] +pub struct IdentifierUser { + #[serde(rename = "type")] + _type: IdentifierType, + user: Option +} + +impl IdentifierUser { + /// Get a reference to the identifier user's user. + #[must_use] + pub fn user(&self) -> Option<&String> { + self.user.as_ref() + } +} \ No newline at end of file diff --git a/src/types/identifier_type.rs b/src/types/identifier_type.rs new file mode 100644 index 0000000..114e6c8 --- /dev/null +++ b/src/types/identifier_type.rs @@ -0,0 +1,44 @@ +#[derive(Debug, Clone)] +pub enum IdentifierType { + User, +} + +impl serde::Serialize for IdentifierType { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + serializer.serialize_str(match self { + IdentifierType::User => "m.id.user", + }) + } +} + +impl<'de> serde::Deserialize<'de> for IdentifierType { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + struct IdentifierVisitor; + + impl<'de> serde::de::Visitor<'de> for IdentifierVisitor { + type Value = IdentifierType; + + fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { + formatter.write_str("Identifier") + } + + fn visit_borrowed_str(self, v: &'de str) -> Result + where + E: serde::de::Error, + { + match v { + "m.id.user" => Ok(IdentifierType::User), + _ => Err(serde::de::Error::custom("Unknown identifier")), + } + } + } + + deserializer.deserialize_str(IdentifierVisitor {}) + } +} \ No newline at end of file diff --git a/src/types/matrix_user_id.rs b/src/types/matrix_user_id.rs new file mode 100644 index 0000000..c225ec1 --- /dev/null +++ b/src/types/matrix_user_id.rs @@ -0,0 +1,35 @@ +use std::fmt::Display; + +#[derive(sqlx::Type)] +#[sqlx(transparent)] +pub struct UserId(String); + +impl UserId { + pub fn new(name: &str, server_name: &str) -> anyhow::Result { + let user_id = Self(format!("@{name}:{server_name}")); + + user_id.is_valid()?; + + Ok(user_id) + } + + fn is_valid(&self) -> anyhow::Result<()> { + (self.0.len() <= 255).then(|| ()).ok_or(UserIdError::TooLong(self.0.len()))?; + + Ok(()) + } +} + +impl Display for UserId { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +#[derive(Debug, thiserror::Error)] +pub enum UserIdError { + #[error("UserId too long {0} (expected < 255)")] + TooLong(usize), + #[error("Invalid UserId given")] + Invalid +} \ No newline at end of file diff --git a/src/types/mod.rs b/src/types/mod.rs new file mode 100644 index 0000000..69d3d83 --- /dev/null +++ b/src/types/mod.rs @@ -0,0 +1,6 @@ +pub mod authentication_data; +pub mod flow; +pub mod identifier; +pub mod identifier_type; +pub mod user_interactive_authorization; +pub mod matrix_user_id; \ No newline at end of file diff --git a/src/types/user_interactive_authorization.rs b/src/types/user_interactive_authorization.rs new file mode 100644 index 0000000..810c6f9 --- /dev/null +++ b/src/types/user_interactive_authorization.rs @@ -0,0 +1,25 @@ +use crate::types::flow::Flow; + +#[derive(Debug, serde::Serialize)] +pub struct UserInteractiveAuthorizationInfo { + flows: Vec, + completed: Vec, + session: Option, + auth_error: Option +} + +impl UserInteractiveAuthorizationInfo { + pub fn new() -> Self { + Self { + flows: vec![FlowStage { stages: vec![Flow::Password]}], + completed: vec![], + session: None, + auth_error: None + } + } +} + +#[derive(Debug, serde::Serialize)] +struct FlowStage { + stages: Vec, +} \ No newline at end of file