├── .env ├── .gitignore ├── .vscode └── settings.json ├── Cargo.lock ├── Cargo.toml ├── buf.gen.yaml ├── buf.work.yaml ├── diesel.toml ├── docker-compose.yml ├── gen ├── Cargo.lock ├── Cargo.toml └── src │ ├── auth.rs │ ├── auth.serde.rs │ ├── auth.tonic.rs │ ├── greeting.rs │ ├── greeting.serde.rs │ ├── greeting.tonic.rs │ └── lib.rs ├── migrations ├── .keep ├── 00000000000000_diesel_initial_setup │ ├── down.sql │ └── up.sql └── 2023-10-28-124138_create_users │ ├── down.sql │ └── up.sql ├── proto ├── auth.proto ├── buf.yaml └── greeting.proto └── src ├── auth.rs ├── greeting.rs ├── main.rs ├── models.rs └── schema.rs /.env: -------------------------------------------------------------------------------- 1 | DATABASE_URL=postgres://rustproto:rustproto@localhost/rustproto 2 | APP_KEY="9E3CnfSfsi9BGfX3Dea#tkbs#nDj&6d#6Y&jhNa!" -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "sqltools.connections": [ 3 | { 4 | "previewLimit": 50, 5 | "server": "localhost", 6 | "port": 5432, 7 | "driver": "PostgreSQL", 8 | "name": "rustproto", 9 | "database": "rustproto", 10 | "username": "rustproto" 11 | } 12 | ], 13 | "editor.formatOnSave": true 14 | } -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "anyhow" 31 | version = "1.0.75" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" 34 | 35 | [[package]] 36 | name = "async-stream" 37 | version = "0.3.5" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" 40 | dependencies = [ 41 | "async-stream-impl", 42 | "futures-core", 43 | "pin-project-lite", 44 | ] 45 | 46 | [[package]] 47 | name = "async-stream-impl" 48 | version = "0.3.5" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" 51 | dependencies = [ 52 | "proc-macro2", 53 | "quote", 54 | "syn", 55 | ] 56 | 57 | [[package]] 58 | name = "async-trait" 59 | version = "0.1.74" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" 62 | dependencies = [ 63 | "proc-macro2", 64 | "quote", 65 | "syn", 66 | ] 67 | 68 | [[package]] 69 | name = "autocfg" 70 | version = "1.1.0" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 73 | 74 | [[package]] 75 | name = "axum" 76 | version = "0.6.20" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" 79 | dependencies = [ 80 | "async-trait", 81 | "axum-core", 82 | "bitflags 1.3.2", 83 | "bytes", 84 | "futures-util", 85 | "http", 86 | "http-body", 87 | "hyper", 88 | "itoa", 89 | "matchit", 90 | "memchr", 91 | "mime", 92 | "percent-encoding", 93 | "pin-project-lite", 94 | "rustversion", 95 | "serde", 96 | "sync_wrapper", 97 | "tower", 98 | "tower-layer", 99 | "tower-service", 100 | ] 101 | 102 | [[package]] 103 | name = "axum-core" 104 | version = "0.3.4" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" 107 | dependencies = [ 108 | "async-trait", 109 | "bytes", 110 | "futures-util", 111 | "http", 112 | "http-body", 113 | "mime", 114 | "rustversion", 115 | "tower-layer", 116 | "tower-service", 117 | ] 118 | 119 | [[package]] 120 | name = "backtrace" 121 | version = "0.3.69" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" 124 | dependencies = [ 125 | "addr2line", 126 | "cc", 127 | "cfg-if", 128 | "libc", 129 | "miniz_oxide", 130 | "object", 131 | "rustc-demangle", 132 | ] 133 | 134 | [[package]] 135 | name = "base64" 136 | version = "0.13.1" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" 139 | 140 | [[package]] 141 | name = "base64" 142 | version = "0.21.5" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" 145 | 146 | [[package]] 147 | name = "bcrypt" 148 | version = "0.15.0" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "28d1c9c15093eb224f0baa400f38fcd713fc1391a6f1c389d886beef146d60a3" 151 | dependencies = [ 152 | "base64 0.21.5", 153 | "blowfish", 154 | "getrandom", 155 | "subtle", 156 | "zeroize", 157 | ] 158 | 159 | [[package]] 160 | name = "bitflags" 161 | version = "1.3.2" 162 | source = "registry+https://github.com/rust-lang/crates.io-index" 163 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 164 | 165 | [[package]] 166 | name = "bitflags" 167 | version = "2.4.1" 168 | source = "registry+https://github.com/rust-lang/crates.io-index" 169 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" 170 | 171 | [[package]] 172 | name = "block-buffer" 173 | version = "0.10.4" 174 | source = "registry+https://github.com/rust-lang/crates.io-index" 175 | checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" 176 | dependencies = [ 177 | "generic-array", 178 | ] 179 | 180 | [[package]] 181 | name = "blowfish" 182 | version = "0.9.1" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7" 185 | dependencies = [ 186 | "byteorder", 187 | "cipher", 188 | ] 189 | 190 | [[package]] 191 | name = "byteorder" 192 | version = "1.5.0" 193 | source = "registry+https://github.com/rust-lang/crates.io-index" 194 | checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" 195 | 196 | [[package]] 197 | name = "bytes" 198 | version = "1.5.0" 199 | source = "registry+https://github.com/rust-lang/crates.io-index" 200 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" 201 | 202 | [[package]] 203 | name = "cc" 204 | version = "1.0.83" 205 | source = "registry+https://github.com/rust-lang/crates.io-index" 206 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" 207 | dependencies = [ 208 | "libc", 209 | ] 210 | 211 | [[package]] 212 | name = "cfg-if" 213 | version = "1.0.0" 214 | source = "registry+https://github.com/rust-lang/crates.io-index" 215 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 216 | 217 | [[package]] 218 | name = "chrono" 219 | version = "0.4.31" 220 | source = "registry+https://github.com/rust-lang/crates.io-index" 221 | checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" 222 | dependencies = [ 223 | "num-traits", 224 | ] 225 | 226 | [[package]] 227 | name = "cipher" 228 | version = "0.4.4" 229 | source = "registry+https://github.com/rust-lang/crates.io-index" 230 | checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" 231 | dependencies = [ 232 | "crypto-common", 233 | "inout", 234 | ] 235 | 236 | [[package]] 237 | name = "cpufeatures" 238 | version = "0.2.11" 239 | source = "registry+https://github.com/rust-lang/crates.io-index" 240 | checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" 241 | dependencies = [ 242 | "libc", 243 | ] 244 | 245 | [[package]] 246 | name = "crc32fast" 247 | version = "1.3.2" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 250 | dependencies = [ 251 | "cfg-if", 252 | ] 253 | 254 | [[package]] 255 | name = "crypto-common" 256 | version = "0.1.6" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" 259 | dependencies = [ 260 | "generic-array", 261 | "typenum", 262 | ] 263 | 264 | [[package]] 265 | name = "diesel" 266 | version = "2.1.3" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | checksum = "2268a214a6f118fce1838edba3d1561cf0e78d8de785475957a580a7f8c69d33" 269 | dependencies = [ 270 | "bitflags 2.4.1", 271 | "byteorder", 272 | "diesel_derives", 273 | "itoa", 274 | "pq-sys", 275 | "r2d2", 276 | ] 277 | 278 | [[package]] 279 | name = "diesel_derives" 280 | version = "2.1.2" 281 | source = "registry+https://github.com/rust-lang/crates.io-index" 282 | checksum = "ef8337737574f55a468005a83499da720f20c65586241ffea339db9ecdfd2b44" 283 | dependencies = [ 284 | "diesel_table_macro_syntax", 285 | "proc-macro2", 286 | "quote", 287 | "syn", 288 | ] 289 | 290 | [[package]] 291 | name = "diesel_table_macro_syntax" 292 | version = "0.1.0" 293 | source = "registry+https://github.com/rust-lang/crates.io-index" 294 | checksum = "fc5557efc453706fed5e4fa85006fe9817c224c3f480a34c7e5959fd700921c5" 295 | dependencies = [ 296 | "syn", 297 | ] 298 | 299 | [[package]] 300 | name = "digest" 301 | version = "0.10.7" 302 | source = "registry+https://github.com/rust-lang/crates.io-index" 303 | checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 304 | dependencies = [ 305 | "block-buffer", 306 | "crypto-common", 307 | "subtle", 308 | ] 309 | 310 | [[package]] 311 | name = "dotenvy" 312 | version = "0.15.7" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" 315 | 316 | [[package]] 317 | name = "either" 318 | version = "1.9.0" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 321 | 322 | [[package]] 323 | name = "equivalent" 324 | version = "1.0.1" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 327 | 328 | [[package]] 329 | name = "errno" 330 | version = "0.3.5" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" 333 | dependencies = [ 334 | "libc", 335 | "windows-sys", 336 | ] 337 | 338 | [[package]] 339 | name = "fastrand" 340 | version = "2.0.1" 341 | source = "registry+https://github.com/rust-lang/crates.io-index" 342 | checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" 343 | 344 | [[package]] 345 | name = "fixedbitset" 346 | version = "0.4.2" 347 | source = "registry+https://github.com/rust-lang/crates.io-index" 348 | checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" 349 | 350 | [[package]] 351 | name = "flate2" 352 | version = "1.0.28" 353 | source = "registry+https://github.com/rust-lang/crates.io-index" 354 | checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" 355 | dependencies = [ 356 | "crc32fast", 357 | "miniz_oxide", 358 | ] 359 | 360 | [[package]] 361 | name = "fnv" 362 | version = "1.0.7" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 365 | 366 | [[package]] 367 | name = "futures-channel" 368 | version = "0.3.29" 369 | source = "registry+https://github.com/rust-lang/crates.io-index" 370 | checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" 371 | dependencies = [ 372 | "futures-core", 373 | ] 374 | 375 | [[package]] 376 | name = "futures-core" 377 | version = "0.3.29" 378 | source = "registry+https://github.com/rust-lang/crates.io-index" 379 | checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" 380 | 381 | [[package]] 382 | name = "futures-sink" 383 | version = "0.3.29" 384 | source = "registry+https://github.com/rust-lang/crates.io-index" 385 | checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" 386 | 387 | [[package]] 388 | name = "futures-task" 389 | version = "0.3.29" 390 | source = "registry+https://github.com/rust-lang/crates.io-index" 391 | checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" 392 | 393 | [[package]] 394 | name = "futures-util" 395 | version = "0.3.29" 396 | source = "registry+https://github.com/rust-lang/crates.io-index" 397 | checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" 398 | dependencies = [ 399 | "futures-core", 400 | "futures-task", 401 | "pin-project-lite", 402 | "pin-utils", 403 | ] 404 | 405 | [[package]] 406 | name = "generic-array" 407 | version = "0.14.7" 408 | source = "registry+https://github.com/rust-lang/crates.io-index" 409 | checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" 410 | dependencies = [ 411 | "typenum", 412 | "version_check", 413 | ] 414 | 415 | [[package]] 416 | name = "getrandom" 417 | version = "0.2.10" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 420 | dependencies = [ 421 | "cfg-if", 422 | "libc", 423 | "wasi", 424 | ] 425 | 426 | [[package]] 427 | name = "gimli" 428 | version = "0.28.0" 429 | source = "registry+https://github.com/rust-lang/crates.io-index" 430 | checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" 431 | 432 | [[package]] 433 | name = "h2" 434 | version = "0.3.21" 435 | source = "registry+https://github.com/rust-lang/crates.io-index" 436 | checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" 437 | dependencies = [ 438 | "bytes", 439 | "fnv", 440 | "futures-core", 441 | "futures-sink", 442 | "futures-util", 443 | "http", 444 | "indexmap 1.9.3", 445 | "slab", 446 | "tokio", 447 | "tokio-util", 448 | "tracing", 449 | ] 450 | 451 | [[package]] 452 | name = "hashbrown" 453 | version = "0.12.3" 454 | source = "registry+https://github.com/rust-lang/crates.io-index" 455 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 456 | 457 | [[package]] 458 | name = "hashbrown" 459 | version = "0.14.2" 460 | source = "registry+https://github.com/rust-lang/crates.io-index" 461 | checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" 462 | 463 | [[package]] 464 | name = "heck" 465 | version = "0.4.1" 466 | source = "registry+https://github.com/rust-lang/crates.io-index" 467 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 468 | 469 | [[package]] 470 | name = "hermit-abi" 471 | version = "0.3.3" 472 | source = "registry+https://github.com/rust-lang/crates.io-index" 473 | checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" 474 | 475 | [[package]] 476 | name = "hmac" 477 | version = "0.12.1" 478 | source = "registry+https://github.com/rust-lang/crates.io-index" 479 | checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 480 | dependencies = [ 481 | "digest", 482 | ] 483 | 484 | [[package]] 485 | name = "home" 486 | version = "0.5.5" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" 489 | dependencies = [ 490 | "windows-sys", 491 | ] 492 | 493 | [[package]] 494 | name = "http" 495 | version = "0.2.9" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 498 | dependencies = [ 499 | "bytes", 500 | "fnv", 501 | "itoa", 502 | ] 503 | 504 | [[package]] 505 | name = "http-body" 506 | version = "0.4.5" 507 | source = "registry+https://github.com/rust-lang/crates.io-index" 508 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 509 | dependencies = [ 510 | "bytes", 511 | "http", 512 | "pin-project-lite", 513 | ] 514 | 515 | [[package]] 516 | name = "httparse" 517 | version = "1.8.0" 518 | source = "registry+https://github.com/rust-lang/crates.io-index" 519 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 520 | 521 | [[package]] 522 | name = "httpdate" 523 | version = "1.0.3" 524 | source = "registry+https://github.com/rust-lang/crates.io-index" 525 | checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" 526 | 527 | [[package]] 528 | name = "hyper" 529 | version = "0.14.27" 530 | source = "registry+https://github.com/rust-lang/crates.io-index" 531 | checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" 532 | dependencies = [ 533 | "bytes", 534 | "futures-channel", 535 | "futures-core", 536 | "futures-util", 537 | "h2", 538 | "http", 539 | "http-body", 540 | "httparse", 541 | "httpdate", 542 | "itoa", 543 | "pin-project-lite", 544 | "socket2 0.4.10", 545 | "tokio", 546 | "tower-service", 547 | "tracing", 548 | "want", 549 | ] 550 | 551 | [[package]] 552 | name = "hyper-timeout" 553 | version = "0.4.1" 554 | source = "registry+https://github.com/rust-lang/crates.io-index" 555 | checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" 556 | dependencies = [ 557 | "hyper", 558 | "pin-project-lite", 559 | "tokio", 560 | "tokio-io-timeout", 561 | ] 562 | 563 | [[package]] 564 | name = "indexmap" 565 | version = "1.9.3" 566 | source = "registry+https://github.com/rust-lang/crates.io-index" 567 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 568 | dependencies = [ 569 | "autocfg", 570 | "hashbrown 0.12.3", 571 | ] 572 | 573 | [[package]] 574 | name = "indexmap" 575 | version = "2.0.2" 576 | source = "registry+https://github.com/rust-lang/crates.io-index" 577 | checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" 578 | dependencies = [ 579 | "equivalent", 580 | "hashbrown 0.14.2", 581 | ] 582 | 583 | [[package]] 584 | name = "inout" 585 | version = "0.1.3" 586 | source = "registry+https://github.com/rust-lang/crates.io-index" 587 | checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" 588 | dependencies = [ 589 | "generic-array", 590 | ] 591 | 592 | [[package]] 593 | name = "itertools" 594 | version = "0.11.0" 595 | source = "registry+https://github.com/rust-lang/crates.io-index" 596 | checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" 597 | dependencies = [ 598 | "either", 599 | ] 600 | 601 | [[package]] 602 | name = "itoa" 603 | version = "1.0.9" 604 | source = "registry+https://github.com/rust-lang/crates.io-index" 605 | checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" 606 | 607 | [[package]] 608 | name = "jwt" 609 | version = "0.16.0" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | checksum = "6204285f77fe7d9784db3fdc449ecce1a0114927a51d5a41c4c7a292011c015f" 612 | dependencies = [ 613 | "base64 0.13.1", 614 | "crypto-common", 615 | "digest", 616 | "hmac", 617 | "serde", 618 | "serde_json", 619 | "sha2", 620 | ] 621 | 622 | [[package]] 623 | name = "libc" 624 | version = "0.2.149" 625 | source = "registry+https://github.com/rust-lang/crates.io-index" 626 | checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" 627 | 628 | [[package]] 629 | name = "linux-raw-sys" 630 | version = "0.4.10" 631 | source = "registry+https://github.com/rust-lang/crates.io-index" 632 | checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" 633 | 634 | [[package]] 635 | name = "lock_api" 636 | version = "0.4.11" 637 | source = "registry+https://github.com/rust-lang/crates.io-index" 638 | checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" 639 | dependencies = [ 640 | "autocfg", 641 | "scopeguard", 642 | ] 643 | 644 | [[package]] 645 | name = "log" 646 | version = "0.4.20" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 649 | 650 | [[package]] 651 | name = "matchit" 652 | version = "0.7.3" 653 | source = "registry+https://github.com/rust-lang/crates.io-index" 654 | checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" 655 | 656 | [[package]] 657 | name = "memchr" 658 | version = "2.6.4" 659 | source = "registry+https://github.com/rust-lang/crates.io-index" 660 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 661 | 662 | [[package]] 663 | name = "mime" 664 | version = "0.3.17" 665 | source = "registry+https://github.com/rust-lang/crates.io-index" 666 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 667 | 668 | [[package]] 669 | name = "miniz_oxide" 670 | version = "0.7.1" 671 | source = "registry+https://github.com/rust-lang/crates.io-index" 672 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 673 | dependencies = [ 674 | "adler", 675 | ] 676 | 677 | [[package]] 678 | name = "mio" 679 | version = "0.8.9" 680 | source = "registry+https://github.com/rust-lang/crates.io-index" 681 | checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" 682 | dependencies = [ 683 | "libc", 684 | "wasi", 685 | "windows-sys", 686 | ] 687 | 688 | [[package]] 689 | name = "multimap" 690 | version = "0.8.3" 691 | source = "registry+https://github.com/rust-lang/crates.io-index" 692 | checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" 693 | 694 | [[package]] 695 | name = "num-traits" 696 | version = "0.2.17" 697 | source = "registry+https://github.com/rust-lang/crates.io-index" 698 | checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 699 | dependencies = [ 700 | "autocfg", 701 | ] 702 | 703 | [[package]] 704 | name = "num_cpus" 705 | version = "1.16.0" 706 | source = "registry+https://github.com/rust-lang/crates.io-index" 707 | checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 708 | dependencies = [ 709 | "hermit-abi", 710 | "libc", 711 | ] 712 | 713 | [[package]] 714 | name = "object" 715 | version = "0.32.1" 716 | source = "registry+https://github.com/rust-lang/crates.io-index" 717 | checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" 718 | dependencies = [ 719 | "memchr", 720 | ] 721 | 722 | [[package]] 723 | name = "once_cell" 724 | version = "1.18.0" 725 | source = "registry+https://github.com/rust-lang/crates.io-index" 726 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 727 | 728 | [[package]] 729 | name = "parking_lot" 730 | version = "0.12.1" 731 | source = "registry+https://github.com/rust-lang/crates.io-index" 732 | checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" 733 | dependencies = [ 734 | "lock_api", 735 | "parking_lot_core", 736 | ] 737 | 738 | [[package]] 739 | name = "parking_lot_core" 740 | version = "0.9.9" 741 | source = "registry+https://github.com/rust-lang/crates.io-index" 742 | checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" 743 | dependencies = [ 744 | "cfg-if", 745 | "libc", 746 | "redox_syscall", 747 | "smallvec", 748 | "windows-targets", 749 | ] 750 | 751 | [[package]] 752 | name = "pbjson" 753 | version = "0.6.0" 754 | source = "registry+https://github.com/rust-lang/crates.io-index" 755 | checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" 756 | dependencies = [ 757 | "base64 0.21.5", 758 | "serde", 759 | ] 760 | 761 | [[package]] 762 | name = "pbjson-build" 763 | version = "0.6.2" 764 | source = "registry+https://github.com/rust-lang/crates.io-index" 765 | checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" 766 | dependencies = [ 767 | "heck", 768 | "itertools", 769 | "prost", 770 | "prost-types", 771 | ] 772 | 773 | [[package]] 774 | name = "pbjson-types" 775 | version = "0.6.0" 776 | source = "registry+https://github.com/rust-lang/crates.io-index" 777 | checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" 778 | dependencies = [ 779 | "bytes", 780 | "chrono", 781 | "pbjson", 782 | "pbjson-build", 783 | "prost", 784 | "prost-build", 785 | "serde", 786 | ] 787 | 788 | [[package]] 789 | name = "percent-encoding" 790 | version = "2.3.0" 791 | source = "registry+https://github.com/rust-lang/crates.io-index" 792 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" 793 | 794 | [[package]] 795 | name = "petgraph" 796 | version = "0.6.4" 797 | source = "registry+https://github.com/rust-lang/crates.io-index" 798 | checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" 799 | dependencies = [ 800 | "fixedbitset", 801 | "indexmap 2.0.2", 802 | ] 803 | 804 | [[package]] 805 | name = "pin-project" 806 | version = "1.1.3" 807 | source = "registry+https://github.com/rust-lang/crates.io-index" 808 | checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" 809 | dependencies = [ 810 | "pin-project-internal", 811 | ] 812 | 813 | [[package]] 814 | name = "pin-project-internal" 815 | version = "1.1.3" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" 818 | dependencies = [ 819 | "proc-macro2", 820 | "quote", 821 | "syn", 822 | ] 823 | 824 | [[package]] 825 | name = "pin-project-lite" 826 | version = "0.2.13" 827 | source = "registry+https://github.com/rust-lang/crates.io-index" 828 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 829 | 830 | [[package]] 831 | name = "pin-utils" 832 | version = "0.1.0" 833 | source = "registry+https://github.com/rust-lang/crates.io-index" 834 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 835 | 836 | [[package]] 837 | name = "ppv-lite86" 838 | version = "0.2.17" 839 | source = "registry+https://github.com/rust-lang/crates.io-index" 840 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 841 | 842 | [[package]] 843 | name = "pq-sys" 844 | version = "0.4.8" 845 | source = "registry+https://github.com/rust-lang/crates.io-index" 846 | checksum = "31c0052426df997c0cbd30789eb44ca097e3541717a7b8fa36b1c464ee7edebd" 847 | dependencies = [ 848 | "vcpkg", 849 | ] 850 | 851 | [[package]] 852 | name = "prettyplease" 853 | version = "0.2.15" 854 | source = "registry+https://github.com/rust-lang/crates.io-index" 855 | checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" 856 | dependencies = [ 857 | "proc-macro2", 858 | "syn", 859 | ] 860 | 861 | [[package]] 862 | name = "proc-macro2" 863 | version = "1.0.69" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" 866 | dependencies = [ 867 | "unicode-ident", 868 | ] 869 | 870 | [[package]] 871 | name = "prost" 872 | version = "0.12.1" 873 | source = "registry+https://github.com/rust-lang/crates.io-index" 874 | checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" 875 | dependencies = [ 876 | "bytes", 877 | "prost-derive", 878 | ] 879 | 880 | [[package]] 881 | name = "prost-build" 882 | version = "0.12.1" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" 885 | dependencies = [ 886 | "bytes", 887 | "heck", 888 | "itertools", 889 | "log", 890 | "multimap", 891 | "once_cell", 892 | "petgraph", 893 | "prettyplease", 894 | "prost", 895 | "prost-types", 896 | "regex", 897 | "syn", 898 | "tempfile", 899 | "which", 900 | ] 901 | 902 | [[package]] 903 | name = "prost-derive" 904 | version = "0.12.1" 905 | source = "registry+https://github.com/rust-lang/crates.io-index" 906 | checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" 907 | dependencies = [ 908 | "anyhow", 909 | "itertools", 910 | "proc-macro2", 911 | "quote", 912 | "syn", 913 | ] 914 | 915 | [[package]] 916 | name = "prost-types" 917 | version = "0.12.1" 918 | source = "registry+https://github.com/rust-lang/crates.io-index" 919 | checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" 920 | dependencies = [ 921 | "prost", 922 | ] 923 | 924 | [[package]] 925 | name = "proto-auth-demo" 926 | version = "0.1.0" 927 | dependencies = [ 928 | "bcrypt", 929 | "diesel", 930 | "dotenvy", 931 | "hmac", 932 | "jwt", 933 | "prost", 934 | "protobuf", 935 | "protos", 936 | "serde", 937 | "sha2", 938 | "tokio", 939 | "tonic", 940 | ] 941 | 942 | [[package]] 943 | name = "protobuf" 944 | version = "3.3.0" 945 | source = "registry+https://github.com/rust-lang/crates.io-index" 946 | checksum = "b65f4a8ec18723a734e5dc09c173e0abf9690432da5340285d536edcb4dac190" 947 | dependencies = [ 948 | "once_cell", 949 | "protobuf-support", 950 | "thiserror", 951 | ] 952 | 953 | [[package]] 954 | name = "protobuf-support" 955 | version = "3.3.0" 956 | source = "registry+https://github.com/rust-lang/crates.io-index" 957 | checksum = "6872f4d4f4b98303239a2b5838f5bbbb77b01ffc892d627957f37a22d7cfe69c" 958 | dependencies = [ 959 | "thiserror", 960 | ] 961 | 962 | [[package]] 963 | name = "protos" 964 | version = "0.1.0" 965 | dependencies = [ 966 | "bytes", 967 | "pbjson", 968 | "pbjson-types", 969 | "prost", 970 | "serde", 971 | "tonic", 972 | ] 973 | 974 | [[package]] 975 | name = "quote" 976 | version = "1.0.33" 977 | source = "registry+https://github.com/rust-lang/crates.io-index" 978 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 979 | dependencies = [ 980 | "proc-macro2", 981 | ] 982 | 983 | [[package]] 984 | name = "r2d2" 985 | version = "0.8.10" 986 | source = "registry+https://github.com/rust-lang/crates.io-index" 987 | checksum = "51de85fb3fb6524929c8a2eb85e6b6d363de4e8c48f9e2c2eac4944abc181c93" 988 | dependencies = [ 989 | "log", 990 | "parking_lot", 991 | "scheduled-thread-pool", 992 | ] 993 | 994 | [[package]] 995 | name = "rand" 996 | version = "0.8.5" 997 | source = "registry+https://github.com/rust-lang/crates.io-index" 998 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 999 | dependencies = [ 1000 | "libc", 1001 | "rand_chacha", 1002 | "rand_core", 1003 | ] 1004 | 1005 | [[package]] 1006 | name = "rand_chacha" 1007 | version = "0.3.1" 1008 | source = "registry+https://github.com/rust-lang/crates.io-index" 1009 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 1010 | dependencies = [ 1011 | "ppv-lite86", 1012 | "rand_core", 1013 | ] 1014 | 1015 | [[package]] 1016 | name = "rand_core" 1017 | version = "0.6.4" 1018 | source = "registry+https://github.com/rust-lang/crates.io-index" 1019 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 1020 | dependencies = [ 1021 | "getrandom", 1022 | ] 1023 | 1024 | [[package]] 1025 | name = "redox_syscall" 1026 | version = "0.4.1" 1027 | source = "registry+https://github.com/rust-lang/crates.io-index" 1028 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" 1029 | dependencies = [ 1030 | "bitflags 1.3.2", 1031 | ] 1032 | 1033 | [[package]] 1034 | name = "regex" 1035 | version = "1.10.2" 1036 | source = "registry+https://github.com/rust-lang/crates.io-index" 1037 | checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" 1038 | dependencies = [ 1039 | "aho-corasick", 1040 | "memchr", 1041 | "regex-automata", 1042 | "regex-syntax", 1043 | ] 1044 | 1045 | [[package]] 1046 | name = "regex-automata" 1047 | version = "0.4.3" 1048 | source = "registry+https://github.com/rust-lang/crates.io-index" 1049 | checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" 1050 | dependencies = [ 1051 | "aho-corasick", 1052 | "memchr", 1053 | "regex-syntax", 1054 | ] 1055 | 1056 | [[package]] 1057 | name = "regex-syntax" 1058 | version = "0.8.2" 1059 | source = "registry+https://github.com/rust-lang/crates.io-index" 1060 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 1061 | 1062 | [[package]] 1063 | name = "rustc-demangle" 1064 | version = "0.1.23" 1065 | source = "registry+https://github.com/rust-lang/crates.io-index" 1066 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 1067 | 1068 | [[package]] 1069 | name = "rustix" 1070 | version = "0.38.21" 1071 | source = "registry+https://github.com/rust-lang/crates.io-index" 1072 | checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" 1073 | dependencies = [ 1074 | "bitflags 2.4.1", 1075 | "errno", 1076 | "libc", 1077 | "linux-raw-sys", 1078 | "windows-sys", 1079 | ] 1080 | 1081 | [[package]] 1082 | name = "rustversion" 1083 | version = "1.0.14" 1084 | source = "registry+https://github.com/rust-lang/crates.io-index" 1085 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" 1086 | 1087 | [[package]] 1088 | name = "ryu" 1089 | version = "1.0.15" 1090 | source = "registry+https://github.com/rust-lang/crates.io-index" 1091 | checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" 1092 | 1093 | [[package]] 1094 | name = "scheduled-thread-pool" 1095 | version = "0.2.7" 1096 | source = "registry+https://github.com/rust-lang/crates.io-index" 1097 | checksum = "3cbc66816425a074528352f5789333ecff06ca41b36b0b0efdfbb29edc391a19" 1098 | dependencies = [ 1099 | "parking_lot", 1100 | ] 1101 | 1102 | [[package]] 1103 | name = "scopeguard" 1104 | version = "1.2.0" 1105 | source = "registry+https://github.com/rust-lang/crates.io-index" 1106 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 1107 | 1108 | [[package]] 1109 | name = "serde" 1110 | version = "1.0.190" 1111 | source = "registry+https://github.com/rust-lang/crates.io-index" 1112 | checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" 1113 | dependencies = [ 1114 | "serde_derive", 1115 | ] 1116 | 1117 | [[package]] 1118 | name = "serde_derive" 1119 | version = "1.0.190" 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" 1121 | checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" 1122 | dependencies = [ 1123 | "proc-macro2", 1124 | "quote", 1125 | "syn", 1126 | ] 1127 | 1128 | [[package]] 1129 | name = "serde_json" 1130 | version = "1.0.107" 1131 | source = "registry+https://github.com/rust-lang/crates.io-index" 1132 | checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" 1133 | dependencies = [ 1134 | "itoa", 1135 | "ryu", 1136 | "serde", 1137 | ] 1138 | 1139 | [[package]] 1140 | name = "sha2" 1141 | version = "0.10.8" 1142 | source = "registry+https://github.com/rust-lang/crates.io-index" 1143 | checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" 1144 | dependencies = [ 1145 | "cfg-if", 1146 | "cpufeatures", 1147 | "digest", 1148 | ] 1149 | 1150 | [[package]] 1151 | name = "signal-hook-registry" 1152 | version = "1.4.1" 1153 | source = "registry+https://github.com/rust-lang/crates.io-index" 1154 | checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" 1155 | dependencies = [ 1156 | "libc", 1157 | ] 1158 | 1159 | [[package]] 1160 | name = "slab" 1161 | version = "0.4.9" 1162 | source = "registry+https://github.com/rust-lang/crates.io-index" 1163 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 1164 | dependencies = [ 1165 | "autocfg", 1166 | ] 1167 | 1168 | [[package]] 1169 | name = "smallvec" 1170 | version = "1.11.1" 1171 | source = "registry+https://github.com/rust-lang/crates.io-index" 1172 | checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" 1173 | 1174 | [[package]] 1175 | name = "socket2" 1176 | version = "0.4.10" 1177 | source = "registry+https://github.com/rust-lang/crates.io-index" 1178 | checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" 1179 | dependencies = [ 1180 | "libc", 1181 | "winapi", 1182 | ] 1183 | 1184 | [[package]] 1185 | name = "socket2" 1186 | version = "0.5.5" 1187 | source = "registry+https://github.com/rust-lang/crates.io-index" 1188 | checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" 1189 | dependencies = [ 1190 | "libc", 1191 | "windows-sys", 1192 | ] 1193 | 1194 | [[package]] 1195 | name = "subtle" 1196 | version = "2.5.0" 1197 | source = "registry+https://github.com/rust-lang/crates.io-index" 1198 | checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" 1199 | 1200 | [[package]] 1201 | name = "syn" 1202 | version = "2.0.38" 1203 | source = "registry+https://github.com/rust-lang/crates.io-index" 1204 | checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" 1205 | dependencies = [ 1206 | "proc-macro2", 1207 | "quote", 1208 | "unicode-ident", 1209 | ] 1210 | 1211 | [[package]] 1212 | name = "sync_wrapper" 1213 | version = "0.1.2" 1214 | source = "registry+https://github.com/rust-lang/crates.io-index" 1215 | checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" 1216 | 1217 | [[package]] 1218 | name = "tempfile" 1219 | version = "3.8.1" 1220 | source = "registry+https://github.com/rust-lang/crates.io-index" 1221 | checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" 1222 | dependencies = [ 1223 | "cfg-if", 1224 | "fastrand", 1225 | "redox_syscall", 1226 | "rustix", 1227 | "windows-sys", 1228 | ] 1229 | 1230 | [[package]] 1231 | name = "thiserror" 1232 | version = "1.0.50" 1233 | source = "registry+https://github.com/rust-lang/crates.io-index" 1234 | checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" 1235 | dependencies = [ 1236 | "thiserror-impl", 1237 | ] 1238 | 1239 | [[package]] 1240 | name = "thiserror-impl" 1241 | version = "1.0.50" 1242 | source = "registry+https://github.com/rust-lang/crates.io-index" 1243 | checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" 1244 | dependencies = [ 1245 | "proc-macro2", 1246 | "quote", 1247 | "syn", 1248 | ] 1249 | 1250 | [[package]] 1251 | name = "tokio" 1252 | version = "1.33.0" 1253 | source = "registry+https://github.com/rust-lang/crates.io-index" 1254 | checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" 1255 | dependencies = [ 1256 | "backtrace", 1257 | "bytes", 1258 | "libc", 1259 | "mio", 1260 | "num_cpus", 1261 | "parking_lot", 1262 | "pin-project-lite", 1263 | "signal-hook-registry", 1264 | "socket2 0.5.5", 1265 | "tokio-macros", 1266 | "windows-sys", 1267 | ] 1268 | 1269 | [[package]] 1270 | name = "tokio-io-timeout" 1271 | version = "1.2.0" 1272 | source = "registry+https://github.com/rust-lang/crates.io-index" 1273 | checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" 1274 | dependencies = [ 1275 | "pin-project-lite", 1276 | "tokio", 1277 | ] 1278 | 1279 | [[package]] 1280 | name = "tokio-macros" 1281 | version = "2.1.0" 1282 | source = "registry+https://github.com/rust-lang/crates.io-index" 1283 | checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" 1284 | dependencies = [ 1285 | "proc-macro2", 1286 | "quote", 1287 | "syn", 1288 | ] 1289 | 1290 | [[package]] 1291 | name = "tokio-stream" 1292 | version = "0.1.14" 1293 | source = "registry+https://github.com/rust-lang/crates.io-index" 1294 | checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" 1295 | dependencies = [ 1296 | "futures-core", 1297 | "pin-project-lite", 1298 | "tokio", 1299 | ] 1300 | 1301 | [[package]] 1302 | name = "tokio-util" 1303 | version = "0.7.10" 1304 | source = "registry+https://github.com/rust-lang/crates.io-index" 1305 | checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" 1306 | dependencies = [ 1307 | "bytes", 1308 | "futures-core", 1309 | "futures-sink", 1310 | "pin-project-lite", 1311 | "tokio", 1312 | "tracing", 1313 | ] 1314 | 1315 | [[package]] 1316 | name = "tonic" 1317 | version = "0.10.2" 1318 | source = "registry+https://github.com/rust-lang/crates.io-index" 1319 | checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" 1320 | dependencies = [ 1321 | "async-stream", 1322 | "async-trait", 1323 | "axum", 1324 | "base64 0.21.5", 1325 | "bytes", 1326 | "flate2", 1327 | "h2", 1328 | "http", 1329 | "http-body", 1330 | "hyper", 1331 | "hyper-timeout", 1332 | "percent-encoding", 1333 | "pin-project", 1334 | "prost", 1335 | "tokio", 1336 | "tokio-stream", 1337 | "tower", 1338 | "tower-layer", 1339 | "tower-service", 1340 | "tracing", 1341 | ] 1342 | 1343 | [[package]] 1344 | name = "tower" 1345 | version = "0.4.13" 1346 | source = "registry+https://github.com/rust-lang/crates.io-index" 1347 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 1348 | dependencies = [ 1349 | "futures-core", 1350 | "futures-util", 1351 | "indexmap 1.9.3", 1352 | "pin-project", 1353 | "pin-project-lite", 1354 | "rand", 1355 | "slab", 1356 | "tokio", 1357 | "tokio-util", 1358 | "tower-layer", 1359 | "tower-service", 1360 | "tracing", 1361 | ] 1362 | 1363 | [[package]] 1364 | name = "tower-layer" 1365 | version = "0.3.2" 1366 | source = "registry+https://github.com/rust-lang/crates.io-index" 1367 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" 1368 | 1369 | [[package]] 1370 | name = "tower-service" 1371 | version = "0.3.2" 1372 | source = "registry+https://github.com/rust-lang/crates.io-index" 1373 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1374 | 1375 | [[package]] 1376 | name = "tracing" 1377 | version = "0.1.40" 1378 | source = "registry+https://github.com/rust-lang/crates.io-index" 1379 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 1380 | dependencies = [ 1381 | "pin-project-lite", 1382 | "tracing-attributes", 1383 | "tracing-core", 1384 | ] 1385 | 1386 | [[package]] 1387 | name = "tracing-attributes" 1388 | version = "0.1.27" 1389 | source = "registry+https://github.com/rust-lang/crates.io-index" 1390 | checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" 1391 | dependencies = [ 1392 | "proc-macro2", 1393 | "quote", 1394 | "syn", 1395 | ] 1396 | 1397 | [[package]] 1398 | name = "tracing-core" 1399 | version = "0.1.32" 1400 | source = "registry+https://github.com/rust-lang/crates.io-index" 1401 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 1402 | dependencies = [ 1403 | "once_cell", 1404 | ] 1405 | 1406 | [[package]] 1407 | name = "try-lock" 1408 | version = "0.2.4" 1409 | source = "registry+https://github.com/rust-lang/crates.io-index" 1410 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 1411 | 1412 | [[package]] 1413 | name = "typenum" 1414 | version = "1.17.0" 1415 | source = "registry+https://github.com/rust-lang/crates.io-index" 1416 | checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 1417 | 1418 | [[package]] 1419 | name = "unicode-ident" 1420 | version = "1.0.12" 1421 | source = "registry+https://github.com/rust-lang/crates.io-index" 1422 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1423 | 1424 | [[package]] 1425 | name = "vcpkg" 1426 | version = "0.2.15" 1427 | source = "registry+https://github.com/rust-lang/crates.io-index" 1428 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 1429 | 1430 | [[package]] 1431 | name = "version_check" 1432 | version = "0.9.4" 1433 | source = "registry+https://github.com/rust-lang/crates.io-index" 1434 | checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" 1435 | 1436 | [[package]] 1437 | name = "want" 1438 | version = "0.3.1" 1439 | source = "registry+https://github.com/rust-lang/crates.io-index" 1440 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1441 | dependencies = [ 1442 | "try-lock", 1443 | ] 1444 | 1445 | [[package]] 1446 | name = "wasi" 1447 | version = "0.11.0+wasi-snapshot-preview1" 1448 | source = "registry+https://github.com/rust-lang/crates.io-index" 1449 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1450 | 1451 | [[package]] 1452 | name = "which" 1453 | version = "4.4.2" 1454 | source = "registry+https://github.com/rust-lang/crates.io-index" 1455 | checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" 1456 | dependencies = [ 1457 | "either", 1458 | "home", 1459 | "once_cell", 1460 | "rustix", 1461 | ] 1462 | 1463 | [[package]] 1464 | name = "winapi" 1465 | version = "0.3.9" 1466 | source = "registry+https://github.com/rust-lang/crates.io-index" 1467 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1468 | dependencies = [ 1469 | "winapi-i686-pc-windows-gnu", 1470 | "winapi-x86_64-pc-windows-gnu", 1471 | ] 1472 | 1473 | [[package]] 1474 | name = "winapi-i686-pc-windows-gnu" 1475 | version = "0.4.0" 1476 | source = "registry+https://github.com/rust-lang/crates.io-index" 1477 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1478 | 1479 | [[package]] 1480 | name = "winapi-x86_64-pc-windows-gnu" 1481 | version = "0.4.0" 1482 | source = "registry+https://github.com/rust-lang/crates.io-index" 1483 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1484 | 1485 | [[package]] 1486 | name = "windows-sys" 1487 | version = "0.48.0" 1488 | source = "registry+https://github.com/rust-lang/crates.io-index" 1489 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1490 | dependencies = [ 1491 | "windows-targets", 1492 | ] 1493 | 1494 | [[package]] 1495 | name = "windows-targets" 1496 | version = "0.48.5" 1497 | source = "registry+https://github.com/rust-lang/crates.io-index" 1498 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1499 | dependencies = [ 1500 | "windows_aarch64_gnullvm", 1501 | "windows_aarch64_msvc", 1502 | "windows_i686_gnu", 1503 | "windows_i686_msvc", 1504 | "windows_x86_64_gnu", 1505 | "windows_x86_64_gnullvm", 1506 | "windows_x86_64_msvc", 1507 | ] 1508 | 1509 | [[package]] 1510 | name = "windows_aarch64_gnullvm" 1511 | version = "0.48.5" 1512 | source = "registry+https://github.com/rust-lang/crates.io-index" 1513 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1514 | 1515 | [[package]] 1516 | name = "windows_aarch64_msvc" 1517 | version = "0.48.5" 1518 | source = "registry+https://github.com/rust-lang/crates.io-index" 1519 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1520 | 1521 | [[package]] 1522 | name = "windows_i686_gnu" 1523 | version = "0.48.5" 1524 | source = "registry+https://github.com/rust-lang/crates.io-index" 1525 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1526 | 1527 | [[package]] 1528 | name = "windows_i686_msvc" 1529 | version = "0.48.5" 1530 | source = "registry+https://github.com/rust-lang/crates.io-index" 1531 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1532 | 1533 | [[package]] 1534 | name = "windows_x86_64_gnu" 1535 | version = "0.48.5" 1536 | source = "registry+https://github.com/rust-lang/crates.io-index" 1537 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1538 | 1539 | [[package]] 1540 | name = "windows_x86_64_gnullvm" 1541 | version = "0.48.5" 1542 | source = "registry+https://github.com/rust-lang/crates.io-index" 1543 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1544 | 1545 | [[package]] 1546 | name = "windows_x86_64_msvc" 1547 | version = "0.48.5" 1548 | source = "registry+https://github.com/rust-lang/crates.io-index" 1549 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1550 | 1551 | [[package]] 1552 | name = "zeroize" 1553 | version = "1.6.0" 1554 | source = "registry+https://github.com/rust-lang/crates.io-index" 1555 | checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" 1556 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "proto-auth-demo" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [dependencies] 7 | diesel = { version = "2.1.3", features = ["postgres", "r2d2"] } 8 | dotenvy = "0.15.7" 9 | prost = "0.12.1" 10 | protobuf = "3.3.0" 11 | serde = "1.0.190" 12 | tokio = { version = "1.33.0", features = ["full"] } 13 | tonic = "0.10.2" 14 | protos = { path = "./gen" } 15 | bcrypt = "0.15.0" 16 | jwt = "0.16.0" 17 | hmac = "0.12.1" 18 | sha2 = "0.10.8" 19 | 20 | [workspace] 21 | members = [ 22 | "gen" 23 | ] -------------------------------------------------------------------------------- /buf.gen.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | plugins: 3 | - plugin: prost # Generates the core code 4 | out: gen/src 5 | opt: 6 | - bytes=. 7 | - compile_well_known_types 8 | - extern_path=.google.protobuf=::pbjson_types 9 | - file_descriptor_set 10 | - plugin: prost-serde # Generates code compatible with JSON serde 11 | out: gen/src 12 | - plugin: tonic # Generates the Tonic services 13 | out: gen/src 14 | opt: 15 | - compile_well_known_types 16 | - extern_path=.google.protobuf=::pbjson_types 17 | - plugin: prost-crate # Makes the gen folder a crate 18 | out: gen 19 | opt: 20 | - gen_crate=gen/Cargo.toml -------------------------------------------------------------------------------- /buf.work.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | directories: 3 | - proto -------------------------------------------------------------------------------- /diesel.toml: -------------------------------------------------------------------------------- 1 | # For documentation on how to configure this file, 2 | # see https://diesel.rs/guides/configuring-diesel-cli 3 | 4 | [print_schema] 5 | file = "src/schema.rs" 6 | custom_type_derives = ["diesel::query_builder::QueryId"] 7 | 8 | [migrations_directory] 9 | dir = "migrations" 10 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | db: 5 | image: postgres 6 | restart: always 7 | ports: 8 | - "5432:5432" 9 | environment: 10 | POSTGRES_USER: rustproto 11 | POSTGRES_PASSWORD: rustproto -------------------------------------------------------------------------------- /gen/Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "addr2line" 7 | version = "0.21.0" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" 10 | dependencies = [ 11 | "gimli", 12 | ] 13 | 14 | [[package]] 15 | name = "adler" 16 | version = "1.0.2" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" 19 | 20 | [[package]] 21 | name = "aho-corasick" 22 | version = "1.1.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 25 | dependencies = [ 26 | "memchr", 27 | ] 28 | 29 | [[package]] 30 | name = "anyhow" 31 | version = "1.0.75" 32 | source = "registry+https://github.com/rust-lang/crates.io-index" 33 | checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" 34 | 35 | [[package]] 36 | name = "async-stream" 37 | version = "0.3.5" 38 | source = "registry+https://github.com/rust-lang/crates.io-index" 39 | checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" 40 | dependencies = [ 41 | "async-stream-impl", 42 | "futures-core", 43 | "pin-project-lite", 44 | ] 45 | 46 | [[package]] 47 | name = "async-stream-impl" 48 | version = "0.3.5" 49 | source = "registry+https://github.com/rust-lang/crates.io-index" 50 | checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" 51 | dependencies = [ 52 | "proc-macro2", 53 | "quote", 54 | "syn", 55 | ] 56 | 57 | [[package]] 58 | name = "async-trait" 59 | version = "0.1.74" 60 | source = "registry+https://github.com/rust-lang/crates.io-index" 61 | checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" 62 | dependencies = [ 63 | "proc-macro2", 64 | "quote", 65 | "syn", 66 | ] 67 | 68 | [[package]] 69 | name = "autocfg" 70 | version = "1.1.0" 71 | source = "registry+https://github.com/rust-lang/crates.io-index" 72 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 73 | 74 | [[package]] 75 | name = "axum" 76 | version = "0.6.20" 77 | source = "registry+https://github.com/rust-lang/crates.io-index" 78 | checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" 79 | dependencies = [ 80 | "async-trait", 81 | "axum-core", 82 | "bitflags 1.3.2", 83 | "bytes", 84 | "futures-util", 85 | "http", 86 | "http-body", 87 | "hyper", 88 | "itoa", 89 | "matchit", 90 | "memchr", 91 | "mime", 92 | "percent-encoding", 93 | "pin-project-lite", 94 | "rustversion", 95 | "serde", 96 | "sync_wrapper", 97 | "tower", 98 | "tower-layer", 99 | "tower-service", 100 | ] 101 | 102 | [[package]] 103 | name = "axum-core" 104 | version = "0.3.4" 105 | source = "registry+https://github.com/rust-lang/crates.io-index" 106 | checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" 107 | dependencies = [ 108 | "async-trait", 109 | "bytes", 110 | "futures-util", 111 | "http", 112 | "http-body", 113 | "mime", 114 | "rustversion", 115 | "tower-layer", 116 | "tower-service", 117 | ] 118 | 119 | [[package]] 120 | name = "backtrace" 121 | version = "0.3.69" 122 | source = "registry+https://github.com/rust-lang/crates.io-index" 123 | checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" 124 | dependencies = [ 125 | "addr2line", 126 | "cc", 127 | "cfg-if", 128 | "libc", 129 | "miniz_oxide", 130 | "object", 131 | "rustc-demangle", 132 | ] 133 | 134 | [[package]] 135 | name = "base64" 136 | version = "0.21.5" 137 | source = "registry+https://github.com/rust-lang/crates.io-index" 138 | checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" 139 | 140 | [[package]] 141 | name = "bitflags" 142 | version = "1.3.2" 143 | source = "registry+https://github.com/rust-lang/crates.io-index" 144 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 145 | 146 | [[package]] 147 | name = "bitflags" 148 | version = "2.4.1" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" 151 | 152 | [[package]] 153 | name = "bytes" 154 | version = "1.5.0" 155 | source = "registry+https://github.com/rust-lang/crates.io-index" 156 | checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" 157 | 158 | [[package]] 159 | name = "cc" 160 | version = "1.0.83" 161 | source = "registry+https://github.com/rust-lang/crates.io-index" 162 | checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" 163 | dependencies = [ 164 | "libc", 165 | ] 166 | 167 | [[package]] 168 | name = "cfg-if" 169 | version = "1.0.0" 170 | source = "registry+https://github.com/rust-lang/crates.io-index" 171 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 172 | 173 | [[package]] 174 | name = "chrono" 175 | version = "0.4.31" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" 178 | dependencies = [ 179 | "num-traits", 180 | ] 181 | 182 | [[package]] 183 | name = "crc32fast" 184 | version = "1.3.2" 185 | source = "registry+https://github.com/rust-lang/crates.io-index" 186 | checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" 187 | dependencies = [ 188 | "cfg-if", 189 | ] 190 | 191 | [[package]] 192 | name = "either" 193 | version = "1.9.0" 194 | source = "registry+https://github.com/rust-lang/crates.io-index" 195 | checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 196 | 197 | [[package]] 198 | name = "equivalent" 199 | version = "1.0.1" 200 | source = "registry+https://github.com/rust-lang/crates.io-index" 201 | checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" 202 | 203 | [[package]] 204 | name = "errno" 205 | version = "0.3.5" 206 | source = "registry+https://github.com/rust-lang/crates.io-index" 207 | checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" 208 | dependencies = [ 209 | "libc", 210 | "windows-sys", 211 | ] 212 | 213 | [[package]] 214 | name = "fastrand" 215 | version = "2.0.1" 216 | source = "registry+https://github.com/rust-lang/crates.io-index" 217 | checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" 218 | 219 | [[package]] 220 | name = "fixedbitset" 221 | version = "0.4.2" 222 | source = "registry+https://github.com/rust-lang/crates.io-index" 223 | checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" 224 | 225 | [[package]] 226 | name = "flate2" 227 | version = "1.0.28" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" 230 | dependencies = [ 231 | "crc32fast", 232 | "miniz_oxide", 233 | ] 234 | 235 | [[package]] 236 | name = "fnv" 237 | version = "1.0.7" 238 | source = "registry+https://github.com/rust-lang/crates.io-index" 239 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 240 | 241 | [[package]] 242 | name = "futures-channel" 243 | version = "0.3.29" 244 | source = "registry+https://github.com/rust-lang/crates.io-index" 245 | checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" 246 | dependencies = [ 247 | "futures-core", 248 | ] 249 | 250 | [[package]] 251 | name = "futures-core" 252 | version = "0.3.29" 253 | source = "registry+https://github.com/rust-lang/crates.io-index" 254 | checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" 255 | 256 | [[package]] 257 | name = "futures-sink" 258 | version = "0.3.29" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" 261 | 262 | [[package]] 263 | name = "futures-task" 264 | version = "0.3.29" 265 | source = "registry+https://github.com/rust-lang/crates.io-index" 266 | checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" 267 | 268 | [[package]] 269 | name = "futures-util" 270 | version = "0.3.29" 271 | source = "registry+https://github.com/rust-lang/crates.io-index" 272 | checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" 273 | dependencies = [ 274 | "futures-core", 275 | "futures-task", 276 | "pin-project-lite", 277 | "pin-utils", 278 | ] 279 | 280 | [[package]] 281 | name = "getrandom" 282 | version = "0.2.10" 283 | source = "registry+https://github.com/rust-lang/crates.io-index" 284 | checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" 285 | dependencies = [ 286 | "cfg-if", 287 | "libc", 288 | "wasi", 289 | ] 290 | 291 | [[package]] 292 | name = "gimli" 293 | version = "0.28.0" 294 | source = "registry+https://github.com/rust-lang/crates.io-index" 295 | checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" 296 | 297 | [[package]] 298 | name = "h2" 299 | version = "0.3.21" 300 | source = "registry+https://github.com/rust-lang/crates.io-index" 301 | checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" 302 | dependencies = [ 303 | "bytes", 304 | "fnv", 305 | "futures-core", 306 | "futures-sink", 307 | "futures-util", 308 | "http", 309 | "indexmap 1.9.3", 310 | "slab", 311 | "tokio", 312 | "tokio-util", 313 | "tracing", 314 | ] 315 | 316 | [[package]] 317 | name = "hashbrown" 318 | version = "0.12.3" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" 321 | 322 | [[package]] 323 | name = "hashbrown" 324 | version = "0.14.2" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" 327 | 328 | [[package]] 329 | name = "heck" 330 | version = "0.4.1" 331 | source = "registry+https://github.com/rust-lang/crates.io-index" 332 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" 333 | 334 | [[package]] 335 | name = "home" 336 | version = "0.5.5" 337 | source = "registry+https://github.com/rust-lang/crates.io-index" 338 | checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" 339 | dependencies = [ 340 | "windows-sys", 341 | ] 342 | 343 | [[package]] 344 | name = "http" 345 | version = "0.2.9" 346 | source = "registry+https://github.com/rust-lang/crates.io-index" 347 | checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" 348 | dependencies = [ 349 | "bytes", 350 | "fnv", 351 | "itoa", 352 | ] 353 | 354 | [[package]] 355 | name = "http-body" 356 | version = "0.4.5" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" 359 | dependencies = [ 360 | "bytes", 361 | "http", 362 | "pin-project-lite", 363 | ] 364 | 365 | [[package]] 366 | name = "httparse" 367 | version = "1.8.0" 368 | source = "registry+https://github.com/rust-lang/crates.io-index" 369 | checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" 370 | 371 | [[package]] 372 | name = "httpdate" 373 | version = "1.0.3" 374 | source = "registry+https://github.com/rust-lang/crates.io-index" 375 | checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" 376 | 377 | [[package]] 378 | name = "hyper" 379 | version = "0.14.27" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" 382 | dependencies = [ 383 | "bytes", 384 | "futures-channel", 385 | "futures-core", 386 | "futures-util", 387 | "h2", 388 | "http", 389 | "http-body", 390 | "httparse", 391 | "httpdate", 392 | "itoa", 393 | "pin-project-lite", 394 | "socket2 0.4.10", 395 | "tokio", 396 | "tower-service", 397 | "tracing", 398 | "want", 399 | ] 400 | 401 | [[package]] 402 | name = "hyper-timeout" 403 | version = "0.4.1" 404 | source = "registry+https://github.com/rust-lang/crates.io-index" 405 | checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" 406 | dependencies = [ 407 | "hyper", 408 | "pin-project-lite", 409 | "tokio", 410 | "tokio-io-timeout", 411 | ] 412 | 413 | [[package]] 414 | name = "indexmap" 415 | version = "1.9.3" 416 | source = "registry+https://github.com/rust-lang/crates.io-index" 417 | checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" 418 | dependencies = [ 419 | "autocfg", 420 | "hashbrown 0.12.3", 421 | ] 422 | 423 | [[package]] 424 | name = "indexmap" 425 | version = "2.0.2" 426 | source = "registry+https://github.com/rust-lang/crates.io-index" 427 | checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" 428 | dependencies = [ 429 | "equivalent", 430 | "hashbrown 0.14.2", 431 | ] 432 | 433 | [[package]] 434 | name = "itertools" 435 | version = "0.11.0" 436 | source = "registry+https://github.com/rust-lang/crates.io-index" 437 | checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" 438 | dependencies = [ 439 | "either", 440 | ] 441 | 442 | [[package]] 443 | name = "itoa" 444 | version = "1.0.9" 445 | source = "registry+https://github.com/rust-lang/crates.io-index" 446 | checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" 447 | 448 | [[package]] 449 | name = "libc" 450 | version = "0.2.149" 451 | source = "registry+https://github.com/rust-lang/crates.io-index" 452 | checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" 453 | 454 | [[package]] 455 | name = "linux-raw-sys" 456 | version = "0.4.10" 457 | source = "registry+https://github.com/rust-lang/crates.io-index" 458 | checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" 459 | 460 | [[package]] 461 | name = "log" 462 | version = "0.4.20" 463 | source = "registry+https://github.com/rust-lang/crates.io-index" 464 | checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 465 | 466 | [[package]] 467 | name = "matchit" 468 | version = "0.7.3" 469 | source = "registry+https://github.com/rust-lang/crates.io-index" 470 | checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" 471 | 472 | [[package]] 473 | name = "memchr" 474 | version = "2.6.4" 475 | source = "registry+https://github.com/rust-lang/crates.io-index" 476 | checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 477 | 478 | [[package]] 479 | name = "mime" 480 | version = "0.3.17" 481 | source = "registry+https://github.com/rust-lang/crates.io-index" 482 | checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 483 | 484 | [[package]] 485 | name = "miniz_oxide" 486 | version = "0.7.1" 487 | source = "registry+https://github.com/rust-lang/crates.io-index" 488 | checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" 489 | dependencies = [ 490 | "adler", 491 | ] 492 | 493 | [[package]] 494 | name = "mio" 495 | version = "0.8.9" 496 | source = "registry+https://github.com/rust-lang/crates.io-index" 497 | checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" 498 | dependencies = [ 499 | "libc", 500 | "wasi", 501 | "windows-sys", 502 | ] 503 | 504 | [[package]] 505 | name = "multimap" 506 | version = "0.8.3" 507 | source = "registry+https://github.com/rust-lang/crates.io-index" 508 | checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" 509 | 510 | [[package]] 511 | name = "num-traits" 512 | version = "0.2.17" 513 | source = "registry+https://github.com/rust-lang/crates.io-index" 514 | checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" 515 | dependencies = [ 516 | "autocfg", 517 | ] 518 | 519 | [[package]] 520 | name = "object" 521 | version = "0.32.1" 522 | source = "registry+https://github.com/rust-lang/crates.io-index" 523 | checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" 524 | dependencies = [ 525 | "memchr", 526 | ] 527 | 528 | [[package]] 529 | name = "once_cell" 530 | version = "1.18.0" 531 | source = "registry+https://github.com/rust-lang/crates.io-index" 532 | checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" 533 | 534 | [[package]] 535 | name = "pbjson" 536 | version = "0.6.0" 537 | source = "registry+https://github.com/rust-lang/crates.io-index" 538 | checksum = "1030c719b0ec2a2d25a5df729d6cff1acf3cc230bf766f4f97833591f7577b90" 539 | dependencies = [ 540 | "base64", 541 | "serde", 542 | ] 543 | 544 | [[package]] 545 | name = "pbjson-build" 546 | version = "0.6.2" 547 | source = "registry+https://github.com/rust-lang/crates.io-index" 548 | checksum = "2580e33f2292d34be285c5bc3dba5259542b083cfad6037b6d70345f24dcb735" 549 | dependencies = [ 550 | "heck", 551 | "itertools", 552 | "prost", 553 | "prost-types", 554 | ] 555 | 556 | [[package]] 557 | name = "pbjson-types" 558 | version = "0.6.0" 559 | source = "registry+https://github.com/rust-lang/crates.io-index" 560 | checksum = "18f596653ba4ac51bdecbb4ef6773bc7f56042dc13927910de1684ad3d32aa12" 561 | dependencies = [ 562 | "bytes", 563 | "chrono", 564 | "pbjson", 565 | "pbjson-build", 566 | "prost", 567 | "prost-build", 568 | "serde", 569 | ] 570 | 571 | [[package]] 572 | name = "percent-encoding" 573 | version = "2.3.0" 574 | source = "registry+https://github.com/rust-lang/crates.io-index" 575 | checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" 576 | 577 | [[package]] 578 | name = "petgraph" 579 | version = "0.6.4" 580 | source = "registry+https://github.com/rust-lang/crates.io-index" 581 | checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" 582 | dependencies = [ 583 | "fixedbitset", 584 | "indexmap 2.0.2", 585 | ] 586 | 587 | [[package]] 588 | name = "pin-project" 589 | version = "1.1.3" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" 592 | dependencies = [ 593 | "pin-project-internal", 594 | ] 595 | 596 | [[package]] 597 | name = "pin-project-internal" 598 | version = "1.1.3" 599 | source = "registry+https://github.com/rust-lang/crates.io-index" 600 | checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" 601 | dependencies = [ 602 | "proc-macro2", 603 | "quote", 604 | "syn", 605 | ] 606 | 607 | [[package]] 608 | name = "pin-project-lite" 609 | version = "0.2.13" 610 | source = "registry+https://github.com/rust-lang/crates.io-index" 611 | checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 612 | 613 | [[package]] 614 | name = "pin-utils" 615 | version = "0.1.0" 616 | source = "registry+https://github.com/rust-lang/crates.io-index" 617 | checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" 618 | 619 | [[package]] 620 | name = "ppv-lite86" 621 | version = "0.2.17" 622 | source = "registry+https://github.com/rust-lang/crates.io-index" 623 | checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" 624 | 625 | [[package]] 626 | name = "prettyplease" 627 | version = "0.2.15" 628 | source = "registry+https://github.com/rust-lang/crates.io-index" 629 | checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" 630 | dependencies = [ 631 | "proc-macro2", 632 | "syn", 633 | ] 634 | 635 | [[package]] 636 | name = "proc-macro2" 637 | version = "1.0.69" 638 | source = "registry+https://github.com/rust-lang/crates.io-index" 639 | checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" 640 | dependencies = [ 641 | "unicode-ident", 642 | ] 643 | 644 | [[package]] 645 | name = "prost" 646 | version = "0.12.1" 647 | source = "registry+https://github.com/rust-lang/crates.io-index" 648 | checksum = "f4fdd22f3b9c31b53c060df4a0613a1c7f062d4115a2b984dd15b1858f7e340d" 649 | dependencies = [ 650 | "bytes", 651 | "prost-derive", 652 | ] 653 | 654 | [[package]] 655 | name = "prost-build" 656 | version = "0.12.1" 657 | source = "registry+https://github.com/rust-lang/crates.io-index" 658 | checksum = "8bdf592881d821b83d471f8af290226c8d51402259e9bb5be7f9f8bdebbb11ac" 659 | dependencies = [ 660 | "bytes", 661 | "heck", 662 | "itertools", 663 | "log", 664 | "multimap", 665 | "once_cell", 666 | "petgraph", 667 | "prettyplease", 668 | "prost", 669 | "prost-types", 670 | "regex", 671 | "syn", 672 | "tempfile", 673 | "which", 674 | ] 675 | 676 | [[package]] 677 | name = "prost-derive" 678 | version = "0.12.1" 679 | source = "registry+https://github.com/rust-lang/crates.io-index" 680 | checksum = "265baba7fabd416cf5078179f7d2cbeca4ce7a9041111900675ea7c4cb8a4c32" 681 | dependencies = [ 682 | "anyhow", 683 | "itertools", 684 | "proc-macro2", 685 | "quote", 686 | "syn", 687 | ] 688 | 689 | [[package]] 690 | name = "prost-types" 691 | version = "0.12.1" 692 | source = "registry+https://github.com/rust-lang/crates.io-index" 693 | checksum = "e081b29f63d83a4bc75cfc9f3fe424f9156cf92d8a4f0c9407cce9a1b67327cf" 694 | dependencies = [ 695 | "prost", 696 | ] 697 | 698 | [[package]] 699 | name = "protos" 700 | version = "0.1.0" 701 | dependencies = [ 702 | "bytes", 703 | "pbjson", 704 | "pbjson-types", 705 | "prost", 706 | "serde", 707 | "tonic", 708 | ] 709 | 710 | [[package]] 711 | name = "quote" 712 | version = "1.0.33" 713 | source = "registry+https://github.com/rust-lang/crates.io-index" 714 | checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 715 | dependencies = [ 716 | "proc-macro2", 717 | ] 718 | 719 | [[package]] 720 | name = "rand" 721 | version = "0.8.5" 722 | source = "registry+https://github.com/rust-lang/crates.io-index" 723 | checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" 724 | dependencies = [ 725 | "libc", 726 | "rand_chacha", 727 | "rand_core", 728 | ] 729 | 730 | [[package]] 731 | name = "rand_chacha" 732 | version = "0.3.1" 733 | source = "registry+https://github.com/rust-lang/crates.io-index" 734 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 735 | dependencies = [ 736 | "ppv-lite86", 737 | "rand_core", 738 | ] 739 | 740 | [[package]] 741 | name = "rand_core" 742 | version = "0.6.4" 743 | source = "registry+https://github.com/rust-lang/crates.io-index" 744 | checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" 745 | dependencies = [ 746 | "getrandom", 747 | ] 748 | 749 | [[package]] 750 | name = "redox_syscall" 751 | version = "0.4.1" 752 | source = "registry+https://github.com/rust-lang/crates.io-index" 753 | checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" 754 | dependencies = [ 755 | "bitflags 1.3.2", 756 | ] 757 | 758 | [[package]] 759 | name = "regex" 760 | version = "1.10.2" 761 | source = "registry+https://github.com/rust-lang/crates.io-index" 762 | checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" 763 | dependencies = [ 764 | "aho-corasick", 765 | "memchr", 766 | "regex-automata", 767 | "regex-syntax", 768 | ] 769 | 770 | [[package]] 771 | name = "regex-automata" 772 | version = "0.4.3" 773 | source = "registry+https://github.com/rust-lang/crates.io-index" 774 | checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" 775 | dependencies = [ 776 | "aho-corasick", 777 | "memchr", 778 | "regex-syntax", 779 | ] 780 | 781 | [[package]] 782 | name = "regex-syntax" 783 | version = "0.8.2" 784 | source = "registry+https://github.com/rust-lang/crates.io-index" 785 | checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" 786 | 787 | [[package]] 788 | name = "rustc-demangle" 789 | version = "0.1.23" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" 792 | 793 | [[package]] 794 | name = "rustix" 795 | version = "0.38.21" 796 | source = "registry+https://github.com/rust-lang/crates.io-index" 797 | checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" 798 | dependencies = [ 799 | "bitflags 2.4.1", 800 | "errno", 801 | "libc", 802 | "linux-raw-sys", 803 | "windows-sys", 804 | ] 805 | 806 | [[package]] 807 | name = "rustversion" 808 | version = "1.0.14" 809 | source = "registry+https://github.com/rust-lang/crates.io-index" 810 | checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" 811 | 812 | [[package]] 813 | name = "serde" 814 | version = "1.0.190" 815 | source = "registry+https://github.com/rust-lang/crates.io-index" 816 | checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" 817 | dependencies = [ 818 | "serde_derive", 819 | ] 820 | 821 | [[package]] 822 | name = "serde_derive" 823 | version = "1.0.190" 824 | source = "registry+https://github.com/rust-lang/crates.io-index" 825 | checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" 826 | dependencies = [ 827 | "proc-macro2", 828 | "quote", 829 | "syn", 830 | ] 831 | 832 | [[package]] 833 | name = "slab" 834 | version = "0.4.9" 835 | source = "registry+https://github.com/rust-lang/crates.io-index" 836 | checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 837 | dependencies = [ 838 | "autocfg", 839 | ] 840 | 841 | [[package]] 842 | name = "socket2" 843 | version = "0.4.10" 844 | source = "registry+https://github.com/rust-lang/crates.io-index" 845 | checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" 846 | dependencies = [ 847 | "libc", 848 | "winapi", 849 | ] 850 | 851 | [[package]] 852 | name = "socket2" 853 | version = "0.5.5" 854 | source = "registry+https://github.com/rust-lang/crates.io-index" 855 | checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" 856 | dependencies = [ 857 | "libc", 858 | "windows-sys", 859 | ] 860 | 861 | [[package]] 862 | name = "syn" 863 | version = "2.0.38" 864 | source = "registry+https://github.com/rust-lang/crates.io-index" 865 | checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" 866 | dependencies = [ 867 | "proc-macro2", 868 | "quote", 869 | "unicode-ident", 870 | ] 871 | 872 | [[package]] 873 | name = "sync_wrapper" 874 | version = "0.1.2" 875 | source = "registry+https://github.com/rust-lang/crates.io-index" 876 | checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" 877 | 878 | [[package]] 879 | name = "tempfile" 880 | version = "3.8.1" 881 | source = "registry+https://github.com/rust-lang/crates.io-index" 882 | checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" 883 | dependencies = [ 884 | "cfg-if", 885 | "fastrand", 886 | "redox_syscall", 887 | "rustix", 888 | "windows-sys", 889 | ] 890 | 891 | [[package]] 892 | name = "tokio" 893 | version = "1.33.0" 894 | source = "registry+https://github.com/rust-lang/crates.io-index" 895 | checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" 896 | dependencies = [ 897 | "backtrace", 898 | "bytes", 899 | "libc", 900 | "mio", 901 | "pin-project-lite", 902 | "socket2 0.5.5", 903 | "windows-sys", 904 | ] 905 | 906 | [[package]] 907 | name = "tokio-io-timeout" 908 | version = "1.2.0" 909 | source = "registry+https://github.com/rust-lang/crates.io-index" 910 | checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" 911 | dependencies = [ 912 | "pin-project-lite", 913 | "tokio", 914 | ] 915 | 916 | [[package]] 917 | name = "tokio-stream" 918 | version = "0.1.14" 919 | source = "registry+https://github.com/rust-lang/crates.io-index" 920 | checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" 921 | dependencies = [ 922 | "futures-core", 923 | "pin-project-lite", 924 | "tokio", 925 | ] 926 | 927 | [[package]] 928 | name = "tokio-util" 929 | version = "0.7.10" 930 | source = "registry+https://github.com/rust-lang/crates.io-index" 931 | checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" 932 | dependencies = [ 933 | "bytes", 934 | "futures-core", 935 | "futures-sink", 936 | "pin-project-lite", 937 | "tokio", 938 | "tracing", 939 | ] 940 | 941 | [[package]] 942 | name = "tonic" 943 | version = "0.10.2" 944 | source = "registry+https://github.com/rust-lang/crates.io-index" 945 | checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" 946 | dependencies = [ 947 | "async-stream", 948 | "async-trait", 949 | "axum", 950 | "base64", 951 | "bytes", 952 | "flate2", 953 | "h2", 954 | "http", 955 | "http-body", 956 | "hyper", 957 | "hyper-timeout", 958 | "percent-encoding", 959 | "pin-project", 960 | "prost", 961 | "tokio", 962 | "tokio-stream", 963 | "tower", 964 | "tower-layer", 965 | "tower-service", 966 | "tracing", 967 | ] 968 | 969 | [[package]] 970 | name = "tower" 971 | version = "0.4.13" 972 | source = "registry+https://github.com/rust-lang/crates.io-index" 973 | checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" 974 | dependencies = [ 975 | "futures-core", 976 | "futures-util", 977 | "indexmap 1.9.3", 978 | "pin-project", 979 | "pin-project-lite", 980 | "rand", 981 | "slab", 982 | "tokio", 983 | "tokio-util", 984 | "tower-layer", 985 | "tower-service", 986 | "tracing", 987 | ] 988 | 989 | [[package]] 990 | name = "tower-layer" 991 | version = "0.3.2" 992 | source = "registry+https://github.com/rust-lang/crates.io-index" 993 | checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" 994 | 995 | [[package]] 996 | name = "tower-service" 997 | version = "0.3.2" 998 | source = "registry+https://github.com/rust-lang/crates.io-index" 999 | checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" 1000 | 1001 | [[package]] 1002 | name = "tracing" 1003 | version = "0.1.40" 1004 | source = "registry+https://github.com/rust-lang/crates.io-index" 1005 | checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" 1006 | dependencies = [ 1007 | "pin-project-lite", 1008 | "tracing-attributes", 1009 | "tracing-core", 1010 | ] 1011 | 1012 | [[package]] 1013 | name = "tracing-attributes" 1014 | version = "0.1.27" 1015 | source = "registry+https://github.com/rust-lang/crates.io-index" 1016 | checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" 1017 | dependencies = [ 1018 | "proc-macro2", 1019 | "quote", 1020 | "syn", 1021 | ] 1022 | 1023 | [[package]] 1024 | name = "tracing-core" 1025 | version = "0.1.32" 1026 | source = "registry+https://github.com/rust-lang/crates.io-index" 1027 | checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" 1028 | dependencies = [ 1029 | "once_cell", 1030 | ] 1031 | 1032 | [[package]] 1033 | name = "try-lock" 1034 | version = "0.2.4" 1035 | source = "registry+https://github.com/rust-lang/crates.io-index" 1036 | checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" 1037 | 1038 | [[package]] 1039 | name = "unicode-ident" 1040 | version = "1.0.12" 1041 | source = "registry+https://github.com/rust-lang/crates.io-index" 1042 | checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 1043 | 1044 | [[package]] 1045 | name = "want" 1046 | version = "0.3.1" 1047 | source = "registry+https://github.com/rust-lang/crates.io-index" 1048 | checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" 1049 | dependencies = [ 1050 | "try-lock", 1051 | ] 1052 | 1053 | [[package]] 1054 | name = "wasi" 1055 | version = "0.11.0+wasi-snapshot-preview1" 1056 | source = "registry+https://github.com/rust-lang/crates.io-index" 1057 | checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" 1058 | 1059 | [[package]] 1060 | name = "which" 1061 | version = "4.4.2" 1062 | source = "registry+https://github.com/rust-lang/crates.io-index" 1063 | checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" 1064 | dependencies = [ 1065 | "either", 1066 | "home", 1067 | "once_cell", 1068 | "rustix", 1069 | ] 1070 | 1071 | [[package]] 1072 | name = "winapi" 1073 | version = "0.3.9" 1074 | source = "registry+https://github.com/rust-lang/crates.io-index" 1075 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 1076 | dependencies = [ 1077 | "winapi-i686-pc-windows-gnu", 1078 | "winapi-x86_64-pc-windows-gnu", 1079 | ] 1080 | 1081 | [[package]] 1082 | name = "winapi-i686-pc-windows-gnu" 1083 | version = "0.4.0" 1084 | source = "registry+https://github.com/rust-lang/crates.io-index" 1085 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 1086 | 1087 | [[package]] 1088 | name = "winapi-x86_64-pc-windows-gnu" 1089 | version = "0.4.0" 1090 | source = "registry+https://github.com/rust-lang/crates.io-index" 1091 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 1092 | 1093 | [[package]] 1094 | name = "windows-sys" 1095 | version = "0.48.0" 1096 | source = "registry+https://github.com/rust-lang/crates.io-index" 1097 | checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 1098 | dependencies = [ 1099 | "windows-targets", 1100 | ] 1101 | 1102 | [[package]] 1103 | name = "windows-targets" 1104 | version = "0.48.5" 1105 | source = "registry+https://github.com/rust-lang/crates.io-index" 1106 | checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 1107 | dependencies = [ 1108 | "windows_aarch64_gnullvm", 1109 | "windows_aarch64_msvc", 1110 | "windows_i686_gnu", 1111 | "windows_i686_msvc", 1112 | "windows_x86_64_gnu", 1113 | "windows_x86_64_gnullvm", 1114 | "windows_x86_64_msvc", 1115 | ] 1116 | 1117 | [[package]] 1118 | name = "windows_aarch64_gnullvm" 1119 | version = "0.48.5" 1120 | source = "registry+https://github.com/rust-lang/crates.io-index" 1121 | checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1122 | 1123 | [[package]] 1124 | name = "windows_aarch64_msvc" 1125 | version = "0.48.5" 1126 | source = "registry+https://github.com/rust-lang/crates.io-index" 1127 | checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1128 | 1129 | [[package]] 1130 | name = "windows_i686_gnu" 1131 | version = "0.48.5" 1132 | source = "registry+https://github.com/rust-lang/crates.io-index" 1133 | checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1134 | 1135 | [[package]] 1136 | name = "windows_i686_msvc" 1137 | version = "0.48.5" 1138 | source = "registry+https://github.com/rust-lang/crates.io-index" 1139 | checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1140 | 1141 | [[package]] 1142 | name = "windows_x86_64_gnu" 1143 | version = "0.48.5" 1144 | source = "registry+https://github.com/rust-lang/crates.io-index" 1145 | checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1146 | 1147 | [[package]] 1148 | name = "windows_x86_64_gnullvm" 1149 | version = "0.48.5" 1150 | source = "registry+https://github.com/rust-lang/crates.io-index" 1151 | checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1152 | 1153 | [[package]] 1154 | name = "windows_x86_64_msvc" 1155 | version = "0.48.5" 1156 | source = "registry+https://github.com/rust-lang/crates.io-index" 1157 | checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 1158 | -------------------------------------------------------------------------------- /gen/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "protos" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | [features] 7 | default = ["proto_full"] 8 | # @@protoc_deletion_point(features) 9 | # This section is automatically generated by protoc-gen-prost-crate. 10 | # Changes in this area may be lost on regeneration. 11 | proto_full = ["auth","greeting"] 12 | "auth" = [] 13 | "greeting" = [] 14 | # @@protoc_insertion_point(features) 15 | 16 | [dependencies] 17 | bytes = "1.1.0" 18 | prost = "0.12" 19 | pbjson = "0.6" 20 | pbjson-types = "0.6" 21 | serde = "1.0" 22 | tonic = { version = "0.10", features = ["gzip"] } -------------------------------------------------------------------------------- /gen/src/auth.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | #[allow(clippy::derive_partial_eq_without_eq)] 3 | #[derive(Clone, PartialEq, ::prost::Message)] 4 | pub struct LoginRequest { 5 | #[prost(string, tag="1")] 6 | pub email: ::prost::alloc::string::String, 7 | #[prost(string, tag="2")] 8 | pub password: ::prost::alloc::string::String, 9 | } 10 | #[allow(clippy::derive_partial_eq_without_eq)] 11 | #[derive(Clone, PartialEq, ::prost::Message)] 12 | pub struct RegisterRequest { 13 | #[prost(string, tag="1")] 14 | pub firstname: ::prost::alloc::string::String, 15 | #[prost(string, tag="2")] 16 | pub lastname: ::prost::alloc::string::String, 17 | #[prost(string, tag="3")] 18 | pub email: ::prost::alloc::string::String, 19 | #[prost(string, tag="4")] 20 | pub password: ::prost::alloc::string::String, 21 | } 22 | #[allow(clippy::derive_partial_eq_without_eq)] 23 | #[derive(Clone, PartialEq, ::prost::Message)] 24 | pub struct Token { 25 | #[prost(string, tag="1")] 26 | pub access_token: ::prost::alloc::string::String, 27 | } 28 | /// Encoded file descriptor set for the `auth` package 29 | pub const FILE_DESCRIPTOR_SET: &[u8] = &[ 30 | 0x0a, 0xd7, 0x07, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 31 | 0x04, 0x61, 0x75, 0x74, 0x68, 0x22, 0x40, 0x0a, 0x0c, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 0x52, 0x65, 32 | 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x01, 33 | 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 34 | 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 35 | 0x61, 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x7d, 0x0a, 0x0f, 0x52, 0x65, 0x67, 0x69, 0x73, 36 | 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x66, 0x69, 37 | 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x66, 38 | 0x69, 0x72, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x73, 0x74, 39 | 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x73, 0x74, 40 | 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x18, 0x03, 0x20, 41 | 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 42 | 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x61, 43 | 0x73, 0x73, 0x77, 0x6f, 0x72, 0x64, 0x22, 0x2a, 0x0a, 0x05, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x12, 44 | 0x21, 0x0a, 0x0c, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x18, 45 | 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0x54, 0x6f, 0x6b, 46 | 0x65, 0x6e, 0x32, 0x60, 0x0a, 0x04, 0x41, 0x75, 0x74, 0x68, 0x12, 0x28, 0x0a, 0x05, 0x4c, 0x6f, 47 | 0x67, 0x69, 0x6e, 0x12, 0x12, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x4c, 0x6f, 0x67, 0x69, 0x6e, 48 | 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x54, 49 | 0x6f, 0x6b, 0x65, 0x6e, 0x12, 0x2e, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 50 | 0x12, 0x15, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 51 | 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0b, 0x2e, 0x61, 0x75, 0x74, 0x68, 0x2e, 0x54, 52 | 0x6f, 0x6b, 0x65, 0x6e, 0x4a, 0xeb, 0x04, 0x0a, 0x06, 0x12, 0x04, 0x00, 0x00, 0x17, 0x01, 0x0a, 53 | 0x08, 0x0a, 0x01, 0x0c, 0x12, 0x03, 0x00, 0x00, 0x12, 0x0a, 0x08, 0x0a, 0x01, 0x02, 0x12, 0x03, 54 | 0x02, 0x00, 0x0d, 0x0a, 0x0a, 0x0a, 0x02, 0x04, 0x00, 0x12, 0x04, 0x04, 0x00, 0x07, 0x01, 0x0a, 55 | 0x0a, 0x0a, 0x03, 0x04, 0x00, 0x01, 0x12, 0x03, 0x04, 0x08, 0x14, 0x0a, 0x0b, 0x0a, 0x04, 0x04, 56 | 0x00, 0x02, 0x00, 0x12, 0x03, 0x05, 0x04, 0x15, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x00, 57 | 0x05, 0x12, 0x03, 0x05, 0x04, 0x0a, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x00, 0x01, 0x12, 58 | 0x03, 0x05, 0x0b, 0x10, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x00, 0x03, 0x12, 0x03, 0x05, 59 | 0x13, 0x14, 0x0a, 0x0b, 0x0a, 0x04, 0x04, 0x00, 0x02, 0x01, 0x12, 0x03, 0x06, 0x04, 0x18, 0x0a, 60 | 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x01, 0x05, 0x12, 0x03, 0x06, 0x04, 0x0a, 0x0a, 0x0c, 0x0a, 61 | 0x05, 0x04, 0x00, 0x02, 0x01, 0x01, 0x12, 0x03, 0x06, 0x0b, 0x13, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 62 | 0x00, 0x02, 0x01, 0x03, 0x12, 0x03, 0x06, 0x16, 0x17, 0x0a, 0x0a, 0x0a, 0x02, 0x04, 0x01, 0x12, 63 | 0x04, 0x09, 0x00, 0x0e, 0x01, 0x0a, 0x0a, 0x0a, 0x03, 0x04, 0x01, 0x01, 0x12, 0x03, 0x09, 0x08, 64 | 0x17, 0x0a, 0x0b, 0x0a, 0x04, 0x04, 0x01, 0x02, 0x00, 0x12, 0x03, 0x0a, 0x04, 0x19, 0x0a, 0x0c, 65 | 0x0a, 0x05, 0x04, 0x01, 0x02, 0x00, 0x05, 0x12, 0x03, 0x0a, 0x04, 0x0a, 0x0a, 0x0c, 0x0a, 0x05, 66 | 0x04, 0x01, 0x02, 0x00, 0x01, 0x12, 0x03, 0x0a, 0x0b, 0x14, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 67 | 0x02, 0x00, 0x03, 0x12, 0x03, 0x0a, 0x17, 0x18, 0x0a, 0x0b, 0x0a, 0x04, 0x04, 0x01, 0x02, 0x01, 68 | 0x12, 0x03, 0x0b, 0x04, 0x18, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x01, 0x05, 0x12, 0x03, 69 | 0x0b, 0x04, 0x0a, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x01, 0x01, 0x12, 0x03, 0x0b, 0x0b, 70 | 0x13, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x01, 0x03, 0x12, 0x03, 0x0b, 0x16, 0x17, 0x0a, 71 | 0x0b, 0x0a, 0x04, 0x04, 0x01, 0x02, 0x02, 0x12, 0x03, 0x0c, 0x04, 0x15, 0x0a, 0x0c, 0x0a, 0x05, 72 | 0x04, 0x01, 0x02, 0x02, 0x05, 0x12, 0x03, 0x0c, 0x04, 0x0a, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 73 | 0x02, 0x02, 0x01, 0x12, 0x03, 0x0c, 0x0b, 0x10, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x02, 74 | 0x03, 0x12, 0x03, 0x0c, 0x13, 0x14, 0x0a, 0x0b, 0x0a, 0x04, 0x04, 0x01, 0x02, 0x03, 0x12, 0x03, 75 | 0x0d, 0x04, 0x18, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x03, 0x05, 0x12, 0x03, 0x0d, 0x04, 76 | 0x0a, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x03, 0x01, 0x12, 0x03, 0x0d, 0x0b, 0x13, 0x0a, 77 | 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x03, 0x03, 0x12, 0x03, 0x0d, 0x16, 0x17, 0x0a, 0x0a, 0x0a, 78 | 0x02, 0x04, 0x02, 0x12, 0x04, 0x10, 0x00, 0x12, 0x01, 0x0a, 0x0a, 0x0a, 0x03, 0x04, 0x02, 0x01, 79 | 0x12, 0x03, 0x10, 0x08, 0x0d, 0x0a, 0x0b, 0x0a, 0x04, 0x04, 0x02, 0x02, 0x00, 0x12, 0x03, 0x11, 80 | 0x04, 0x1c, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x02, 0x02, 0x00, 0x05, 0x12, 0x03, 0x11, 0x04, 0x0a, 81 | 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x02, 0x02, 0x00, 0x01, 0x12, 0x03, 0x11, 0x0b, 0x17, 0x0a, 0x0c, 82 | 0x0a, 0x05, 0x04, 0x02, 0x02, 0x00, 0x03, 0x12, 0x03, 0x11, 0x1a, 0x1b, 0x0a, 0x0a, 0x0a, 0x02, 83 | 0x06, 0x00, 0x12, 0x04, 0x14, 0x00, 0x17, 0x01, 0x0a, 0x0a, 0x0a, 0x03, 0x06, 0x00, 0x01, 0x12, 84 | 0x03, 0x14, 0x08, 0x0c, 0x0a, 0x0b, 0x0a, 0x04, 0x06, 0x00, 0x02, 0x00, 0x12, 0x03, 0x15, 0x04, 85 | 0x2d, 0x0a, 0x0c, 0x0a, 0x05, 0x06, 0x00, 0x02, 0x00, 0x01, 0x12, 0x03, 0x15, 0x08, 0x0d, 0x0a, 86 | 0x0c, 0x0a, 0x05, 0x06, 0x00, 0x02, 0x00, 0x02, 0x12, 0x03, 0x15, 0x0f, 0x1b, 0x0a, 0x0c, 0x0a, 87 | 0x05, 0x06, 0x00, 0x02, 0x00, 0x03, 0x12, 0x03, 0x15, 0x26, 0x2b, 0x0a, 0x0b, 0x0a, 0x04, 0x06, 88 | 0x00, 0x02, 0x01, 0x12, 0x03, 0x16, 0x04, 0x33, 0x0a, 0x0c, 0x0a, 0x05, 0x06, 0x00, 0x02, 0x01, 89 | 0x01, 0x12, 0x03, 0x16, 0x08, 0x10, 0x0a, 0x0c, 0x0a, 0x05, 0x06, 0x00, 0x02, 0x01, 0x02, 0x12, 90 | 0x03, 0x16, 0x12, 0x21, 0x0a, 0x0c, 0x0a, 0x05, 0x06, 0x00, 0x02, 0x01, 0x03, 0x12, 0x03, 0x16, 91 | 0x2c, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 92 | ]; 93 | include!("auth.serde.rs"); 94 | include!("auth.tonic.rs"); 95 | // @@protoc_insertion_point(module) -------------------------------------------------------------------------------- /gen/src/auth.serde.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | impl serde::Serialize for LoginRequest { 3 | #[allow(deprecated)] 4 | fn serialize(&self, serializer: S) -> std::result::Result 5 | where 6 | S: serde::Serializer, 7 | { 8 | use serde::ser::SerializeStruct; 9 | let mut len = 0; 10 | if !self.email.is_empty() { 11 | len += 1; 12 | } 13 | if !self.password.is_empty() { 14 | len += 1; 15 | } 16 | let mut struct_ser = serializer.serialize_struct("auth.LoginRequest", len)?; 17 | if !self.email.is_empty() { 18 | struct_ser.serialize_field("email", &self.email)?; 19 | } 20 | if !self.password.is_empty() { 21 | struct_ser.serialize_field("password", &self.password)?; 22 | } 23 | struct_ser.end() 24 | } 25 | } 26 | impl<'de> serde::Deserialize<'de> for LoginRequest { 27 | #[allow(deprecated)] 28 | fn deserialize(deserializer: D) -> std::result::Result 29 | where 30 | D: serde::Deserializer<'de>, 31 | { 32 | const FIELDS: &[&str] = &[ 33 | "email", 34 | "password", 35 | ]; 36 | 37 | #[allow(clippy::enum_variant_names)] 38 | enum GeneratedField { 39 | Email, 40 | Password, 41 | } 42 | impl<'de> serde::Deserialize<'de> for GeneratedField { 43 | fn deserialize(deserializer: D) -> std::result::Result 44 | where 45 | D: serde::Deserializer<'de>, 46 | { 47 | struct GeneratedVisitor; 48 | 49 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 50 | type Value = GeneratedField; 51 | 52 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 53 | write!(formatter, "expected one of: {:?}", &FIELDS) 54 | } 55 | 56 | #[allow(unused_variables)] 57 | fn visit_str(self, value: &str) -> std::result::Result 58 | where 59 | E: serde::de::Error, 60 | { 61 | match value { 62 | "email" => Ok(GeneratedField::Email), 63 | "password" => Ok(GeneratedField::Password), 64 | _ => Err(serde::de::Error::unknown_field(value, FIELDS)), 65 | } 66 | } 67 | } 68 | deserializer.deserialize_identifier(GeneratedVisitor) 69 | } 70 | } 71 | struct GeneratedVisitor; 72 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 73 | type Value = LoginRequest; 74 | 75 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 76 | formatter.write_str("struct auth.LoginRequest") 77 | } 78 | 79 | fn visit_map(self, mut map: V) -> std::result::Result 80 | where 81 | V: serde::de::MapAccess<'de>, 82 | { 83 | let mut email__ = None; 84 | let mut password__ = None; 85 | while let Some(k) = map.next_key()? { 86 | match k { 87 | GeneratedField::Email => { 88 | if email__.is_some() { 89 | return Err(serde::de::Error::duplicate_field("email")); 90 | } 91 | email__ = Some(map.next_value()?); 92 | } 93 | GeneratedField::Password => { 94 | if password__.is_some() { 95 | return Err(serde::de::Error::duplicate_field("password")); 96 | } 97 | password__ = Some(map.next_value()?); 98 | } 99 | } 100 | } 101 | Ok(LoginRequest { 102 | email: email__.unwrap_or_default(), 103 | password: password__.unwrap_or_default(), 104 | }) 105 | } 106 | } 107 | deserializer.deserialize_struct("auth.LoginRequest", FIELDS, GeneratedVisitor) 108 | } 109 | } 110 | impl serde::Serialize for RegisterRequest { 111 | #[allow(deprecated)] 112 | fn serialize(&self, serializer: S) -> std::result::Result 113 | where 114 | S: serde::Serializer, 115 | { 116 | use serde::ser::SerializeStruct; 117 | let mut len = 0; 118 | if !self.firstname.is_empty() { 119 | len += 1; 120 | } 121 | if !self.lastname.is_empty() { 122 | len += 1; 123 | } 124 | if !self.email.is_empty() { 125 | len += 1; 126 | } 127 | if !self.password.is_empty() { 128 | len += 1; 129 | } 130 | let mut struct_ser = serializer.serialize_struct("auth.RegisterRequest", len)?; 131 | if !self.firstname.is_empty() { 132 | struct_ser.serialize_field("firstname", &self.firstname)?; 133 | } 134 | if !self.lastname.is_empty() { 135 | struct_ser.serialize_field("lastname", &self.lastname)?; 136 | } 137 | if !self.email.is_empty() { 138 | struct_ser.serialize_field("email", &self.email)?; 139 | } 140 | if !self.password.is_empty() { 141 | struct_ser.serialize_field("password", &self.password)?; 142 | } 143 | struct_ser.end() 144 | } 145 | } 146 | impl<'de> serde::Deserialize<'de> for RegisterRequest { 147 | #[allow(deprecated)] 148 | fn deserialize(deserializer: D) -> std::result::Result 149 | where 150 | D: serde::Deserializer<'de>, 151 | { 152 | const FIELDS: &[&str] = &[ 153 | "firstname", 154 | "lastname", 155 | "email", 156 | "password", 157 | ]; 158 | 159 | #[allow(clippy::enum_variant_names)] 160 | enum GeneratedField { 161 | Firstname, 162 | Lastname, 163 | Email, 164 | Password, 165 | } 166 | impl<'de> serde::Deserialize<'de> for GeneratedField { 167 | fn deserialize(deserializer: D) -> std::result::Result 168 | where 169 | D: serde::Deserializer<'de>, 170 | { 171 | struct GeneratedVisitor; 172 | 173 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 174 | type Value = GeneratedField; 175 | 176 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 177 | write!(formatter, "expected one of: {:?}", &FIELDS) 178 | } 179 | 180 | #[allow(unused_variables)] 181 | fn visit_str(self, value: &str) -> std::result::Result 182 | where 183 | E: serde::de::Error, 184 | { 185 | match value { 186 | "firstname" => Ok(GeneratedField::Firstname), 187 | "lastname" => Ok(GeneratedField::Lastname), 188 | "email" => Ok(GeneratedField::Email), 189 | "password" => Ok(GeneratedField::Password), 190 | _ => Err(serde::de::Error::unknown_field(value, FIELDS)), 191 | } 192 | } 193 | } 194 | deserializer.deserialize_identifier(GeneratedVisitor) 195 | } 196 | } 197 | struct GeneratedVisitor; 198 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 199 | type Value = RegisterRequest; 200 | 201 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 202 | formatter.write_str("struct auth.RegisterRequest") 203 | } 204 | 205 | fn visit_map(self, mut map: V) -> std::result::Result 206 | where 207 | V: serde::de::MapAccess<'de>, 208 | { 209 | let mut firstname__ = None; 210 | let mut lastname__ = None; 211 | let mut email__ = None; 212 | let mut password__ = None; 213 | while let Some(k) = map.next_key()? { 214 | match k { 215 | GeneratedField::Firstname => { 216 | if firstname__.is_some() { 217 | return Err(serde::de::Error::duplicate_field("firstname")); 218 | } 219 | firstname__ = Some(map.next_value()?); 220 | } 221 | GeneratedField::Lastname => { 222 | if lastname__.is_some() { 223 | return Err(serde::de::Error::duplicate_field("lastname")); 224 | } 225 | lastname__ = Some(map.next_value()?); 226 | } 227 | GeneratedField::Email => { 228 | if email__.is_some() { 229 | return Err(serde::de::Error::duplicate_field("email")); 230 | } 231 | email__ = Some(map.next_value()?); 232 | } 233 | GeneratedField::Password => { 234 | if password__.is_some() { 235 | return Err(serde::de::Error::duplicate_field("password")); 236 | } 237 | password__ = Some(map.next_value()?); 238 | } 239 | } 240 | } 241 | Ok(RegisterRequest { 242 | firstname: firstname__.unwrap_or_default(), 243 | lastname: lastname__.unwrap_or_default(), 244 | email: email__.unwrap_or_default(), 245 | password: password__.unwrap_or_default(), 246 | }) 247 | } 248 | } 249 | deserializer.deserialize_struct("auth.RegisterRequest", FIELDS, GeneratedVisitor) 250 | } 251 | } 252 | impl serde::Serialize for Token { 253 | #[allow(deprecated)] 254 | fn serialize(&self, serializer: S) -> std::result::Result 255 | where 256 | S: serde::Serializer, 257 | { 258 | use serde::ser::SerializeStruct; 259 | let mut len = 0; 260 | if !self.access_token.is_empty() { 261 | len += 1; 262 | } 263 | let mut struct_ser = serializer.serialize_struct("auth.Token", len)?; 264 | if !self.access_token.is_empty() { 265 | struct_ser.serialize_field("accessToken", &self.access_token)?; 266 | } 267 | struct_ser.end() 268 | } 269 | } 270 | impl<'de> serde::Deserialize<'de> for Token { 271 | #[allow(deprecated)] 272 | fn deserialize(deserializer: D) -> std::result::Result 273 | where 274 | D: serde::Deserializer<'de>, 275 | { 276 | const FIELDS: &[&str] = &[ 277 | "access_token", 278 | "accessToken", 279 | ]; 280 | 281 | #[allow(clippy::enum_variant_names)] 282 | enum GeneratedField { 283 | AccessToken, 284 | } 285 | impl<'de> serde::Deserialize<'de> for GeneratedField { 286 | fn deserialize(deserializer: D) -> std::result::Result 287 | where 288 | D: serde::Deserializer<'de>, 289 | { 290 | struct GeneratedVisitor; 291 | 292 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 293 | type Value = GeneratedField; 294 | 295 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 296 | write!(formatter, "expected one of: {:?}", &FIELDS) 297 | } 298 | 299 | #[allow(unused_variables)] 300 | fn visit_str(self, value: &str) -> std::result::Result 301 | where 302 | E: serde::de::Error, 303 | { 304 | match value { 305 | "accessToken" | "access_token" => Ok(GeneratedField::AccessToken), 306 | _ => Err(serde::de::Error::unknown_field(value, FIELDS)), 307 | } 308 | } 309 | } 310 | deserializer.deserialize_identifier(GeneratedVisitor) 311 | } 312 | } 313 | struct GeneratedVisitor; 314 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 315 | type Value = Token; 316 | 317 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 318 | formatter.write_str("struct auth.Token") 319 | } 320 | 321 | fn visit_map(self, mut map: V) -> std::result::Result 322 | where 323 | V: serde::de::MapAccess<'de>, 324 | { 325 | let mut access_token__ = None; 326 | while let Some(k) = map.next_key()? { 327 | match k { 328 | GeneratedField::AccessToken => { 329 | if access_token__.is_some() { 330 | return Err(serde::de::Error::duplicate_field("accessToken")); 331 | } 332 | access_token__ = Some(map.next_value()?); 333 | } 334 | } 335 | } 336 | Ok(Token { 337 | access_token: access_token__.unwrap_or_default(), 338 | }) 339 | } 340 | } 341 | deserializer.deserialize_struct("auth.Token", FIELDS, GeneratedVisitor) 342 | } 343 | } 344 | -------------------------------------------------------------------------------- /gen/src/auth.tonic.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | /// Generated client implementations. 3 | pub mod auth_client { 4 | #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] 5 | use tonic::codegen::*; 6 | use tonic::codegen::http::Uri; 7 | /// 8 | #[derive(Debug, Clone)] 9 | pub struct AuthClient { 10 | inner: tonic::client::Grpc, 11 | } 12 | impl AuthClient { 13 | /// Attempt to create a new client by connecting to a given endpoint. 14 | pub async fn connect(dst: D) -> Result 15 | where 16 | D: TryInto, 17 | D::Error: Into, 18 | { 19 | let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; 20 | Ok(Self::new(conn)) 21 | } 22 | } 23 | impl AuthClient 24 | where 25 | T: tonic::client::GrpcService, 26 | T::Error: Into, 27 | T::ResponseBody: Body + Send + 'static, 28 | ::Error: Into + Send, 29 | { 30 | pub fn new(inner: T) -> Self { 31 | let inner = tonic::client::Grpc::new(inner); 32 | Self { inner } 33 | } 34 | pub fn with_origin(inner: T, origin: Uri) -> Self { 35 | let inner = tonic::client::Grpc::with_origin(inner, origin); 36 | Self { inner } 37 | } 38 | pub fn with_interceptor( 39 | inner: T, 40 | interceptor: F, 41 | ) -> AuthClient> 42 | where 43 | F: tonic::service::Interceptor, 44 | T::ResponseBody: Default, 45 | T: tonic::codegen::Service< 46 | http::Request, 47 | Response = http::Response< 48 | >::ResponseBody, 49 | >, 50 | >, 51 | , 53 | >>::Error: Into + Send + Sync, 54 | { 55 | AuthClient::new(InterceptedService::new(inner, interceptor)) 56 | } 57 | /// Compress requests with the given encoding. 58 | /// 59 | /// This requires the server to support it otherwise it might respond with an 60 | /// error. 61 | #[must_use] 62 | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { 63 | self.inner = self.inner.send_compressed(encoding); 64 | self 65 | } 66 | /// Enable decompressing responses. 67 | #[must_use] 68 | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { 69 | self.inner = self.inner.accept_compressed(encoding); 70 | self 71 | } 72 | /// Limits the maximum size of a decoded message. 73 | /// 74 | /// Default: `4MB` 75 | #[must_use] 76 | pub fn max_decoding_message_size(mut self, limit: usize) -> Self { 77 | self.inner = self.inner.max_decoding_message_size(limit); 78 | self 79 | } 80 | /// Limits the maximum size of an encoded message. 81 | /// 82 | /// Default: `usize::MAX` 83 | #[must_use] 84 | pub fn max_encoding_message_size(mut self, limit: usize) -> Self { 85 | self.inner = self.inner.max_encoding_message_size(limit); 86 | self 87 | } 88 | /// 89 | pub async fn login( 90 | &mut self, 91 | request: impl tonic::IntoRequest, 92 | ) -> std::result::Result, tonic::Status> { 93 | self.inner 94 | .ready() 95 | .await 96 | .map_err(|e| { 97 | tonic::Status::new( 98 | tonic::Code::Unknown, 99 | format!("Service was not ready: {}", e.into()), 100 | ) 101 | })?; 102 | let codec = tonic::codec::ProstCodec::default(); 103 | let path = http::uri::PathAndQuery::from_static("/auth.Auth/Login"); 104 | let mut req = request.into_request(); 105 | req.extensions_mut().insert(GrpcMethod::new("auth.Auth", "Login")); 106 | self.inner.unary(req, path, codec).await 107 | } 108 | /// 109 | pub async fn register( 110 | &mut self, 111 | request: impl tonic::IntoRequest, 112 | ) -> std::result::Result, tonic::Status> { 113 | self.inner 114 | .ready() 115 | .await 116 | .map_err(|e| { 117 | tonic::Status::new( 118 | tonic::Code::Unknown, 119 | format!("Service was not ready: {}", e.into()), 120 | ) 121 | })?; 122 | let codec = tonic::codec::ProstCodec::default(); 123 | let path = http::uri::PathAndQuery::from_static("/auth.Auth/Register"); 124 | let mut req = request.into_request(); 125 | req.extensions_mut().insert(GrpcMethod::new("auth.Auth", "Register")); 126 | self.inner.unary(req, path, codec).await 127 | } 128 | } 129 | } 130 | /// Generated server implementations. 131 | pub mod auth_server { 132 | #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] 133 | use tonic::codegen::*; 134 | /// Generated trait containing gRPC methods that should be implemented for use with AuthServer. 135 | #[async_trait] 136 | pub trait Auth: Send + Sync + 'static { 137 | /// 138 | async fn login( 139 | &self, 140 | request: tonic::Request, 141 | ) -> std::result::Result, tonic::Status>; 142 | /// 143 | async fn register( 144 | &self, 145 | request: tonic::Request, 146 | ) -> std::result::Result, tonic::Status>; 147 | } 148 | /// 149 | #[derive(Debug)] 150 | pub struct AuthServer { 151 | inner: _Inner, 152 | accept_compression_encodings: EnabledCompressionEncodings, 153 | send_compression_encodings: EnabledCompressionEncodings, 154 | max_decoding_message_size: Option, 155 | max_encoding_message_size: Option, 156 | } 157 | struct _Inner(Arc); 158 | impl AuthServer { 159 | pub fn new(inner: T) -> Self { 160 | Self::from_arc(Arc::new(inner)) 161 | } 162 | pub fn from_arc(inner: Arc) -> Self { 163 | let inner = _Inner(inner); 164 | Self { 165 | inner, 166 | accept_compression_encodings: Default::default(), 167 | send_compression_encodings: Default::default(), 168 | max_decoding_message_size: None, 169 | max_encoding_message_size: None, 170 | } 171 | } 172 | pub fn with_interceptor( 173 | inner: T, 174 | interceptor: F, 175 | ) -> InterceptedService 176 | where 177 | F: tonic::service::Interceptor, 178 | { 179 | InterceptedService::new(Self::new(inner), interceptor) 180 | } 181 | /// Enable decompressing requests with the given encoding. 182 | #[must_use] 183 | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { 184 | self.accept_compression_encodings.enable(encoding); 185 | self 186 | } 187 | /// Compress responses with the given encoding, if the client supports it. 188 | #[must_use] 189 | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { 190 | self.send_compression_encodings.enable(encoding); 191 | self 192 | } 193 | /// Limits the maximum size of a decoded message. 194 | /// 195 | /// Default: `4MB` 196 | #[must_use] 197 | pub fn max_decoding_message_size(mut self, limit: usize) -> Self { 198 | self.max_decoding_message_size = Some(limit); 199 | self 200 | } 201 | /// Limits the maximum size of an encoded message. 202 | /// 203 | /// Default: `usize::MAX` 204 | #[must_use] 205 | pub fn max_encoding_message_size(mut self, limit: usize) -> Self { 206 | self.max_encoding_message_size = Some(limit); 207 | self 208 | } 209 | } 210 | impl tonic::codegen::Service> for AuthServer 211 | where 212 | T: Auth, 213 | B: Body + Send + 'static, 214 | B::Error: Into + Send + 'static, 215 | { 216 | type Response = http::Response; 217 | type Error = std::convert::Infallible; 218 | type Future = BoxFuture; 219 | fn poll_ready( 220 | &mut self, 221 | _cx: &mut Context<'_>, 222 | ) -> Poll> { 223 | Poll::Ready(Ok(())) 224 | } 225 | fn call(&mut self, req: http::Request) -> Self::Future { 226 | let inner = self.inner.clone(); 227 | match req.uri().path() { 228 | "/auth.Auth/Login" => { 229 | #[allow(non_camel_case_types)] 230 | struct LoginSvc(pub Arc); 231 | impl tonic::server::UnaryService 232 | for LoginSvc { 233 | type Response = super::Token; 234 | type Future = BoxFuture< 235 | tonic::Response, 236 | tonic::Status, 237 | >; 238 | fn call( 239 | &mut self, 240 | request: tonic::Request, 241 | ) -> Self::Future { 242 | let inner = Arc::clone(&self.0); 243 | let fut = async move { (*inner).login(request).await }; 244 | Box::pin(fut) 245 | } 246 | } 247 | let accept_compression_encodings = self.accept_compression_encodings; 248 | let send_compression_encodings = self.send_compression_encodings; 249 | let max_decoding_message_size = self.max_decoding_message_size; 250 | let max_encoding_message_size = self.max_encoding_message_size; 251 | let inner = self.inner.clone(); 252 | let fut = async move { 253 | let inner = inner.0; 254 | let method = LoginSvc(inner); 255 | let codec = tonic::codec::ProstCodec::default(); 256 | let mut grpc = tonic::server::Grpc::new(codec) 257 | .apply_compression_config( 258 | accept_compression_encodings, 259 | send_compression_encodings, 260 | ) 261 | .apply_max_message_size_config( 262 | max_decoding_message_size, 263 | max_encoding_message_size, 264 | ); 265 | let res = grpc.unary(method, req).await; 266 | Ok(res) 267 | }; 268 | Box::pin(fut) 269 | } 270 | "/auth.Auth/Register" => { 271 | #[allow(non_camel_case_types)] 272 | struct RegisterSvc(pub Arc); 273 | impl tonic::server::UnaryService 274 | for RegisterSvc { 275 | type Response = super::Token; 276 | type Future = BoxFuture< 277 | tonic::Response, 278 | tonic::Status, 279 | >; 280 | fn call( 281 | &mut self, 282 | request: tonic::Request, 283 | ) -> Self::Future { 284 | let inner = Arc::clone(&self.0); 285 | let fut = async move { (*inner).register(request).await }; 286 | Box::pin(fut) 287 | } 288 | } 289 | let accept_compression_encodings = self.accept_compression_encodings; 290 | let send_compression_encodings = self.send_compression_encodings; 291 | let max_decoding_message_size = self.max_decoding_message_size; 292 | let max_encoding_message_size = self.max_encoding_message_size; 293 | let inner = self.inner.clone(); 294 | let fut = async move { 295 | let inner = inner.0; 296 | let method = RegisterSvc(inner); 297 | let codec = tonic::codec::ProstCodec::default(); 298 | let mut grpc = tonic::server::Grpc::new(codec) 299 | .apply_compression_config( 300 | accept_compression_encodings, 301 | send_compression_encodings, 302 | ) 303 | .apply_max_message_size_config( 304 | max_decoding_message_size, 305 | max_encoding_message_size, 306 | ); 307 | let res = grpc.unary(method, req).await; 308 | Ok(res) 309 | }; 310 | Box::pin(fut) 311 | } 312 | _ => { 313 | Box::pin(async move { 314 | Ok( 315 | http::Response::builder() 316 | .status(200) 317 | .header("grpc-status", "12") 318 | .header("content-type", "application/grpc") 319 | .body(empty_body()) 320 | .unwrap(), 321 | ) 322 | }) 323 | } 324 | } 325 | } 326 | } 327 | impl Clone for AuthServer { 328 | fn clone(&self) -> Self { 329 | let inner = self.inner.clone(); 330 | Self { 331 | inner, 332 | accept_compression_encodings: self.accept_compression_encodings, 333 | send_compression_encodings: self.send_compression_encodings, 334 | max_decoding_message_size: self.max_decoding_message_size, 335 | max_encoding_message_size: self.max_encoding_message_size, 336 | } 337 | } 338 | } 339 | impl Clone for _Inner { 340 | fn clone(&self) -> Self { 341 | Self(Arc::clone(&self.0)) 342 | } 343 | } 344 | impl std::fmt::Debug for _Inner { 345 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 346 | write!(f, "{:?}", self.0) 347 | } 348 | } 349 | impl tonic::server::NamedService for AuthServer { 350 | const NAME: &'static str = "auth.Auth"; 351 | } 352 | } 353 | -------------------------------------------------------------------------------- /gen/src/greeting.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | #[allow(clippy::derive_partial_eq_without_eq)] 3 | #[derive(Clone, PartialEq, ::prost::Message)] 4 | pub struct GreetRequest { 5 | #[prost(string, tag="1")] 6 | pub message: ::prost::alloc::string::String, 7 | } 8 | #[allow(clippy::derive_partial_eq_without_eq)] 9 | #[derive(Clone, PartialEq, ::prost::Message)] 10 | pub struct GreetResponse { 11 | #[prost(string, tag="1")] 12 | pub message: ::prost::alloc::string::String, 13 | } 14 | /// Encoded file descriptor set for the `greeting` package 15 | pub const FILE_DESCRIPTOR_SET: &[u8] = &[ 16 | 0x0a, 0xc9, 0x03, 0x0a, 0x0e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x70, 0x72, 17 | 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x22, 0x28, 0x0a, 18 | 0x0c, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 19 | 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 20 | 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x29, 0x0a, 0x0d, 0x47, 0x72, 0x65, 0x65, 0x74, 21 | 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 22 | 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 23 | 0x67, 0x65, 0x32, 0x44, 0x0a, 0x08, 0x47, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x12, 0x38, 24 | 0x0a, 0x05, 0x47, 0x72, 0x65, 0x65, 0x74, 0x12, 0x16, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 25 | 0x6e, 0x67, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 26 | 0x17, 0x2e, 0x67, 0x72, 0x65, 0x65, 0x74, 0x69, 0x6e, 0x67, 0x2e, 0x47, 0x72, 0x65, 0x65, 0x74, 27 | 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4a, 0x89, 0x02, 0x0a, 0x06, 0x12, 0x04, 0x00, 28 | 0x00, 0x0e, 0x01, 0x0a, 0x08, 0x0a, 0x01, 0x0c, 0x12, 0x03, 0x00, 0x00, 0x12, 0x0a, 0x08, 0x0a, 29 | 0x01, 0x02, 0x12, 0x03, 0x02, 0x00, 0x11, 0x0a, 0x0a, 0x0a, 0x02, 0x04, 0x00, 0x12, 0x04, 0x04, 30 | 0x00, 0x06, 0x01, 0x0a, 0x0a, 0x0a, 0x03, 0x04, 0x00, 0x01, 0x12, 0x03, 0x04, 0x08, 0x14, 0x0a, 31 | 0x0b, 0x0a, 0x04, 0x04, 0x00, 0x02, 0x00, 0x12, 0x03, 0x05, 0x04, 0x17, 0x0a, 0x0c, 0x0a, 0x05, 32 | 0x04, 0x00, 0x02, 0x00, 0x05, 0x12, 0x03, 0x05, 0x04, 0x0a, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 33 | 0x02, 0x00, 0x01, 0x12, 0x03, 0x05, 0x0b, 0x12, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x00, 0x02, 0x00, 34 | 0x03, 0x12, 0x03, 0x05, 0x15, 0x16, 0x0a, 0x0a, 0x0a, 0x02, 0x04, 0x01, 0x12, 0x04, 0x08, 0x00, 35 | 0x0a, 0x01, 0x0a, 0x0a, 0x0a, 0x03, 0x04, 0x01, 0x01, 0x12, 0x03, 0x08, 0x08, 0x15, 0x0a, 0x0b, 36 | 0x0a, 0x04, 0x04, 0x01, 0x02, 0x00, 0x12, 0x03, 0x09, 0x04, 0x17, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 37 | 0x01, 0x02, 0x00, 0x05, 0x12, 0x03, 0x09, 0x04, 0x0a, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 38 | 0x00, 0x01, 0x12, 0x03, 0x09, 0x0b, 0x12, 0x0a, 0x0c, 0x0a, 0x05, 0x04, 0x01, 0x02, 0x00, 0x03, 39 | 0x12, 0x03, 0x09, 0x15, 0x16, 0x0a, 0x0a, 0x0a, 0x02, 0x06, 0x00, 0x12, 0x04, 0x0c, 0x00, 0x0e, 40 | 0x01, 0x0a, 0x0a, 0x0a, 0x03, 0x06, 0x00, 0x01, 0x12, 0x03, 0x0c, 0x08, 0x10, 0x0a, 0x0b, 0x0a, 41 | 0x04, 0x06, 0x00, 0x02, 0x00, 0x12, 0x03, 0x0d, 0x04, 0x35, 0x0a, 0x0c, 0x0a, 0x05, 0x06, 0x00, 42 | 0x02, 0x00, 0x01, 0x12, 0x03, 0x0d, 0x08, 0x0d, 0x0a, 0x0c, 0x0a, 0x05, 0x06, 0x00, 0x02, 0x00, 43 | 0x02, 0x12, 0x03, 0x0d, 0x0f, 0x1b, 0x0a, 0x0c, 0x0a, 0x05, 0x06, 0x00, 0x02, 0x00, 0x03, 0x12, 44 | 0x03, 0x0d, 0x26, 0x33, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, 45 | ]; 46 | include!("greeting.serde.rs"); 47 | include!("greeting.tonic.rs"); 48 | // @@protoc_insertion_point(module) -------------------------------------------------------------------------------- /gen/src/greeting.serde.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | impl serde::Serialize for GreetRequest { 3 | #[allow(deprecated)] 4 | fn serialize(&self, serializer: S) -> std::result::Result 5 | where 6 | S: serde::Serializer, 7 | { 8 | use serde::ser::SerializeStruct; 9 | let mut len = 0; 10 | if !self.message.is_empty() { 11 | len += 1; 12 | } 13 | let mut struct_ser = serializer.serialize_struct("greeting.GreetRequest", len)?; 14 | if !self.message.is_empty() { 15 | struct_ser.serialize_field("message", &self.message)?; 16 | } 17 | struct_ser.end() 18 | } 19 | } 20 | impl<'de> serde::Deserialize<'de> for GreetRequest { 21 | #[allow(deprecated)] 22 | fn deserialize(deserializer: D) -> std::result::Result 23 | where 24 | D: serde::Deserializer<'de>, 25 | { 26 | const FIELDS: &[&str] = &[ 27 | "message", 28 | ]; 29 | 30 | #[allow(clippy::enum_variant_names)] 31 | enum GeneratedField { 32 | Message, 33 | } 34 | impl<'de> serde::Deserialize<'de> for GeneratedField { 35 | fn deserialize(deserializer: D) -> std::result::Result 36 | where 37 | D: serde::Deserializer<'de>, 38 | { 39 | struct GeneratedVisitor; 40 | 41 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 42 | type Value = GeneratedField; 43 | 44 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 45 | write!(formatter, "expected one of: {:?}", &FIELDS) 46 | } 47 | 48 | #[allow(unused_variables)] 49 | fn visit_str(self, value: &str) -> std::result::Result 50 | where 51 | E: serde::de::Error, 52 | { 53 | match value { 54 | "message" => Ok(GeneratedField::Message), 55 | _ => Err(serde::de::Error::unknown_field(value, FIELDS)), 56 | } 57 | } 58 | } 59 | deserializer.deserialize_identifier(GeneratedVisitor) 60 | } 61 | } 62 | struct GeneratedVisitor; 63 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 64 | type Value = GreetRequest; 65 | 66 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 67 | formatter.write_str("struct greeting.GreetRequest") 68 | } 69 | 70 | fn visit_map(self, mut map: V) -> std::result::Result 71 | where 72 | V: serde::de::MapAccess<'de>, 73 | { 74 | let mut message__ = None; 75 | while let Some(k) = map.next_key()? { 76 | match k { 77 | GeneratedField::Message => { 78 | if message__.is_some() { 79 | return Err(serde::de::Error::duplicate_field("message")); 80 | } 81 | message__ = Some(map.next_value()?); 82 | } 83 | } 84 | } 85 | Ok(GreetRequest { 86 | message: message__.unwrap_or_default(), 87 | }) 88 | } 89 | } 90 | deserializer.deserialize_struct("greeting.GreetRequest", FIELDS, GeneratedVisitor) 91 | } 92 | } 93 | impl serde::Serialize for GreetResponse { 94 | #[allow(deprecated)] 95 | fn serialize(&self, serializer: S) -> std::result::Result 96 | where 97 | S: serde::Serializer, 98 | { 99 | use serde::ser::SerializeStruct; 100 | let mut len = 0; 101 | if !self.message.is_empty() { 102 | len += 1; 103 | } 104 | let mut struct_ser = serializer.serialize_struct("greeting.GreetResponse", len)?; 105 | if !self.message.is_empty() { 106 | struct_ser.serialize_field("message", &self.message)?; 107 | } 108 | struct_ser.end() 109 | } 110 | } 111 | impl<'de> serde::Deserialize<'de> for GreetResponse { 112 | #[allow(deprecated)] 113 | fn deserialize(deserializer: D) -> std::result::Result 114 | where 115 | D: serde::Deserializer<'de>, 116 | { 117 | const FIELDS: &[&str] = &[ 118 | "message", 119 | ]; 120 | 121 | #[allow(clippy::enum_variant_names)] 122 | enum GeneratedField { 123 | Message, 124 | } 125 | impl<'de> serde::Deserialize<'de> for GeneratedField { 126 | fn deserialize(deserializer: D) -> std::result::Result 127 | where 128 | D: serde::Deserializer<'de>, 129 | { 130 | struct GeneratedVisitor; 131 | 132 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 133 | type Value = GeneratedField; 134 | 135 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 136 | write!(formatter, "expected one of: {:?}", &FIELDS) 137 | } 138 | 139 | #[allow(unused_variables)] 140 | fn visit_str(self, value: &str) -> std::result::Result 141 | where 142 | E: serde::de::Error, 143 | { 144 | match value { 145 | "message" => Ok(GeneratedField::Message), 146 | _ => Err(serde::de::Error::unknown_field(value, FIELDS)), 147 | } 148 | } 149 | } 150 | deserializer.deserialize_identifier(GeneratedVisitor) 151 | } 152 | } 153 | struct GeneratedVisitor; 154 | impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { 155 | type Value = GreetResponse; 156 | 157 | fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 158 | formatter.write_str("struct greeting.GreetResponse") 159 | } 160 | 161 | fn visit_map(self, mut map: V) -> std::result::Result 162 | where 163 | V: serde::de::MapAccess<'de>, 164 | { 165 | let mut message__ = None; 166 | while let Some(k) = map.next_key()? { 167 | match k { 168 | GeneratedField::Message => { 169 | if message__.is_some() { 170 | return Err(serde::de::Error::duplicate_field("message")); 171 | } 172 | message__ = Some(map.next_value()?); 173 | } 174 | } 175 | } 176 | Ok(GreetResponse { 177 | message: message__.unwrap_or_default(), 178 | }) 179 | } 180 | } 181 | deserializer.deserialize_struct("greeting.GreetResponse", FIELDS, GeneratedVisitor) 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /gen/src/greeting.tonic.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | /// Generated client implementations. 3 | pub mod greeting_client { 4 | #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] 5 | use tonic::codegen::*; 6 | use tonic::codegen::http::Uri; 7 | /// 8 | #[derive(Debug, Clone)] 9 | pub struct GreetingClient { 10 | inner: tonic::client::Grpc, 11 | } 12 | impl GreetingClient { 13 | /// Attempt to create a new client by connecting to a given endpoint. 14 | pub async fn connect(dst: D) -> Result 15 | where 16 | D: TryInto, 17 | D::Error: Into, 18 | { 19 | let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; 20 | Ok(Self::new(conn)) 21 | } 22 | } 23 | impl GreetingClient 24 | where 25 | T: tonic::client::GrpcService, 26 | T::Error: Into, 27 | T::ResponseBody: Body + Send + 'static, 28 | ::Error: Into + Send, 29 | { 30 | pub fn new(inner: T) -> Self { 31 | let inner = tonic::client::Grpc::new(inner); 32 | Self { inner } 33 | } 34 | pub fn with_origin(inner: T, origin: Uri) -> Self { 35 | let inner = tonic::client::Grpc::with_origin(inner, origin); 36 | Self { inner } 37 | } 38 | pub fn with_interceptor( 39 | inner: T, 40 | interceptor: F, 41 | ) -> GreetingClient> 42 | where 43 | F: tonic::service::Interceptor, 44 | T::ResponseBody: Default, 45 | T: tonic::codegen::Service< 46 | http::Request, 47 | Response = http::Response< 48 | >::ResponseBody, 49 | >, 50 | >, 51 | , 53 | >>::Error: Into + Send + Sync, 54 | { 55 | GreetingClient::new(InterceptedService::new(inner, interceptor)) 56 | } 57 | /// Compress requests with the given encoding. 58 | /// 59 | /// This requires the server to support it otherwise it might respond with an 60 | /// error. 61 | #[must_use] 62 | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { 63 | self.inner = self.inner.send_compressed(encoding); 64 | self 65 | } 66 | /// Enable decompressing responses. 67 | #[must_use] 68 | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { 69 | self.inner = self.inner.accept_compressed(encoding); 70 | self 71 | } 72 | /// Limits the maximum size of a decoded message. 73 | /// 74 | /// Default: `4MB` 75 | #[must_use] 76 | pub fn max_decoding_message_size(mut self, limit: usize) -> Self { 77 | self.inner = self.inner.max_decoding_message_size(limit); 78 | self 79 | } 80 | /// Limits the maximum size of an encoded message. 81 | /// 82 | /// Default: `usize::MAX` 83 | #[must_use] 84 | pub fn max_encoding_message_size(mut self, limit: usize) -> Self { 85 | self.inner = self.inner.max_encoding_message_size(limit); 86 | self 87 | } 88 | /// 89 | pub async fn greet( 90 | &mut self, 91 | request: impl tonic::IntoRequest, 92 | ) -> std::result::Result, tonic::Status> { 93 | self.inner 94 | .ready() 95 | .await 96 | .map_err(|e| { 97 | tonic::Status::new( 98 | tonic::Code::Unknown, 99 | format!("Service was not ready: {}", e.into()), 100 | ) 101 | })?; 102 | let codec = tonic::codec::ProstCodec::default(); 103 | let path = http::uri::PathAndQuery::from_static("/greeting.Greeting/Greet"); 104 | let mut req = request.into_request(); 105 | req.extensions_mut().insert(GrpcMethod::new("greeting.Greeting", "Greet")); 106 | self.inner.unary(req, path, codec).await 107 | } 108 | } 109 | } 110 | /// Generated server implementations. 111 | pub mod greeting_server { 112 | #![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)] 113 | use tonic::codegen::*; 114 | /// Generated trait containing gRPC methods that should be implemented for use with GreetingServer. 115 | #[async_trait] 116 | pub trait Greeting: Send + Sync + 'static { 117 | /// 118 | async fn greet( 119 | &self, 120 | request: tonic::Request, 121 | ) -> std::result::Result, tonic::Status>; 122 | } 123 | /// 124 | #[derive(Debug)] 125 | pub struct GreetingServer { 126 | inner: _Inner, 127 | accept_compression_encodings: EnabledCompressionEncodings, 128 | send_compression_encodings: EnabledCompressionEncodings, 129 | max_decoding_message_size: Option, 130 | max_encoding_message_size: Option, 131 | } 132 | struct _Inner(Arc); 133 | impl GreetingServer { 134 | pub fn new(inner: T) -> Self { 135 | Self::from_arc(Arc::new(inner)) 136 | } 137 | pub fn from_arc(inner: Arc) -> Self { 138 | let inner = _Inner(inner); 139 | Self { 140 | inner, 141 | accept_compression_encodings: Default::default(), 142 | send_compression_encodings: Default::default(), 143 | max_decoding_message_size: None, 144 | max_encoding_message_size: None, 145 | } 146 | } 147 | pub fn with_interceptor( 148 | inner: T, 149 | interceptor: F, 150 | ) -> InterceptedService 151 | where 152 | F: tonic::service::Interceptor, 153 | { 154 | InterceptedService::new(Self::new(inner), interceptor) 155 | } 156 | /// Enable decompressing requests with the given encoding. 157 | #[must_use] 158 | pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { 159 | self.accept_compression_encodings.enable(encoding); 160 | self 161 | } 162 | /// Compress responses with the given encoding, if the client supports it. 163 | #[must_use] 164 | pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { 165 | self.send_compression_encodings.enable(encoding); 166 | self 167 | } 168 | /// Limits the maximum size of a decoded message. 169 | /// 170 | /// Default: `4MB` 171 | #[must_use] 172 | pub fn max_decoding_message_size(mut self, limit: usize) -> Self { 173 | self.max_decoding_message_size = Some(limit); 174 | self 175 | } 176 | /// Limits the maximum size of an encoded message. 177 | /// 178 | /// Default: `usize::MAX` 179 | #[must_use] 180 | pub fn max_encoding_message_size(mut self, limit: usize) -> Self { 181 | self.max_encoding_message_size = Some(limit); 182 | self 183 | } 184 | } 185 | impl tonic::codegen::Service> for GreetingServer 186 | where 187 | T: Greeting, 188 | B: Body + Send + 'static, 189 | B::Error: Into + Send + 'static, 190 | { 191 | type Response = http::Response; 192 | type Error = std::convert::Infallible; 193 | type Future = BoxFuture; 194 | fn poll_ready( 195 | &mut self, 196 | _cx: &mut Context<'_>, 197 | ) -> Poll> { 198 | Poll::Ready(Ok(())) 199 | } 200 | fn call(&mut self, req: http::Request) -> Self::Future { 201 | let inner = self.inner.clone(); 202 | match req.uri().path() { 203 | "/greeting.Greeting/Greet" => { 204 | #[allow(non_camel_case_types)] 205 | struct GreetSvc(pub Arc); 206 | impl tonic::server::UnaryService 207 | for GreetSvc { 208 | type Response = super::GreetResponse; 209 | type Future = BoxFuture< 210 | tonic::Response, 211 | tonic::Status, 212 | >; 213 | fn call( 214 | &mut self, 215 | request: tonic::Request, 216 | ) -> Self::Future { 217 | let inner = Arc::clone(&self.0); 218 | let fut = async move { (*inner).greet(request).await }; 219 | Box::pin(fut) 220 | } 221 | } 222 | let accept_compression_encodings = self.accept_compression_encodings; 223 | let send_compression_encodings = self.send_compression_encodings; 224 | let max_decoding_message_size = self.max_decoding_message_size; 225 | let max_encoding_message_size = self.max_encoding_message_size; 226 | let inner = self.inner.clone(); 227 | let fut = async move { 228 | let inner = inner.0; 229 | let method = GreetSvc(inner); 230 | let codec = tonic::codec::ProstCodec::default(); 231 | let mut grpc = tonic::server::Grpc::new(codec) 232 | .apply_compression_config( 233 | accept_compression_encodings, 234 | send_compression_encodings, 235 | ) 236 | .apply_max_message_size_config( 237 | max_decoding_message_size, 238 | max_encoding_message_size, 239 | ); 240 | let res = grpc.unary(method, req).await; 241 | Ok(res) 242 | }; 243 | Box::pin(fut) 244 | } 245 | _ => { 246 | Box::pin(async move { 247 | Ok( 248 | http::Response::builder() 249 | .status(200) 250 | .header("grpc-status", "12") 251 | .header("content-type", "application/grpc") 252 | .body(empty_body()) 253 | .unwrap(), 254 | ) 255 | }) 256 | } 257 | } 258 | } 259 | } 260 | impl Clone for GreetingServer { 261 | fn clone(&self) -> Self { 262 | let inner = self.inner.clone(); 263 | Self { 264 | inner, 265 | accept_compression_encodings: self.accept_compression_encodings, 266 | send_compression_encodings: self.send_compression_encodings, 267 | max_decoding_message_size: self.max_decoding_message_size, 268 | max_encoding_message_size: self.max_encoding_message_size, 269 | } 270 | } 271 | } 272 | impl Clone for _Inner { 273 | fn clone(&self) -> Self { 274 | Self(Arc::clone(&self.0)) 275 | } 276 | } 277 | impl std::fmt::Debug for _Inner { 278 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { 279 | write!(f, "{:?}", self.0) 280 | } 281 | } 282 | impl tonic::server::NamedService for GreetingServer { 283 | const NAME: &'static str = "greeting.Greeting"; 284 | } 285 | } 286 | -------------------------------------------------------------------------------- /gen/src/lib.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | #[cfg(feature = "auth")] 3 | // @@protoc_insertion_point(attribute:auth) 4 | pub mod auth { 5 | include!("auth.rs"); 6 | // @@protoc_insertion_point(auth) 7 | } 8 | #[cfg(feature = "greeting")] 9 | // @@protoc_insertion_point(attribute:greeting) 10 | pub mod greeting { 11 | include!("greeting.rs"); 12 | // @@protoc_insertion_point(greeting) 13 | } -------------------------------------------------------------------------------- /migrations/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kerwanp/rust-proto-demo/c9718bdf459f488a6ba9e74a375a51d314a61e8c/migrations/.keep -------------------------------------------------------------------------------- /migrations/00000000000000_diesel_initial_setup/down.sql: -------------------------------------------------------------------------------- 1 | -- This file was automatically created by Diesel to setup helper functions 2 | -- and other internal bookkeeping. This file is safe to edit, any future 3 | -- changes will be added to existing projects as new migrations. 4 | 5 | DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass); 6 | DROP FUNCTION IF EXISTS diesel_set_updated_at(); 7 | -------------------------------------------------------------------------------- /migrations/00000000000000_diesel_initial_setup/up.sql: -------------------------------------------------------------------------------- 1 | -- This file was automatically created by Diesel to setup helper functions 2 | -- and other internal bookkeeping. This file is safe to edit, any future 3 | -- changes will be added to existing projects as new migrations. 4 | 5 | 6 | 7 | 8 | -- Sets up a trigger for the given table to automatically set a column called 9 | -- `updated_at` whenever the row is modified (unless `updated_at` was included 10 | -- in the modified columns) 11 | -- 12 | -- # Example 13 | -- 14 | -- ```sql 15 | -- CREATE TABLE users (id SERIAL PRIMARY KEY, updated_at TIMESTAMP NOT NULL DEFAULT NOW()); 16 | -- 17 | -- SELECT diesel_manage_updated_at('users'); 18 | -- ``` 19 | CREATE OR REPLACE FUNCTION diesel_manage_updated_at(_tbl regclass) RETURNS VOID AS $$ 20 | BEGIN 21 | EXECUTE format('CREATE TRIGGER set_updated_at BEFORE UPDATE ON %s 22 | FOR EACH ROW EXECUTE PROCEDURE diesel_set_updated_at()', _tbl); 23 | END; 24 | $$ LANGUAGE plpgsql; 25 | 26 | CREATE OR REPLACE FUNCTION diesel_set_updated_at() RETURNS trigger AS $$ 27 | BEGIN 28 | IF ( 29 | NEW IS DISTINCT FROM OLD AND 30 | NEW.updated_at IS NOT DISTINCT FROM OLD.updated_at 31 | ) THEN 32 | NEW.updated_at := current_timestamp; 33 | END IF; 34 | RETURN NEW; 35 | END; 36 | $$ LANGUAGE plpgsql; 37 | -------------------------------------------------------------------------------- /migrations/2023-10-28-124138_create_users/down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE users; 2 | -------------------------------------------------------------------------------- /migrations/2023-10-28-124138_create_users/up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE users ( 2 | id SERIAL PRIMARY KEY, 3 | email VARCHAR(255) UNIQUE NOT NULL, 4 | password VARCHAR(255) NOT NULL, 5 | firstname VARCHAR(255) NOT NULL, 6 | lastname VARCHAR(255) NOT NULL 7 | ); -------------------------------------------------------------------------------- /proto/auth.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package auth; 4 | 5 | message LoginRequest { 6 | string email = 1; 7 | string password = 2; 8 | } 9 | 10 | message RegisterRequest { 11 | string firstname = 1; 12 | string lastname = 2; 13 | string email = 3; 14 | string password = 4; 15 | } 16 | 17 | message Token { 18 | string access_token = 1; 19 | } 20 | 21 | service Auth { 22 | rpc Login (LoginRequest) returns (Token); 23 | rpc Register (RegisterRequest) returns (Token); 24 | } -------------------------------------------------------------------------------- /proto/buf.yaml: -------------------------------------------------------------------------------- 1 | version: v1 -------------------------------------------------------------------------------- /proto/greeting.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package greeting; 4 | 5 | message GreetRequest { 6 | string message = 1; 7 | } 8 | 9 | message GreetResponse { 10 | string message = 1; 11 | } 12 | 13 | service Greeting { 14 | rpc Greet (GreetRequest) returns (GreetResponse); 15 | } -------------------------------------------------------------------------------- /src/auth.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | collections::{BTreeMap, HashMap}, 3 | env, 4 | sync::{Arc, Mutex}, 5 | time::{SystemTime, UNIX_EPOCH}, 6 | }; 7 | 8 | use bcrypt::verify; 9 | use diesel::PgConnection; 10 | use hmac::{Hmac, Mac}; 11 | use jwt::{SignWithKey, VerifyWithKey}; 12 | use protos::auth::{auth_server::Auth, LoginRequest, RegisterRequest, Token}; 13 | use sha2::Sha256; 14 | use tonic::{Request, Response, Status}; 15 | 16 | use crate::models::{NewUser, User}; 17 | 18 | pub struct Service { 19 | database: Arc>, 20 | } 21 | 22 | impl Service { 23 | pub fn new(database: PgConnection) -> Self { 24 | Self { 25 | database: Arc::new(Mutex::new(database)), 26 | } 27 | } 28 | } 29 | 30 | #[tonic::async_trait] 31 | impl Auth for Service { 32 | async fn login(&self, request: Request) -> Result, Status> { 33 | let data = request.into_inner(); 34 | 35 | let database = self.database.lock(); 36 | 37 | let user = User::find_by_email(&mut database.unwrap(), &data.email) 38 | .ok_or(Status::unauthenticated("Invalid email or password"))?; 39 | 40 | match verify(data.password, &user.password) { 41 | Ok(true) => (), 42 | Ok(false) | Err(_) => return Err(Status::unauthenticated("Invalid email or password")), 43 | }; 44 | 45 | let reply = generate_token(user) 46 | .map_err(|_| Status::unauthenticated("Invalid email or password"))?; 47 | 48 | Ok(Response::new(reply)) 49 | } 50 | 51 | async fn register(&self, request: Request) -> Result, Status> { 52 | let database = self.database.lock(); 53 | let data = request.into_inner(); 54 | 55 | let password = bcrypt::hash(&data.password, 10) 56 | .map_err(|_| Status::unknown("Error while creating the user"))?; 57 | 58 | let user = NewUser { 59 | firstname: &data.firstname, 60 | lastname: &data.lastname, 61 | email: &data.email, 62 | password: &password, 63 | }; 64 | 65 | let user = User::create(&mut database.unwrap(), user) 66 | .map_err(|_| Status::already_exists("User already exists in the database"))?; 67 | 68 | let token = generate_token(user) 69 | .map_err(|_| Status::unknown("Cannot generate a token for the User"))?; 70 | 71 | Ok(Response::new(token)) 72 | } 73 | } 74 | 75 | struct GenerateClaimsError; 76 | 77 | fn generate_claims(user: User) -> Result, GenerateClaimsError> { 78 | let mut claims: BTreeMap<&str, String> = BTreeMap::new(); 79 | 80 | claims.insert("sub", user.id.to_string()); 81 | 82 | let current_timestamp = SystemTime::now() 83 | .duration_since(UNIX_EPOCH) 84 | .map_err(|_| GenerateClaimsError)? 85 | .as_secs(); 86 | 87 | claims.insert("iat", current_timestamp.to_string()); 88 | claims.insert("exp", String::from("3600")); 89 | 90 | Ok(claims) 91 | } 92 | struct GenerateTokenError; 93 | 94 | fn generate_token(user: User) -> Result { 95 | let app_key: String = env::var("APP_KEY").expect("env APP_KEY is not defined"); 96 | let key: Hmac = 97 | Hmac::new_from_slice(app_key.as_bytes()).map_err(|_| GenerateTokenError)?; 98 | let claims = generate_claims(user).map_err(|_| GenerateTokenError)?; 99 | 100 | let access_token = claims.sign_with_key(&key).map_err(|_| GenerateTokenError)?; 101 | 102 | Ok(Token { 103 | access_token: access_token, 104 | }) 105 | } 106 | 107 | pub struct VerifyTokenError; 108 | 109 | pub fn verify_token(token: &str) -> Result { 110 | let app_key: String = env::var("APP_KEY").expect("env APP_KEY is not defined"); 111 | 112 | let key: Hmac = 113 | Hmac::new_from_slice(app_key.as_bytes()).map_err(|_| VerifyTokenError)?; 114 | 115 | Ok(token 116 | .verify_with_key(&key) 117 | .map(|_: HashMap| true) 118 | .unwrap_or(false)) 119 | } 120 | -------------------------------------------------------------------------------- /src/greeting.rs: -------------------------------------------------------------------------------- 1 | use protos::greeting::{greeting_server::Greeting, GreetRequest, GreetResponse}; 2 | use tonic::{Request, Response, Status}; 3 | 4 | use crate::auth; 5 | 6 | #[derive(Default)] 7 | pub struct Service {} 8 | 9 | #[tonic::async_trait] 10 | impl Greeting for Service { 11 | async fn greet( 12 | &self, 13 | request: Request, 14 | ) -> Result, Status> { 15 | let token = request 16 | .metadata() 17 | .get("x-authorization") 18 | .ok_or(Status::unauthenticated("No access token specified"))? 19 | .to_str() 20 | .map_err(|_| Status::unauthenticated("No access token specified"))?; 21 | 22 | match auth::verify_token(token) { 23 | Ok(true) => (), 24 | Err(_) | Ok(false) => return Err(Status::unauthenticated("Invalid token")), 25 | } 26 | 27 | let data = request.into_inner(); 28 | 29 | Ok(Response::new(GreetResponse { 30 | message: format!("{} {}", data.message, "Pong!"), 31 | })) 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | use diesel::{Connection, PgConnection}; 4 | use dotenvy::dotenv; 5 | use protos::{auth::auth_server::AuthServer, greeting::greeting_server::GreetingServer}; 6 | use tonic::transport::Server; 7 | 8 | mod auth; 9 | mod greeting; 10 | mod models; 11 | mod schema; 12 | 13 | pub fn connect_db() -> PgConnection { 14 | let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); 15 | PgConnection::establish(&database_url) 16 | .unwrap_or_else(|_| panic!("Error connecting to {}", database_url)) 17 | } 18 | 19 | #[tokio::main] 20 | async fn main() -> Result<(), Box> { 21 | dotenv().ok(); 22 | 23 | let database = connect_db(); 24 | let addr = "[::1]:50051".parse()?; 25 | 26 | Server::builder() 27 | .add_service(AuthServer::new(auth::Service::new(database))) 28 | .add_service(GreetingServer::new(greeting::Service::default())) 29 | .serve(addr) 30 | .await?; 31 | 32 | Ok(()) 33 | } 34 | -------------------------------------------------------------------------------- /src/models.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashMap; 2 | 3 | use diesel::{ 4 | ExpressionMethods, Insertable, PgConnection, QueryDsl, Queryable, RunQueryDsl, Selectable, 5 | SelectableHelper, 6 | }; 7 | 8 | use crate::schema::users; 9 | 10 | #[derive(Queryable, Selectable)] 11 | #[diesel(table_name = users)] 12 | #[diesel(check_for_backend(diesel::pg::Pg))] 13 | pub struct User { 14 | pub id: i32, 15 | pub firstname: String, 16 | pub lastname: String, 17 | pub email: String, 18 | pub password: String, 19 | } 20 | 21 | #[derive(Insertable)] 22 | #[diesel(table_name = users)] 23 | pub struct NewUser<'a> { 24 | pub firstname: &'a str, 25 | pub lastname: &'a str, 26 | pub email: &'a str, 27 | pub password: &'a str, 28 | } 29 | 30 | impl User { 31 | pub fn create( 32 | conn: &mut PgConnection, 33 | user: NewUser, 34 | ) -> Result { 35 | diesel::insert_into(users::table) 36 | .values(user) 37 | .returning(User::as_returning()) 38 | .get_result(conn) 39 | } 40 | 41 | pub fn find_by_email(conn: &mut PgConnection, email: &str) -> Option { 42 | users::dsl::users 43 | .select(User::as_select()) 44 | .filter(users::dsl::email.eq(email)) 45 | .first(conn) 46 | .ok() 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/schema.rs: -------------------------------------------------------------------------------- 1 | // @generated automatically by Diesel CLI. 2 | 3 | diesel::table! { 4 | users (id) { 5 | id -> Int4, 6 | #[max_length = 255] 7 | email -> Varchar, 8 | #[max_length = 255] 9 | password -> Varchar, 10 | #[max_length = 255] 11 | firstname -> Varchar, 12 | #[max_length = 255] 13 | lastname -> Varchar, 14 | } 15 | } 16 | --------------------------------------------------------------------------------