Constellation, Spacedust, Slingshot, UFOs: atproto crates and services for microcosm

who-am-i sketch: oauth working-ish

+706 -20
Cargo.lock
··· 174 174 ] 175 175 176 176 [[package]] 177 + name = "async-compression" 178 + version = "0.4.25" 179 + source = "registry+https://github.com/rust-lang/crates.io-index" 180 + checksum = "40f6024f3f856663b45fd0c9b6f2024034a702f453549449e0d84a305900dad4" 181 + dependencies = [ 182 + "flate2", 183 + "futures-core", 184 + "memchr", 185 + "pin-project-lite", 186 + "tokio", 187 + ] 188 + 189 + [[package]] 177 190 name = "async-lock" 178 191 version = "3.4.0" 179 192 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 228 241 version = "0.25.3" 229 242 source = "git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits#c4364f318d337bbc3e3e3aaf97c9f971e95f5f7e" 230 243 dependencies = [ 231 - "atrium-common", 232 - "atrium-xrpc", 244 + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits)", 245 + "atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits)", 233 246 "chrono", 234 247 "http", 235 248 "ipld-core", ··· 243 256 ] 244 257 245 258 [[package]] 259 + name = "atrium-api" 260 + version = "0.25.4" 261 + source = "registry+https://github.com/rust-lang/crates.io-index" 262 + checksum = "46355d3245edc7b3160b2a45fe55d09a6963ebd3eee0252feb6b72fb0eb71463" 263 + dependencies = [ 264 + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 265 + "atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 266 + "chrono", 267 + "http", 268 + "ipld-core", 269 + "langtag", 270 + "regex", 271 + "serde", 272 + "serde_bytes", 273 + "serde_json", 274 + "thiserror 1.0.69", 275 + "tokio", 276 + "trait-variant", 277 + ] 278 + 279 + [[package]] 280 + name = "atrium-common" 281 + version = "0.1.2" 282 + source = "registry+https://github.com/rust-lang/crates.io-index" 283 + checksum = "9ed5610654043faa396a5a15afac0ac646d76aebe45aebd7cef4f8b96b0ab7f4" 284 + dependencies = [ 285 + "dashmap", 286 + "lru", 287 + "moka", 288 + "thiserror 1.0.69", 289 + "tokio", 290 + "trait-variant", 291 + "web-time", 292 + ] 293 + 294 + [[package]] 246 295 name = "atrium-common" 247 296 version = "0.1.2" 248 297 source = "git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits#c4364f318d337bbc3e3e3aaf97c9f971e95f5f7e" ··· 257 306 ] 258 307 259 308 [[package]] 309 + name = "atrium-identity" 310 + version = "0.1.5" 311 + source = "registry+https://github.com/rust-lang/crates.io-index" 312 + checksum = "c9e2d42bb4dbea038f4f5f45e3af2a89d61a9894a75f06aa550b74a60d2be380" 313 + dependencies = [ 314 + "atrium-api 0.25.4", 315 + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 316 + "atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 317 + "serde", 318 + "serde_html_form", 319 + "serde_json", 320 + "thiserror 1.0.69", 321 + "trait-variant", 322 + ] 323 + 324 + [[package]] 325 + name = "atrium-oauth" 326 + version = "0.1.3" 327 + source = "registry+https://github.com/rust-lang/crates.io-index" 328 + checksum = "ca22dc4eaf77fd9bf050b21192ac58cd654a437d28e000ec114ebd93a51d36f5" 329 + dependencies = [ 330 + "atrium-api 0.25.4", 331 + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 332 + "atrium-identity", 333 + "atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 334 + "base64 0.22.1", 335 + "chrono", 336 + "dashmap", 337 + "ecdsa", 338 + "elliptic-curve", 339 + "jose-jwa", 340 + "jose-jwk", 341 + "p256", 342 + "rand 0.8.5", 343 + "reqwest", 344 + "serde", 345 + "serde_html_form", 346 + "serde_json", 347 + "sha2", 348 + "thiserror 1.0.69", 349 + "tokio", 350 + "trait-variant", 351 + ] 352 + 353 + [[package]] 354 + name = "atrium-xrpc" 355 + version = "0.12.3" 356 + source = "registry+https://github.com/rust-lang/crates.io-index" 357 + checksum = "0216ad50ce34e9ff982e171c3659e65dedaa2ed5ac2994524debdc9a9647ffa8" 358 + dependencies = [ 359 + "http", 360 + "serde", 361 + "serde_html_form", 362 + "serde_json", 363 + "thiserror 1.0.69", 364 + "trait-variant", 365 + ] 366 + 367 + [[package]] 260 368 name = "atrium-xrpc" 261 369 version = "0.12.3" 262 370 source = "git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits#c4364f318d337bbc3e3e3aaf97c9f971e95f5f7e" ··· 402 510 "miniz_oxide", 403 511 "object", 404 512 "rustc-demangle", 405 - "windows-targets", 513 + "windows-targets 0.52.6", 406 514 ] 407 515 408 516 [[package]] ··· 412 520 checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" 413 521 414 522 [[package]] 523 + name = "base16ct" 524 + version = "0.2.0" 525 + source = "registry+https://github.com/rust-lang/crates.io-index" 526 + checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" 527 + 528 + [[package]] 415 529 name = "base64" 416 530 version = "0.21.7" 417 531 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 422 536 version = "0.22.1" 423 537 source = "registry+https://github.com/rust-lang/crates.io-index" 424 538 checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" 539 + 540 + [[package]] 541 + name = "base64ct" 542 + version = "1.8.0" 543 + source = "registry+https://github.com/rust-lang/crates.io-index" 544 + checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" 425 545 426 546 [[package]] 427 547 name = "basic-toml" ··· 760 880 ] 761 881 762 882 [[package]] 883 + name = "const-oid" 884 + version = "0.9.6" 885 + source = "registry+https://github.com/rust-lang/crates.io-index" 886 + checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" 887 + 888 + [[package]] 763 889 name = "constellation" 764 890 version = "0.1.0" 765 891 dependencies = [ ··· 839 965 ] 840 966 841 967 [[package]] 968 + name = "crc32fast" 969 + version = "1.4.2" 970 + source = "registry+https://github.com/rust-lang/crates.io-index" 971 + checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" 972 + dependencies = [ 973 + "cfg-if", 974 + ] 975 + 976 + [[package]] 977 + name = "critical-section" 978 + version = "1.2.0" 979 + source = "registry+https://github.com/rust-lang/crates.io-index" 980 + checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" 981 + 982 + [[package]] 842 983 name = "crossbeam-channel" 843 984 version = "0.5.15" 844 985 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 871 1012 version = "0.8.21" 872 1013 source = "registry+https://github.com/rust-lang/crates.io-index" 873 1014 checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" 1015 + 1016 + [[package]] 1017 + name = "crypto-bigint" 1018 + version = "0.5.5" 1019 + source = "registry+https://github.com/rust-lang/crates.io-index" 1020 + checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" 1021 + dependencies = [ 1022 + "generic-array", 1023 + "rand_core 0.6.4", 1024 + "subtle", 1025 + "zeroize", 1026 + ] 874 1027 875 1028 [[package]] 876 1029 name = "crypto-common" ··· 974 1127 checksum = "ffe7ed1d93f4553003e20b629abe9085e1e81b1429520f897f8f8860bc6dfc21" 975 1128 976 1129 [[package]] 1130 + name = "der" 1131 + version = "0.7.10" 1132 + source = "registry+https://github.com/rust-lang/crates.io-index" 1133 + checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" 1134 + dependencies = [ 1135 + "const-oid", 1136 + "zeroize", 1137 + ] 1138 + 1139 + [[package]] 977 1140 name = "deranged" 978 1141 version = "0.4.0" 979 1142 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 990 1153 checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" 991 1154 dependencies = [ 992 1155 "block-buffer", 1156 + "const-oid", 993 1157 "crypto-common", 1158 + "subtle", 994 1159 ] 995 1160 996 1161 [[package]] ··· 1109 1274 checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005" 1110 1275 1111 1276 [[package]] 1277 + name = "ecdsa" 1278 + version = "0.16.9" 1279 + source = "registry+https://github.com/rust-lang/crates.io-index" 1280 + checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" 1281 + dependencies = [ 1282 + "der", 1283 + "digest", 1284 + "elliptic-curve", 1285 + "rfc6979", 1286 + "signature", 1287 + ] 1288 + 1289 + [[package]] 1112 1290 name = "either" 1113 1291 version = "1.15.0" 1114 1292 source = "registry+https://github.com/rust-lang/crates.io-index" 1115 1293 checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" 1116 1294 1117 1295 [[package]] 1296 + name = "elliptic-curve" 1297 + version = "0.13.8" 1298 + source = "registry+https://github.com/rust-lang/crates.io-index" 1299 + checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" 1300 + dependencies = [ 1301 + "base16ct", 1302 + "crypto-bigint", 1303 + "digest", 1304 + "ff", 1305 + "generic-array", 1306 + "group", 1307 + "rand_core 0.6.4", 1308 + "sec1", 1309 + "subtle", 1310 + "zeroize", 1311 + ] 1312 + 1313 + [[package]] 1118 1314 name = "encoding_rs" 1119 1315 version = "0.8.35" 1120 1316 source = "registry+https://github.com/rust-lang/crates.io-index" 1121 1317 checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" 1122 1318 dependencies = [ 1123 1319 "cfg-if", 1320 + ] 1321 + 1322 + [[package]] 1323 + name = "enum-as-inner" 1324 + version = "0.6.1" 1325 + source = "registry+https://github.com/rust-lang/crates.io-index" 1326 + checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc" 1327 + dependencies = [ 1328 + "heck", 1329 + "proc-macro2", 1330 + "quote", 1331 + "syn", 1124 1332 ] 1125 1333 1126 1334 [[package]] ··· 1202 1410 checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" 1203 1411 1204 1412 [[package]] 1413 + name = "ff" 1414 + version = "0.13.1" 1415 + source = "registry+https://github.com/rust-lang/crates.io-index" 1416 + checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" 1417 + dependencies = [ 1418 + "rand_core 0.6.4", 1419 + "subtle", 1420 + ] 1421 + 1422 + [[package]] 1205 1423 name = "fjall" 1206 1424 version = "2.8.0" 1207 1425 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1219 1437 ] 1220 1438 1221 1439 [[package]] 1440 + name = "flate2" 1441 + version = "1.1.2" 1442 + source = "registry+https://github.com/rust-lang/crates.io-index" 1443 + checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d" 1444 + dependencies = [ 1445 + "crc32fast", 1446 + "miniz_oxide", 1447 + ] 1448 + 1449 + [[package]] 1222 1450 name = "fluent-uri" 1223 1451 version = "0.3.2" 1224 1452 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1399 1627 dependencies = [ 1400 1628 "typenum", 1401 1629 "version_check", 1630 + "zeroize", 1402 1631 ] 1403 1632 1404 1633 [[package]] ··· 1435 1664 version = "0.3.2" 1436 1665 source = "registry+https://github.com/rust-lang/crates.io-index" 1437 1666 checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" 1667 + 1668 + [[package]] 1669 + name = "group" 1670 + version = "0.13.0" 1671 + source = "registry+https://github.com/rust-lang/crates.io-index" 1672 + checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" 1673 + dependencies = [ 1674 + "ff", 1675 + "rand_core 0.6.4", 1676 + "subtle", 1677 + ] 1438 1678 1439 1679 [[package]] 1440 1680 name = "guardian" ··· 1538 1778 checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" 1539 1779 1540 1780 [[package]] 1781 + name = "hickory-proto" 1782 + version = "0.25.2" 1783 + source = "registry+https://github.com/rust-lang/crates.io-index" 1784 + checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502" 1785 + dependencies = [ 1786 + "async-trait", 1787 + "cfg-if", 1788 + "data-encoding", 1789 + "enum-as-inner", 1790 + "futures-channel", 1791 + "futures-io", 1792 + "futures-util", 1793 + "idna", 1794 + "ipnet", 1795 + "once_cell", 1796 + "rand 0.9.1", 1797 + "ring", 1798 + "thiserror 2.0.12", 1799 + "tinyvec", 1800 + "tokio", 1801 + "tracing", 1802 + "url", 1803 + ] 1804 + 1805 + [[package]] 1806 + name = "hickory-resolver" 1807 + version = "0.25.2" 1808 + source = "registry+https://github.com/rust-lang/crates.io-index" 1809 + checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a" 1810 + dependencies = [ 1811 + "cfg-if", 1812 + "futures-util", 1813 + "hickory-proto", 1814 + "ipconfig", 1815 + "moka", 1816 + "once_cell", 1817 + "parking_lot", 1818 + "rand 0.9.1", 1819 + "resolv-conf", 1820 + "smallvec", 1821 + "thiserror 2.0.12", 1822 + "tokio", 1823 + "tracing", 1824 + ] 1825 + 1826 + [[package]] 1827 + name = "hmac" 1828 + version = "0.12.1" 1829 + source = "registry+https://github.com/rust-lang/crates.io-index" 1830 + checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" 1831 + dependencies = [ 1832 + "digest", 1833 + ] 1834 + 1835 + [[package]] 1541 1836 name = "home" 1542 1837 version = "0.5.11" 1543 1838 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1658 1953 "rustls-pki-types", 1659 1954 "tokio", 1660 1955 "tokio-rustls 0.26.2", 1956 + "tower-service", 1957 + ] 1958 + 1959 + [[package]] 1960 + name = "hyper-tls" 1961 + version = "0.6.0" 1962 + source = "registry+https://github.com/rust-lang/crates.io-index" 1963 + checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" 1964 + dependencies = [ 1965 + "bytes", 1966 + "http-body-util", 1967 + "hyper", 1968 + "hyper-util", 1969 + "native-tls", 1970 + "tokio", 1971 + "tokio-native-tls", 1661 1972 "tower-service", 1662 1973 ] 1663 1974 ··· 1882 2193 ] 1883 2194 1884 2195 [[package]] 2196 + name = "ipconfig" 2197 + version = "0.3.2" 2198 + source = "registry+https://github.com/rust-lang/crates.io-index" 2199 + checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f" 2200 + dependencies = [ 2201 + "socket2", 2202 + "widestring", 2203 + "windows-sys 0.48.0", 2204 + "winreg", 2205 + ] 2206 + 2207 + [[package]] 1885 2208 name = "ipld-core" 1886 2209 version = "0.4.2" 1887 2210 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 1945 2268 dependencies = [ 1946 2269 "anyhow", 1947 2270 "async-trait", 1948 - "atrium-api", 2271 + "atrium-api 0.25.3", 1949 2272 "chrono", 1950 2273 "clap", 1951 2274 "futures-util", ··· 1995 2318 ] 1996 2319 1997 2320 [[package]] 2321 + name = "jose-b64" 2322 + version = "0.1.2" 2323 + source = "registry+https://github.com/rust-lang/crates.io-index" 2324 + checksum = "bec69375368709666b21c76965ce67549f2d2db7605f1f8707d17c9656801b56" 2325 + dependencies = [ 2326 + "base64ct", 2327 + "serde", 2328 + "subtle", 2329 + "zeroize", 2330 + ] 2331 + 2332 + [[package]] 2333 + name = "jose-jwa" 2334 + version = "0.1.2" 2335 + source = "registry+https://github.com/rust-lang/crates.io-index" 2336 + checksum = "9ab78e053fe886a351d67cf0d194c000f9d0dcb92906eb34d853d7e758a4b3a7" 2337 + dependencies = [ 2338 + "serde", 2339 + ] 2340 + 2341 + [[package]] 2342 + name = "jose-jwk" 2343 + version = "0.1.2" 2344 + source = "registry+https://github.com/rust-lang/crates.io-index" 2345 + checksum = "280fa263807fe0782ecb6f2baadc28dffc04e00558a58e33bfdb801d11fd58e7" 2346 + dependencies = [ 2347 + "jose-b64", 2348 + "jose-jwa", 2349 + "p256", 2350 + "serde", 2351 + "zeroize", 2352 + ] 2353 + 2354 + [[package]] 1998 2355 name = "js-sys" 1999 2356 version = "0.3.77" 2000 2357 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2048 2405 checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" 2049 2406 dependencies = [ 2050 2407 "cfg-if", 2051 - "windows-targets", 2408 + "windows-targets 0.52.6", 2052 2409 ] 2053 2410 2054 2411 [[package]] ··· 2536 2893 version = "1.21.3" 2537 2894 source = "registry+https://github.com/rust-lang/crates.io-index" 2538 2895 checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" 2896 + dependencies = [ 2897 + "critical-section", 2898 + "portable-atomic", 2899 + ] 2539 2900 2540 2901 [[package]] 2541 2902 name = "openapiv3" ··· 2609 2970 checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" 2610 2971 2611 2972 [[package]] 2973 + name = "p256" 2974 + version = "0.13.2" 2975 + source = "registry+https://github.com/rust-lang/crates.io-index" 2976 + checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" 2977 + dependencies = [ 2978 + "ecdsa", 2979 + "elliptic-curve", 2980 + "primeorder", 2981 + "sha2", 2982 + ] 2983 + 2984 + [[package]] 2612 2985 name = "parking" 2613 2986 version = "2.2.1" 2614 2987 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2634 3007 "libc", 2635 3008 "redox_syscall", 2636 3009 "smallvec", 2637 - "windows-targets", 3010 + "windows-targets 0.52.6", 2638 3011 ] 2639 3012 2640 3013 [[package]] ··· 2726 3099 ] 2727 3100 2728 3101 [[package]] 3102 + name = "primeorder" 3103 + version = "0.13.6" 3104 + source = "registry+https://github.com/rust-lang/crates.io-index" 3105 + checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" 3106 + dependencies = [ 3107 + "elliptic-curve", 3108 + ] 3109 + 3110 + [[package]] 2729 3111 name = "proc-macro2" 2730 3112 version = "1.0.94" 2731 3113 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2969 3351 checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" 2970 3352 2971 3353 [[package]] 3354 + name = "reqwest" 3355 + version = "0.12.15" 3356 + source = "registry+https://github.com/rust-lang/crates.io-index" 3357 + checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" 3358 + dependencies = [ 3359 + "async-compression", 3360 + "base64 0.22.1", 3361 + "bytes", 3362 + "futures-core", 3363 + "futures-util", 3364 + "http", 3365 + "http-body", 3366 + "http-body-util", 3367 + "hyper", 3368 + "hyper-tls", 3369 + "hyper-util", 3370 + "ipnet", 3371 + "js-sys", 3372 + "log", 3373 + "mime", 3374 + "native-tls", 3375 + "once_cell", 3376 + "percent-encoding", 3377 + "pin-project-lite", 3378 + "rustls-pemfile", 3379 + "serde", 3380 + "serde_json", 3381 + "serde_urlencoded", 3382 + "sync_wrapper", 3383 + "tokio", 3384 + "tokio-native-tls", 3385 + "tokio-util", 3386 + "tower", 3387 + "tower-service", 3388 + "url", 3389 + "wasm-bindgen", 3390 + "wasm-bindgen-futures", 3391 + "web-sys", 3392 + "windows-registry", 3393 + ] 3394 + 3395 + [[package]] 3396 + name = "resolv-conf" 3397 + version = "0.7.4" 3398 + source = "registry+https://github.com/rust-lang/crates.io-index" 3399 + checksum = "95325155c684b1c89f7765e30bc1c42e4a6da51ca513615660cb8a62ef9a88e3" 3400 + 3401 + [[package]] 3402 + name = "rfc6979" 3403 + version = "0.4.0" 3404 + source = "registry+https://github.com/rust-lang/crates.io-index" 3405 + checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" 3406 + dependencies = [ 3407 + "hmac", 3408 + "subtle", 3409 + ] 3410 + 3411 + [[package]] 2972 3412 name = "ring" 2973 3413 version = "0.17.14" 2974 3414 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3192 3632 checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 3193 3633 3194 3634 [[package]] 3635 + name = "sec1" 3636 + version = "0.7.3" 3637 + source = "registry+https://github.com/rust-lang/crates.io-index" 3638 + checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" 3639 + dependencies = [ 3640 + "base16ct", 3641 + "der", 3642 + "generic-array", 3643 + "subtle", 3644 + "zeroize", 3645 + ] 3646 + 3647 + [[package]] 3195 3648 name = "security-framework" 3196 3649 version = "2.11.1" 3197 3650 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3437 3890 ] 3438 3891 3439 3892 [[package]] 3893 + name = "signature" 3894 + version = "2.2.0" 3895 + source = "registry+https://github.com/rust-lang/crates.io-index" 3896 + checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" 3897 + dependencies = [ 3898 + "digest", 3899 + "rand_core 0.6.4", 3900 + ] 3901 + 3902 + [[package]] 3440 3903 name = "sketches-ddsketch" 3441 3904 version = "0.3.0" 3442 3905 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 3600 4063 version = "1.0.2" 3601 4064 source = "registry+https://github.com/rust-lang/crates.io-index" 3602 4065 checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" 4066 + dependencies = [ 4067 + "futures-core", 4068 + ] 3603 4069 3604 4070 [[package]] 3605 4071 name = "synstructure" ··· 3766 4232 "displaydoc", 3767 4233 "zerovec", 3768 4234 ] 4235 + 4236 + [[package]] 4237 + name = "tinyvec" 4238 + version = "1.9.0" 4239 + source = "registry+https://github.com/rust-lang/crates.io-index" 4240 + checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" 4241 + dependencies = [ 4242 + "tinyvec_macros", 4243 + ] 4244 + 4245 + [[package]] 4246 + name = "tinyvec_macros" 4247 + version = "0.1.1" 4248 + source = "registry+https://github.com/rust-lang/crates.io-index" 4249 + checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" 3769 4250 3770 4251 [[package]] 3771 4252 name = "tokio" ··· 4286 4767 ] 4287 4768 4288 4769 [[package]] 4770 + name = "wasm-bindgen-futures" 4771 + version = "0.4.50" 4772 + source = "registry+https://github.com/rust-lang/crates.io-index" 4773 + checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" 4774 + dependencies = [ 4775 + "cfg-if", 4776 + "js-sys", 4777 + "once_cell", 4778 + "wasm-bindgen", 4779 + "web-sys", 4780 + ] 4781 + 4782 + [[package]] 4289 4783 name = "wasm-bindgen-macro" 4290 4784 version = "0.2.100" 4291 4785 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4350 4844 ] 4351 4845 4352 4846 [[package]] 4847 + name = "who-am-i" 4848 + version = "0.1.0" 4849 + dependencies = [ 4850 + "atrium-api 0.25.4", 4851 + "atrium-identity", 4852 + "atrium-oauth", 4853 + "clap", 4854 + "dropshot", 4855 + "env_logger", 4856 + "hickory-resolver", 4857 + "http", 4858 + "log", 4859 + "metrics", 4860 + "schemars", 4861 + "semver", 4862 + "serde", 4863 + "serde_json", 4864 + "serde_qs", 4865 + "tokio", 4866 + "tokio-util", 4867 + ] 4868 + 4869 + [[package]] 4870 + name = "widestring" 4871 + version = "1.2.0" 4872 + source = "registry+https://github.com/rust-lang/crates.io-index" 4873 + checksum = "dd7cf3379ca1aac9eea11fba24fd7e315d621f8dfe35c8d7d2be8b793726e07d" 4874 + 4875 + [[package]] 4353 4876 name = "winapi" 4354 4877 version = "0.3.9" 4355 4878 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 4378 4901 checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" 4379 4902 dependencies = [ 4380 4903 "windows-core 0.58.0", 4381 - "windows-targets", 4904 + "windows-targets 0.52.6", 4382 4905 ] 4383 4906 4384 4907 [[package]] ··· 4391 4914 "windows-interface 0.58.0", 4392 4915 "windows-result 0.2.0", 4393 4916 "windows-strings 0.1.0", 4394 - "windows-targets", 4917 + "windows-targets 0.52.6", 4395 4918 ] 4396 4919 4397 4920 [[package]] ··· 4458 4981 checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" 4459 4982 4460 4983 [[package]] 4984 + name = "windows-registry" 4985 + version = "0.4.0" 4986 + source = "registry+https://github.com/rust-lang/crates.io-index" 4987 + checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" 4988 + dependencies = [ 4989 + "windows-result 0.3.2", 4990 + "windows-strings 0.3.1", 4991 + "windows-targets 0.53.2", 4992 + ] 4993 + 4994 + [[package]] 4461 4995 name = "windows-result" 4462 4996 version = "0.2.0" 4463 4997 source = "registry+https://github.com/rust-lang/crates.io-index" 4464 4998 checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" 4465 4999 dependencies = [ 4466 - "windows-targets", 5000 + "windows-targets 0.52.6", 4467 5001 ] 4468 5002 4469 5003 [[package]] ··· 4482 5016 checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" 4483 5017 dependencies = [ 4484 5018 "windows-result 0.2.0", 4485 - "windows-targets", 5019 + "windows-targets 0.52.6", 5020 + ] 5021 + 5022 + [[package]] 5023 + name = "windows-strings" 5024 + version = "0.3.1" 5025 + source = "registry+https://github.com/rust-lang/crates.io-index" 5026 + checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" 5027 + dependencies = [ 5028 + "windows-link", 4486 5029 ] 4487 5030 4488 5031 [[package]] ··· 4496 5039 4497 5040 [[package]] 4498 5041 name = "windows-sys" 5042 + version = "0.48.0" 5043 + source = "registry+https://github.com/rust-lang/crates.io-index" 5044 + checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" 5045 + dependencies = [ 5046 + "windows-targets 0.48.5", 5047 + ] 5048 + 5049 + [[package]] 5050 + name = "windows-sys" 4499 5051 version = "0.52.0" 4500 5052 source = "registry+https://github.com/rust-lang/crates.io-index" 4501 5053 checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" 4502 5054 dependencies = [ 4503 - "windows-targets", 5055 + "windows-targets 0.52.6", 4504 5056 ] 4505 5057 4506 5058 [[package]] ··· 4509 5061 source = "registry+https://github.com/rust-lang/crates.io-index" 4510 5062 checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" 4511 5063 dependencies = [ 4512 - "windows-targets", 5064 + "windows-targets 0.52.6", 5065 + ] 5066 + 5067 + [[package]] 5068 + name = "windows-targets" 5069 + version = "0.48.5" 5070 + source = "registry+https://github.com/rust-lang/crates.io-index" 5071 + checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 5072 + dependencies = [ 5073 + "windows_aarch64_gnullvm 0.48.5", 5074 + "windows_aarch64_msvc 0.48.5", 5075 + "windows_i686_gnu 0.48.5", 5076 + "windows_i686_msvc 0.48.5", 5077 + "windows_x86_64_gnu 0.48.5", 5078 + "windows_x86_64_gnullvm 0.48.5", 5079 + "windows_x86_64_msvc 0.48.5", 4513 5080 ] 4514 5081 4515 5082 [[package]] ··· 4518 5085 source = "registry+https://github.com/rust-lang/crates.io-index" 4519 5086 checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" 4520 5087 dependencies = [ 4521 - "windows_aarch64_gnullvm", 4522 - "windows_aarch64_msvc", 4523 - "windows_i686_gnu", 4524 - "windows_i686_gnullvm", 4525 - "windows_i686_msvc", 4526 - "windows_x86_64_gnu", 4527 - "windows_x86_64_gnullvm", 4528 - "windows_x86_64_msvc", 5088 + "windows_aarch64_gnullvm 0.52.6", 5089 + "windows_aarch64_msvc 0.52.6", 5090 + "windows_i686_gnu 0.52.6", 5091 + "windows_i686_gnullvm 0.52.6", 5092 + "windows_i686_msvc 0.52.6", 5093 + "windows_x86_64_gnu 0.52.6", 5094 + "windows_x86_64_gnullvm 0.52.6", 5095 + "windows_x86_64_msvc 0.52.6", 5096 + ] 5097 + 5098 + [[package]] 5099 + name = "windows-targets" 5100 + version = "0.53.2" 5101 + source = "registry+https://github.com/rust-lang/crates.io-index" 5102 + checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" 5103 + dependencies = [ 5104 + "windows_aarch64_gnullvm 0.53.0", 5105 + "windows_aarch64_msvc 0.53.0", 5106 + "windows_i686_gnu 0.53.0", 5107 + "windows_i686_gnullvm 0.53.0", 5108 + "windows_i686_msvc 0.53.0", 5109 + "windows_x86_64_gnu 0.53.0", 5110 + "windows_x86_64_gnullvm 0.53.0", 5111 + "windows_x86_64_msvc 0.53.0", 4529 5112 ] 4530 5113 4531 5114 [[package]] 4532 5115 name = "windows_aarch64_gnullvm" 5116 + version = "0.48.5" 5117 + source = "registry+https://github.com/rust-lang/crates.io-index" 5118 + checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 5119 + 5120 + [[package]] 5121 + name = "windows_aarch64_gnullvm" 4533 5122 version = "0.52.6" 4534 5123 source = "registry+https://github.com/rust-lang/crates.io-index" 4535 5124 checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" 4536 5125 4537 5126 [[package]] 5127 + name = "windows_aarch64_gnullvm" 5128 + version = "0.53.0" 5129 + source = "registry+https://github.com/rust-lang/crates.io-index" 5130 + checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" 5131 + 5132 + [[package]] 5133 + name = "windows_aarch64_msvc" 5134 + version = "0.48.5" 5135 + source = "registry+https://github.com/rust-lang/crates.io-index" 5136 + checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 5137 + 5138 + [[package]] 4538 5139 name = "windows_aarch64_msvc" 4539 5140 version = "0.52.6" 4540 5141 source = "registry+https://github.com/rust-lang/crates.io-index" 4541 5142 checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" 4542 5143 4543 5144 [[package]] 5145 + name = "windows_aarch64_msvc" 5146 + version = "0.53.0" 5147 + source = "registry+https://github.com/rust-lang/crates.io-index" 5148 + checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" 5149 + 5150 + [[package]] 5151 + name = "windows_i686_gnu" 5152 + version = "0.48.5" 5153 + source = "registry+https://github.com/rust-lang/crates.io-index" 5154 + checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 5155 + 5156 + [[package]] 4544 5157 name = "windows_i686_gnu" 4545 5158 version = "0.52.6" 4546 5159 source = "registry+https://github.com/rust-lang/crates.io-index" 4547 5160 checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" 5161 + 5162 + [[package]] 5163 + name = "windows_i686_gnu" 5164 + version = "0.53.0" 5165 + source = "registry+https://github.com/rust-lang/crates.io-index" 5166 + checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" 4548 5167 4549 5168 [[package]] 4550 5169 name = "windows_i686_gnullvm" ··· 4553 5172 checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" 4554 5173 4555 5174 [[package]] 5175 + name = "windows_i686_gnullvm" 5176 + version = "0.53.0" 5177 + source = "registry+https://github.com/rust-lang/crates.io-index" 5178 + checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" 5179 + 5180 + [[package]] 5181 + name = "windows_i686_msvc" 5182 + version = "0.48.5" 5183 + source = "registry+https://github.com/rust-lang/crates.io-index" 5184 + checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 5185 + 5186 + [[package]] 4556 5187 name = "windows_i686_msvc" 4557 5188 version = "0.52.6" 4558 5189 source = "registry+https://github.com/rust-lang/crates.io-index" 4559 5190 checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" 4560 5191 4561 5192 [[package]] 5193 + name = "windows_i686_msvc" 5194 + version = "0.53.0" 5195 + source = "registry+https://github.com/rust-lang/crates.io-index" 5196 + checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" 5197 + 5198 + [[package]] 5199 + name = "windows_x86_64_gnu" 5200 + version = "0.48.5" 5201 + source = "registry+https://github.com/rust-lang/crates.io-index" 5202 + checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 5203 + 5204 + [[package]] 4562 5205 name = "windows_x86_64_gnu" 4563 5206 version = "0.52.6" 4564 5207 source = "registry+https://github.com/rust-lang/crates.io-index" 4565 5208 checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" 4566 5209 4567 5210 [[package]] 5211 + name = "windows_x86_64_gnu" 5212 + version = "0.53.0" 5213 + source = "registry+https://github.com/rust-lang/crates.io-index" 5214 + checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" 5215 + 5216 + [[package]] 5217 + name = "windows_x86_64_gnullvm" 5218 + version = "0.48.5" 5219 + source = "registry+https://github.com/rust-lang/crates.io-index" 5220 + checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 5221 + 5222 + [[package]] 4568 5223 name = "windows_x86_64_gnullvm" 4569 5224 version = "0.52.6" 4570 5225 source = "registry+https://github.com/rust-lang/crates.io-index" 4571 5226 checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" 4572 5227 4573 5228 [[package]] 5229 + name = "windows_x86_64_gnullvm" 5230 + version = "0.53.0" 5231 + source = "registry+https://github.com/rust-lang/crates.io-index" 5232 + checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" 5233 + 5234 + [[package]] 5235 + name = "windows_x86_64_msvc" 5236 + version = "0.48.5" 5237 + source = "registry+https://github.com/rust-lang/crates.io-index" 5238 + checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" 5239 + 5240 + [[package]] 4574 5241 name = "windows_x86_64_msvc" 4575 5242 version = "0.52.6" 4576 5243 source = "registry+https://github.com/rust-lang/crates.io-index" 4577 5244 checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" 5245 + 5246 + [[package]] 5247 + name = "windows_x86_64_msvc" 5248 + version = "0.53.0" 5249 + source = "registry+https://github.com/rust-lang/crates.io-index" 5250 + checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" 4578 5251 4579 5252 [[package]] 4580 5253 name = "winnow" ··· 4583 5256 checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" 4584 5257 dependencies = [ 4585 5258 "memchr", 5259 + ] 5260 + 5261 + [[package]] 5262 + name = "winreg" 5263 + version = "0.50.0" 5264 + source = "registry+https://github.com/rust-lang/crates.io-index" 5265 + checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" 5266 + dependencies = [ 5267 + "cfg-if", 5268 + "windows-sys 0.48.0", 4586 5269 ] 4587 5270 4588 5271 [[package]] ··· 4711 5394 version = "1.8.1" 4712 5395 source = "registry+https://github.com/rust-lang/crates.io-index" 4713 5396 checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" 5397 + dependencies = [ 5398 + "serde", 5399 + ] 4714 5400 4715 5401 [[package]] 4716 5402 name = "zerovec"
+1
Cargo.toml
··· 7 7 "ufos", 8 8 "ufos/fuzz", 9 9 "spacedust", 10 + "who-am-i", 10 11 ]
+1 -1
spacedust/static/index.html
··· 40 40 </nav> 41 41 </header> 42 42 43 - <script id="api-reference" type="application/json" data-url="/openapi""></script> 43 + <script id="api-reference" type="application/json" data-url="/openapi"></script> 44 44 45 45 <script> 46 46 var configuration = {
+23
who-am-i/Cargo.toml
··· 1 + [package] 2 + name = "who-am-i" 3 + version = "0.1.0" 4 + edition = "2024" 5 + 6 + [dependencies] 7 + atrium-api = { version = "0.25.4", default-features = false, features = ["tokio", "agent"] } 8 + atrium-identity = "0.1.5" 9 + atrium-oauth = "0.1.3" 10 + clap = { version = "4.5.40", features = ["derive"] } 11 + dropshot = "0.16.2" 12 + env_logger = "0.11.8" 13 + hickory-resolver = "0.25.2" 14 + http = "1.3.1" 15 + log = "0.4.27" 16 + metrics = "0.24.2" 17 + schemars = "0.8.22" 18 + semver = "1.0.26" 19 + serde = { version = "1.0.219", features = ["derive"] } 20 + serde_json = "1.0.140" 21 + serde_qs = "1.0.0-rc.3" 22 + tokio = { version = "1.45.1", features = ["full", "macros"] } 23 + tokio-util = "0.7.15"
+34
who-am-i/src/dns_resolver.rs
··· 1 + // originally from weaver: https://github.com/rsform/weaver/blob/ee08213a85e09889b9bd66beceecee92ac025801/crates/weaver-common/src/resolver.rs 2 + // MPL 2.0: https://github.com/rsform/weaver/blob/ee08213a85e09889b9bd66beceecee92ac025801/LICENSE 3 + 4 + use atrium_identity::handle::DnsTxtResolver; 5 + use hickory_resolver::TokioResolver; 6 + 7 + pub struct HickoryDnsTxtResolver { 8 + resolver: TokioResolver, 9 + } 10 + 11 + impl Default for HickoryDnsTxtResolver { 12 + fn default() -> Self { 13 + Self { 14 + resolver: TokioResolver::builder_tokio() 15 + .expect("failed to create resolver") 16 + .build(), 17 + } 18 + } 19 + } 20 + 21 + impl DnsTxtResolver for HickoryDnsTxtResolver { 22 + async fn resolve( 23 + &self, 24 + query: &str, 25 + ) -> core::result::Result<Vec<String>, Box<dyn std::error::Error + Send + Sync>> { 26 + Ok(self 27 + .resolver 28 + .txt_lookup(query) 29 + .await? 30 + .iter() 31 + .map(|txt| txt.to_string()) 32 + .collect()) 33 + } 34 + }
+7
who-am-i/src/lib.rs
··· 1 + mod dns_resolver; 2 + mod oauth; 3 + mod server; 4 + 5 + pub use dns_resolver::HickoryDnsTxtResolver; 6 + pub use server::serve; 7 + pub use oauth::{Client, client, authorize};
+10
who-am-i/src/main.rs
··· 1 + use who_am_i::serve; 2 + use tokio_util::sync::CancellationToken; 3 + 4 + #[tokio::main] 5 + async fn main() { 6 + env_logger::init(); 7 + 8 + let server_shutdown = CancellationToken::new(); 9 + serve(server_shutdown).await.unwrap(); 10 + }
+68
who-am-i/src/oauth.rs
··· 1 + use atrium_identity::{ 2 + did::{CommonDidResolver, CommonDidResolverConfig, DEFAULT_PLC_DIRECTORY_URL}, 3 + handle::{AtprotoHandleResolver, AtprotoHandleResolverConfig}, 4 + }; 5 + use atrium_oauth::{ 6 + AuthorizeOptions, 7 + store::{session::MemorySessionStore, state::MemoryStateStore}, 8 + AtprotoLocalhostClientMetadata, DefaultHttpClient, KnownScope, OAuthClient, OAuthClientConfig, 9 + OAuthResolverConfig, Scope, 10 + }; 11 + use std::sync::Arc; 12 + use crate::HickoryDnsTxtResolver; 13 + 14 + pub type Client = OAuthClient< 15 + MemoryStateStore, 16 + MemorySessionStore, 17 + CommonDidResolver<DefaultHttpClient>, 18 + AtprotoHandleResolver<HickoryDnsTxtResolver, DefaultHttpClient>, 19 + >; 20 + 21 + pub fn client() -> Client { 22 + let http_client = Arc::new(DefaultHttpClient::default()); 23 + let config = OAuthClientConfig { 24 + client_metadata: AtprotoLocalhostClientMetadata { 25 + redirect_uris: Some(vec![String::from("http://127.0.0.1:9997/authorized")]), 26 + scopes: Some(vec![ 27 + Scope::Known(KnownScope::Atproto), 28 + ]), 29 + }, 30 + keys: None, 31 + resolver: OAuthResolverConfig { 32 + did_resolver: CommonDidResolver::new(CommonDidResolverConfig { 33 + plc_directory_url: DEFAULT_PLC_DIRECTORY_URL.to_string(), 34 + http_client: Arc::clone(&http_client), 35 + }), 36 + handle_resolver: AtprotoHandleResolver::new(AtprotoHandleResolverConfig { 37 + dns_txt_resolver: HickoryDnsTxtResolver::default(), 38 + http_client: Arc::clone(&http_client), 39 + }), 40 + authorization_server_metadata: Default::default(), 41 + protected_resource_metadata: Default::default(), 42 + }, 43 + // A store for saving state data while the user is being redirected to the authorization server. 44 + state_store: MemoryStateStore::default(), 45 + // A store for saving session data. 46 + session_store: MemorySessionStore::default(), 47 + }; 48 + let Ok(client) = OAuthClient::new(config) else { 49 + panic!("failed to create oauth client"); 50 + }; 51 + client 52 + } 53 + 54 + pub async fn authorize(client: &Client, handle: &str) -> String { 55 + let Ok(url) = client.authorize( 56 + handle, 57 + AuthorizeOptions { 58 + scopes: vec![ 59 + Scope::Known(KnownScope::Atproto), 60 + ], 61 + ..Default::default() 62 + }, 63 + ) 64 + .await else { 65 + panic!("failed to authorize"); 66 + }; 67 + url 68 + }
+272
who-am-i/src/server.rs
··· 1 + 2 + use atrium_api::agent::SessionManager; 3 + use std::error::Error; 4 + use metrics::{histogram, counter}; 5 + use std::sync::Arc; 6 + use http::{ 7 + header::{ORIGIN, USER_AGENT}, 8 + Response, StatusCode, 9 + }; 10 + use dropshot::{ 11 + Body, HttpResponseSeeOther, http_response_see_other, 12 + ApiDescription, ConfigDropshot, ConfigLogging, ConfigLoggingLevel, RequestContext, 13 + ServerBuilder, endpoint, HttpResponse, HttpError, ServerContext, Query, 14 + }; 15 + 16 + use atrium_oauth::CallbackParams; 17 + use schemars::JsonSchema; 18 + use serde::{Deserialize, Serialize}; 19 + use tokio::time::Instant; 20 + use tokio_util::sync::CancellationToken; 21 + 22 + use crate::{Client, client, authorize}; 23 + 24 + const INDEX_HTML: &str = include_str!("../static/index.html"); 25 + const FAVICON: &[u8] = include_bytes!("../static/favicon.ico"); 26 + 27 + pub async fn serve( 28 + shutdown: CancellationToken 29 + ) -> Result<(), Box<dyn Error + Send + Sync>> { 30 + let config_logging = ConfigLogging::StderrTerminal { 31 + level: ConfigLoggingLevel::Info, 32 + }; 33 + 34 + let log = config_logging 35 + .to_logger("example-basic")?; 36 + 37 + let mut api = ApiDescription::new(); 38 + api.register(index).unwrap(); 39 + api.register(favicon).unwrap(); 40 + api.register(openapi).unwrap(); 41 + api.register(start_oauth).unwrap(); 42 + api.register(finish_oauth).unwrap(); 43 + 44 + // TODO: put spec in a once cell / lazy lock thing? 45 + let spec = Arc::new( 46 + api.openapi( 47 + "Who-am-i", 48 + env!("CARGO_PKG_VERSION") 49 + .parse() 50 + .inspect_err(|e| { 51 + eprintln!("failed to parse cargo package version for openapi: {e:?}") 52 + }) 53 + .unwrap_or(semver::Version::new(0, 0, 1)), 54 + ) 55 + .description("An atproto identity verifier that is very much not ready for real use") 56 + .contact_name("part of @microcosm.blue") 57 + .contact_url("https://microcosm.blue") 58 + .json()?, 59 + ); 60 + 61 + let ctx = Context { spec, client: client().into() }; 62 + 63 + let server = ServerBuilder::new(api, ctx, log) 64 + .config(ConfigDropshot { 65 + bind_address: "0.0.0.0:9997".parse().unwrap(), 66 + ..Default::default() 67 + }) 68 + .start()?; 69 + 70 + tokio::select! { 71 + s = server.wait_for_shutdown() => { 72 + s?; 73 + log::info!("server shut down normally."); 74 + }, 75 + _ = shutdown.cancelled() => { 76 + log::info!("shutting down: closing server"); 77 + server.close().await?; 78 + }, 79 + } 80 + Ok(()) 81 + } 82 + 83 + #[derive(Clone)] 84 + struct Context { 85 + pub spec: Arc<serde_json::Value>, 86 + pub client: Arc<Client>, 87 + } 88 + 89 + async fn instrument_handler<T, H, R>(ctx: &RequestContext<T>, handler: H) -> Result<R, HttpError> 90 + where 91 + R: HttpResponse, 92 + H: Future<Output = Result<R, HttpError>>, 93 + T: ServerContext, 94 + { 95 + let start = Instant::now(); 96 + let result = handler.await; 97 + let latency = start.elapsed(); 98 + let status_code = match &result { 99 + Ok(response) => response.status_code(), 100 + Err(e) => e.status_code.as_status(), 101 + } 102 + .as_str() // just the number (.to_string()'s Display does eg `200 OK`) 103 + .to_string(); 104 + let endpoint = ctx.endpoint.operation_id.clone(); 105 + let headers = ctx.request.headers(); 106 + let origin = headers 107 + .get(ORIGIN) 108 + .and_then(|v| v.to_str().ok()) 109 + .unwrap_or("") 110 + .to_string(); 111 + let ua = headers 112 + .get(USER_AGENT) 113 + .and_then(|v| v.to_str().ok()) 114 + .map(|ua| { 115 + if ua.starts_with("Mozilla/5.0 ") { 116 + "browser" 117 + } else { 118 + ua 119 + } 120 + }) 121 + .unwrap_or("") 122 + .to_string(); 123 + counter!("server_requests_total", 124 + "endpoint" => endpoint.clone(), 125 + "origin" => origin, 126 + "ua" => ua, 127 + "status_code" => status_code, 128 + ) 129 + .increment(1); 130 + histogram!("server_handler_latency", "endpoint" => endpoint).record(latency.as_micros() as f64); 131 + result 132 + } 133 + 134 + use dropshot::{HttpResponseHeaders, HttpResponseOk}; 135 + 136 + pub type OkCorsResponse<T> = Result<HttpResponseHeaders<HttpResponseOk<T>>, HttpError>; 137 + 138 + /// Helper for constructing Ok responses: return OkCors(T).into() 139 + /// (not happy with this yet) 140 + pub struct OkCors<T: Serialize + JsonSchema + Send + Sync>(pub T); 141 + 142 + impl<T> From<OkCors<T>> for OkCorsResponse<T> 143 + where 144 + T: Serialize + JsonSchema + Send + Sync, 145 + { 146 + fn from(ok: OkCors<T>) -> OkCorsResponse<T> { 147 + let mut res = HttpResponseHeaders::new_unnamed(HttpResponseOk(ok.0)); 148 + res.headers_mut() 149 + .insert("access-control-allow-origin", "*".parse().unwrap()); 150 + Ok(res) 151 + } 152 + } 153 + 154 + // TODO: cors for HttpError 155 + 156 + 157 + /// Serve index page as html 158 + #[endpoint { 159 + method = GET, 160 + path = "/", 161 + /* 162 + * not useful to have this in openapi 163 + */ 164 + unpublished = true, 165 + }] 166 + async fn index(ctx: RequestContext<Context>) -> Result<Response<Body>, HttpError> { 167 + instrument_handler(&ctx, async { 168 + Ok(Response::builder() 169 + .status(StatusCode::OK) 170 + .header(http::header::CONTENT_TYPE, "text/html") 171 + .body(INDEX_HTML.into())?) 172 + }) 173 + .await 174 + } 175 + 176 + /// Serve index page as html 177 + #[endpoint { 178 + method = GET, 179 + path = "/favicon.ico", 180 + /* 181 + * not useful to have this in openapi 182 + */ 183 + unpublished = true, 184 + }] 185 + async fn favicon(ctx: RequestContext<Context>) -> Result<Response<Body>, HttpError> { 186 + instrument_handler(&ctx, async { 187 + Ok(Response::builder() 188 + .status(StatusCode::OK) 189 + .header(http::header::CONTENT_TYPE, "image/x-icon") 190 + .body(FAVICON.to_vec().into())?) 191 + }) 192 + .await 193 + } 194 + 195 + /// Meta: get the openapi spec for this api 196 + #[endpoint { 197 + method = GET, 198 + path = "/openapi", 199 + /* 200 + * not useful to have this in openapi 201 + */ 202 + unpublished = true, 203 + }] 204 + async fn openapi(ctx: RequestContext<Context>) -> OkCorsResponse<serde_json::Value> { 205 + instrument_handler(&ctx, async { 206 + let spec = (*ctx.context().spec).clone(); 207 + OkCors(spec).into() 208 + }) 209 + .await 210 + } 211 + 212 + #[derive(Debug, Deserialize, JsonSchema)] 213 + struct BeginOauthQuery { 214 + handle: String, 215 + } 216 + #[endpoint { 217 + method = GET, 218 + path = "/auth", 219 + }] 220 + async fn start_oauth( 221 + ctx: RequestContext<Context>, 222 + query: Query<BeginOauthQuery>, 223 + ) -> Result<HttpResponseSeeOther, HttpError> { 224 + let BeginOauthQuery { handle } = query.into_inner(); 225 + 226 + instrument_handler(&ctx, async { 227 + let Context { client, .. } = ctx.context(); 228 + 229 + let auth_url = authorize(client, &handle).await; 230 + 231 + http_response_see_other(auth_url) 232 + }) 233 + .await 234 + } 235 + 236 + #[derive(Debug, Deserialize, JsonSchema)] 237 + struct AuthorizedCallbackQuery { 238 + code: String, 239 + state: Option<String>, 240 + iss: Option<String>, 241 + } 242 + impl From<AuthorizedCallbackQuery> for CallbackParams { 243 + fn from(q: AuthorizedCallbackQuery) -> Self { 244 + let AuthorizedCallbackQuery { code, state, iss } = q; 245 + Self { code, state, iss } 246 + } 247 + } 248 + #[endpoint { 249 + method = GET, 250 + path = "/authorized", 251 + }] 252 + async fn finish_oauth( 253 + ctx: RequestContext<Context>, 254 + query: Query<AuthorizedCallbackQuery>, 255 + ) -> Result<Response<Body>, HttpError> { 256 + instrument_handler(&ctx, async { 257 + let Context { client, .. } = ctx.context(); 258 + let params = query.into_inner(); 259 + 260 + let Ok((oauth_session, _)) = client.callback(params.into()).await else { 261 + panic!("failed to do client callback"); 262 + }; 263 + 264 + let did = oauth_session.did().await.expect("a did to be present"); 265 + 266 + Ok(Response::builder() 267 + .status(StatusCode::OK) 268 + .header(http::header::CONTENT_TYPE, "text/html") 269 + .body(format!("sup: {did:?}").into())?) 270 + }) 271 + .await 272 + }
who-am-i/static/favicon.ico

This is a binary file and will not be displayed.

+53
who-am-i/static/index.html
··· 1 + <!doctype html> 2 + <html lang="en"> 3 + <head> 4 + <meta charset="utf-8" /> 5 + <title>Who-am-i documentation</title> 6 + <meta name="viewport" content="width=device-width, initial-scale=1" /> 7 + <meta name="description" content="API Documentation who-am-i, a read-only atproto identity verifier" /> 8 + <style> 9 + .custom-header { 10 + height: 42px; 11 + background-color: #221828; 12 + box-shadow: inset 0 -1px 0 var(--scalar-border-color); 13 + color: var(--scalar-color-1); 14 + font-size: var(--scalar-font-size-3); 15 + font-family: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, serif; 16 + padding: 0 18px; 17 + justify-content: space-between; 18 + } 19 + .custom-header, 20 + .custom-header nav { 21 + display: flex; 22 + align-items: center; 23 + gap: 18px; 24 + } 25 + .custom-header a:hover { 26 + color: var(--scalar-color-2); 27 + } 28 + </style> 29 + </head> 30 + <body> 31 + <header class="custom-header scalar-app"> 32 + <p> 33 + <a href="https://ufos.microcosm.blue">Launch who-am-i [todo]</a> 34 + </p> 35 + <nav> 36 + <b>a <a href="https://microcosm.blue">microcosm</a> project</b> 37 + <a href="https://bsky.app/profile/microcosm.blue">@microcosm.blue</a> 38 + <a href="https://github.com/at-microcosm">github</a> 39 + </nav> 40 + </header> 41 + 42 + <script id="api-reference" type="application/json" data-url="/openapi"></script> 43 + 44 + <script> 45 + var configuration = { 46 + theme: 'purple', 47 + } 48 + document.getElementById('api-reference').dataset.configuration = JSON.stringify(configuration) 49 + </script> 50 + 51 + <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script> 52 + </body> 53 + </html>