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

who-am-i sketch: oauth working-ish

+706 -20
Cargo.lock
···
]
[[package]]
+
name = "async-compression"
+
version = "0.4.25"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "40f6024f3f856663b45fd0c9b6f2024034a702f453549449e0d84a305900dad4"
+
dependencies = [
+
"flate2",
+
"futures-core",
+
"memchr",
+
"pin-project-lite",
+
"tokio",
+
]
+
+
[[package]]
name = "async-lock"
version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
version = "0.25.3"
source = "git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits#c4364f318d337bbc3e3e3aaf97c9f971e95f5f7e"
dependencies = [
-
"atrium-common",
-
"atrium-xrpc",
+
"atrium-common 0.1.2 (git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits)",
+
"atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits)",
"chrono",
"http",
"ipld-core",
···
]
[[package]]
+
name = "atrium-api"
+
version = "0.25.4"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "46355d3245edc7b3160b2a45fe55d09a6963ebd3eee0252feb6b72fb0eb71463"
+
dependencies = [
+
"atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+
"atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
+
"chrono",
+
"http",
+
"ipld-core",
+
"langtag",
+
"regex",
+
"serde",
+
"serde_bytes",
+
"serde_json",
+
"thiserror 1.0.69",
+
"tokio",
+
"trait-variant",
+
]
+
+
[[package]]
+
name = "atrium-common"
+
version = "0.1.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9ed5610654043faa396a5a15afac0ac646d76aebe45aebd7cef4f8b96b0ab7f4"
+
dependencies = [
+
"dashmap",
+
"lru",
+
"moka",
+
"thiserror 1.0.69",
+
"tokio",
+
"trait-variant",
+
"web-time",
+
]
+
+
[[package]]
name = "atrium-common"
version = "0.1.2"
source = "git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits#c4364f318d337bbc3e3e3aaf97c9f971e95f5f7e"
···
]
[[package]]
+
name = "atrium-identity"
+
version = "0.1.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c9e2d42bb4dbea038f4f5f45e3af2a89d61a9894a75f06aa550b74a60d2be380"
+
dependencies = [
+
"atrium-api 0.25.4",
+
"atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+
"atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
+
"serde",
+
"serde_html_form",
+
"serde_json",
+
"thiserror 1.0.69",
+
"trait-variant",
+
]
+
+
[[package]]
+
name = "atrium-oauth"
+
version = "0.1.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "ca22dc4eaf77fd9bf050b21192ac58cd654a437d28e000ec114ebd93a51d36f5"
+
dependencies = [
+
"atrium-api 0.25.4",
+
"atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
+
"atrium-identity",
+
"atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)",
+
"base64 0.22.1",
+
"chrono",
+
"dashmap",
+
"ecdsa",
+
"elliptic-curve",
+
"jose-jwa",
+
"jose-jwk",
+
"p256",
+
"rand 0.8.5",
+
"reqwest",
+
"serde",
+
"serde_html_form",
+
"serde_json",
+
"sha2",
+
"thiserror 1.0.69",
+
"tokio",
+
"trait-variant",
+
]
+
+
[[package]]
+
name = "atrium-xrpc"
+
version = "0.12.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "0216ad50ce34e9ff982e171c3659e65dedaa2ed5ac2994524debdc9a9647ffa8"
+
dependencies = [
+
"http",
+
"serde",
+
"serde_html_form",
+
"serde_json",
+
"thiserror 1.0.69",
+
"trait-variant",
+
]
+
+
[[package]]
name = "atrium-xrpc"
version = "0.12.3"
source = "git+https://github.com/uniphil/atrium?branch=fix%2Fnsid-allow-nonleading-name-digits#c4364f318d337bbc3e3e3aaf97c9f971e95f5f7e"
···
"miniz_oxide",
"object",
"rustc-demangle",
-
"windows-targets",
+
"windows-targets 0.52.6",
]
[[package]]
···
checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270"
[[package]]
+
name = "base16ct"
+
version = "0.2.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"
+
+
[[package]]
name = "base64"
version = "0.21.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
version = "0.22.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
+
+
[[package]]
+
name = "base64ct"
+
version = "1.8.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba"
[[package]]
name = "basic-toml"
···
]
[[package]]
+
name = "const-oid"
+
version = "0.9.6"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"
+
+
[[package]]
name = "constellation"
version = "0.1.0"
dependencies = [
···
]
[[package]]
+
name = "crc32fast"
+
version = "1.4.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"
+
dependencies = [
+
"cfg-if",
+
]
+
+
[[package]]
+
name = "critical-section"
+
version = "1.2.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b"
+
+
[[package]]
name = "crossbeam-channel"
version = "0.5.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
version = "0.8.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28"
+
+
[[package]]
+
name = "crypto-bigint"
+
version = "0.5.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"
+
dependencies = [
+
"generic-array",
+
"rand_core 0.6.4",
+
"subtle",
+
"zeroize",
+
]
[[package]]
name = "crypto-common"
···
checksum = "ffe7ed1d93f4553003e20b629abe9085e1e81b1429520f897f8f8860bc6dfc21"
[[package]]
+
name = "der"
+
version = "0.7.10"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb"
+
dependencies = [
+
"const-oid",
+
"zeroize",
+
]
+
+
[[package]]
name = "deranged"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"
dependencies = [
"block-buffer",
+
"const-oid",
"crypto-common",
+
"subtle",
]
[[package]]
···
checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005"
[[package]]
+
name = "ecdsa"
+
version = "0.16.9"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"
+
dependencies = [
+
"der",
+
"digest",
+
"elliptic-curve",
+
"rfc6979",
+
"signature",
+
]
+
+
[[package]]
name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
+
name = "elliptic-curve"
+
version = "0.13.8"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"
+
dependencies = [
+
"base16ct",
+
"crypto-bigint",
+
"digest",
+
"ff",
+
"generic-array",
+
"group",
+
"rand_core 0.6.4",
+
"sec1",
+
"subtle",
+
"zeroize",
+
]
+
+
[[package]]
name = "encoding_rs"
version = "0.8.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
dependencies = [
"cfg-if",
+
]
+
+
[[package]]
+
name = "enum-as-inner"
+
version = "0.6.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "a1e6a265c649f3f5979b601d26f1d05ada116434c87741c9493cb56218f76cbc"
+
dependencies = [
+
"heck",
+
"proc-macro2",
+
"quote",
+
"syn",
[[package]]
···
checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"
[[package]]
+
name = "ff"
+
version = "0.13.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393"
+
dependencies = [
+
"rand_core 0.6.4",
+
"subtle",
+
]
+
+
[[package]]
name = "fjall"
version = "2.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
[[package]]
+
name = "flate2"
+
version = "1.1.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "4a3d7db9596fecd151c5f638c0ee5d5bd487b6e0ea232e5dc96d5250f6f94b1d"
+
dependencies = [
+
"crc32fast",
+
"miniz_oxide",
+
]
+
+
[[package]]
name = "fluent-uri"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
dependencies = [
"typenum",
"version_check",
+
"zeroize",
[[package]]
···
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
+
+
[[package]]
+
name = "group"
+
version = "0.13.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"
+
dependencies = [
+
"ff",
+
"rand_core 0.6.4",
+
"subtle",
+
]
[[package]]
name = "guardian"
···
checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"
[[package]]
+
name = "hickory-proto"
+
version = "0.25.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "f8a6fe56c0038198998a6f217ca4e7ef3a5e51f46163bd6dd60b5c71ca6c6502"
+
dependencies = [
+
"async-trait",
+
"cfg-if",
+
"data-encoding",
+
"enum-as-inner",
+
"futures-channel",
+
"futures-io",
+
"futures-util",
+
"idna",
+
"ipnet",
+
"once_cell",
+
"rand 0.9.1",
+
"ring",
+
"thiserror 2.0.12",
+
"tinyvec",
+
"tokio",
+
"tracing",
+
"url",
+
]
+
+
[[package]]
+
name = "hickory-resolver"
+
version = "0.25.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "dc62a9a99b0bfb44d2ab95a7208ac952d31060efc16241c87eaf36406fecf87a"
+
dependencies = [
+
"cfg-if",
+
"futures-util",
+
"hickory-proto",
+
"ipconfig",
+
"moka",
+
"once_cell",
+
"parking_lot",
+
"rand 0.9.1",
+
"resolv-conf",
+
"smallvec",
+
"thiserror 2.0.12",
+
"tokio",
+
"tracing",
+
]
+
+
[[package]]
+
name = "hmac"
+
version = "0.12.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"
+
dependencies = [
+
"digest",
+
]
+
+
[[package]]
name = "home"
version = "0.5.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
"rustls-pki-types",
"tokio",
"tokio-rustls 0.26.2",
+
"tower-service",
+
]
+
+
[[package]]
+
name = "hyper-tls"
+
version = "0.6.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0"
+
dependencies = [
+
"bytes",
+
"http-body-util",
+
"hyper",
+
"hyper-util",
+
"native-tls",
+
"tokio",
+
"tokio-native-tls",
"tower-service",
···
[[package]]
+
name = "ipconfig"
+
version = "0.3.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "b58db92f96b720de98181bbbe63c831e87005ab460c1bf306eb2622b4707997f"
+
dependencies = [
+
"socket2",
+
"widestring",
+
"windows-sys 0.48.0",
+
"winreg",
+
]
+
+
[[package]]
name = "ipld-core"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
dependencies = [
"anyhow",
"async-trait",
-
"atrium-api",
+
"atrium-api 0.25.3",
"chrono",
"clap",
"futures-util",
···
[[package]]
+
name = "jose-b64"
+
version = "0.1.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "bec69375368709666b21c76965ce67549f2d2db7605f1f8707d17c9656801b56"
+
dependencies = [
+
"base64ct",
+
"serde",
+
"subtle",
+
"zeroize",
+
]
+
+
[[package]]
+
name = "jose-jwa"
+
version = "0.1.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9ab78e053fe886a351d67cf0d194c000f9d0dcb92906eb34d853d7e758a4b3a7"
+
dependencies = [
+
"serde",
+
]
+
+
[[package]]
+
name = "jose-jwk"
+
version = "0.1.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "280fa263807fe0782ecb6f2baadc28dffc04e00558a58e33bfdb801d11fd58e7"
+
dependencies = [
+
"jose-b64",
+
"jose-jwa",
+
"p256",
+
"serde",
+
"zeroize",
+
]
+
+
[[package]]
name = "js-sys"
version = "0.3.77"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
dependencies = [
"cfg-if",
-
"windows-targets",
+
"windows-targets 0.52.6",
[[package]]
···
version = "1.21.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"
+
dependencies = [
+
"critical-section",
+
"portable-atomic",
+
]
[[package]]
name = "openapiv3"
···
checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"
[[package]]
+
name = "p256"
+
version = "0.13.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"
+
dependencies = [
+
"ecdsa",
+
"elliptic-curve",
+
"primeorder",
+
"sha2",
+
]
+
+
[[package]]
name = "parking"
version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
"libc",
"redox_syscall",
"smallvec",
-
"windows-targets",
+
"windows-targets 0.52.6",
[[package]]
···
[[package]]
+
name = "primeorder"
+
version = "0.13.6"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"
+
dependencies = [
+
"elliptic-curve",
+
]
+
+
[[package]]
name = "proc-macro2"
version = "1.0.94"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
[[package]]
+
name = "reqwest"
+
version = "0.12.15"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb"
+
dependencies = [
+
"async-compression",
+
"base64 0.22.1",
+
"bytes",
+
"futures-core",
+
"futures-util",
+
"http",
+
"http-body",
+
"http-body-util",
+
"hyper",
+
"hyper-tls",
+
"hyper-util",
+
"ipnet",
+
"js-sys",
+
"log",
+
"mime",
+
"native-tls",
+
"once_cell",
+
"percent-encoding",
+
"pin-project-lite",
+
"rustls-pemfile",
+
"serde",
+
"serde_json",
+
"serde_urlencoded",
+
"sync_wrapper",
+
"tokio",
+
"tokio-native-tls",
+
"tokio-util",
+
"tower",
+
"tower-service",
+
"url",
+
"wasm-bindgen",
+
"wasm-bindgen-futures",
+
"web-sys",
+
"windows-registry",
+
]
+
+
[[package]]
+
name = "resolv-conf"
+
version = "0.7.4"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "95325155c684b1c89f7765e30bc1c42e4a6da51ca513615660cb8a62ef9a88e3"
+
+
[[package]]
+
name = "rfc6979"
+
version = "0.4.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"
+
dependencies = [
+
"hmac",
+
"subtle",
+
]
+
+
[[package]]
name = "ring"
version = "0.17.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"
[[package]]
+
name = "sec1"
+
version = "0.7.3"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"
+
dependencies = [
+
"base16ct",
+
"der",
+
"generic-array",
+
"subtle",
+
"zeroize",
+
]
+
+
[[package]]
name = "security-framework"
version = "2.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
[[package]]
+
name = "signature"
+
version = "2.2.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"
+
dependencies = [
+
"digest",
+
"rand_core 0.6.4",
+
]
+
+
[[package]]
name = "sketches-ddsketch"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263"
+
dependencies = [
+
"futures-core",
+
]
[[package]]
name = "synstructure"
···
"displaydoc",
"zerovec",
+
+
[[package]]
+
name = "tinyvec"
+
version = "1.9.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71"
+
dependencies = [
+
"tinyvec_macros",
+
]
+
+
[[package]]
+
name = "tinyvec_macros"
+
version = "0.1.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20"
[[package]]
name = "tokio"
···
[[package]]
+
name = "wasm-bindgen-futures"
+
version = "0.4.50"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61"
+
dependencies = [
+
"cfg-if",
+
"js-sys",
+
"once_cell",
+
"wasm-bindgen",
+
"web-sys",
+
]
+
+
[[package]]
name = "wasm-bindgen-macro"
version = "0.2.100"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
[[package]]
+
name = "who-am-i"
+
version = "0.1.0"
+
dependencies = [
+
"atrium-api 0.25.4",
+
"atrium-identity",
+
"atrium-oauth",
+
"clap",
+
"dropshot",
+
"env_logger",
+
"hickory-resolver",
+
"http",
+
"log",
+
"metrics",
+
"schemars",
+
"semver",
+
"serde",
+
"serde_json",
+
"serde_qs",
+
"tokio",
+
"tokio-util",
+
]
+
+
[[package]]
+
name = "widestring"
+
version = "1.2.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "dd7cf3379ca1aac9eea11fba24fd7e315d621f8dfe35c8d7d2be8b793726e07d"
+
+
[[package]]
name = "winapi"
version = "0.3.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
···
checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"
dependencies = [
"windows-core 0.58.0",
-
"windows-targets",
+
"windows-targets 0.52.6",
[[package]]
···
"windows-interface 0.58.0",
"windows-result 0.2.0",
"windows-strings 0.1.0",
-
"windows-targets",
+
"windows-targets 0.52.6",
[[package]]
···
checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38"
[[package]]
+
name = "windows-registry"
+
version = "0.4.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3"
+
dependencies = [
+
"windows-result 0.3.2",
+
"windows-strings 0.3.1",
+
"windows-targets 0.53.2",
+
]
+
+
[[package]]
name = "windows-result"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"
dependencies = [
-
"windows-targets",
+
"windows-targets 0.52.6",
[[package]]
···
checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"
dependencies = [
"windows-result 0.2.0",
-
"windows-targets",
+
"windows-targets 0.52.6",
+
]
+
+
[[package]]
+
name = "windows-strings"
+
version = "0.3.1"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319"
+
dependencies = [
+
"windows-link",
[[package]]
···
[[package]]
name = "windows-sys"
+
version = "0.48.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
+
dependencies = [
+
"windows-targets 0.48.5",
+
]
+
+
[[package]]
+
name = "windows-sys"
version = "0.52.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
dependencies = [
-
"windows-targets",
+
"windows-targets 0.52.6",
[[package]]
···
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
dependencies = [
-
"windows-targets",
+
"windows-targets 0.52.6",
+
]
+
+
[[package]]
+
name = "windows-targets"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
+
dependencies = [
+
"windows_aarch64_gnullvm 0.48.5",
+
"windows_aarch64_msvc 0.48.5",
+
"windows_i686_gnu 0.48.5",
+
"windows_i686_msvc 0.48.5",
+
"windows_x86_64_gnu 0.48.5",
+
"windows_x86_64_gnullvm 0.48.5",
+
"windows_x86_64_msvc 0.48.5",
[[package]]
···
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
dependencies = [
-
"windows_aarch64_gnullvm",
-
"windows_aarch64_msvc",
-
"windows_i686_gnu",
-
"windows_i686_gnullvm",
-
"windows_i686_msvc",
-
"windows_x86_64_gnu",
-
"windows_x86_64_gnullvm",
-
"windows_x86_64_msvc",
+
"windows_aarch64_gnullvm 0.52.6",
+
"windows_aarch64_msvc 0.52.6",
+
"windows_i686_gnu 0.52.6",
+
"windows_i686_gnullvm 0.52.6",
+
"windows_i686_msvc 0.52.6",
+
"windows_x86_64_gnu 0.52.6",
+
"windows_x86_64_gnullvm 0.52.6",
+
"windows_x86_64_msvc 0.52.6",
+
]
+
+
[[package]]
+
name = "windows-targets"
+
version = "0.53.2"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef"
+
dependencies = [
+
"windows_aarch64_gnullvm 0.53.0",
+
"windows_aarch64_msvc 0.53.0",
+
"windows_i686_gnu 0.53.0",
+
"windows_i686_gnullvm 0.53.0",
+
"windows_i686_msvc 0.53.0",
+
"windows_x86_64_gnu 0.53.0",
+
"windows_x86_64_gnullvm 0.53.0",
+
"windows_x86_64_msvc 0.53.0",
[[package]]
name = "windows_aarch64_gnullvm"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
+
+
[[package]]
+
name = "windows_aarch64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
[[package]]
+
name = "windows_aarch64_gnullvm"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764"
+
+
[[package]]
+
name = "windows_aarch64_msvc"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
+
+
[[package]]
name = "windows_aarch64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
[[package]]
+
name = "windows_aarch64_msvc"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c"
+
+
[[package]]
+
name = "windows_i686_gnu"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
+
+
[[package]]
name = "windows_i686_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
+
+
[[package]]
+
name = "windows_i686_gnu"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3"
[[package]]
name = "windows_i686_gnullvm"
···
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
[[package]]
+
name = "windows_i686_gnullvm"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11"
+
+
[[package]]
+
name = "windows_i686_msvc"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
+
+
[[package]]
name = "windows_i686_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
[[package]]
+
name = "windows_i686_msvc"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d"
+
+
[[package]]
+
name = "windows_x86_64_gnu"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
+
+
[[package]]
name = "windows_x86_64_gnu"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
[[package]]
+
name = "windows_x86_64_gnu"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba"
+
+
[[package]]
+
name = "windows_x86_64_gnullvm"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
+
+
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
[[package]]
+
name = "windows_x86_64_gnullvm"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57"
+
+
[[package]]
+
name = "windows_x86_64_msvc"
+
version = "0.48.5"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+
+
[[package]]
name = "windows_x86_64_msvc"
version = "0.52.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
+
+
[[package]]
+
name = "windows_x86_64_msvc"
+
version = "0.53.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
[[package]]
name = "winnow"
···
checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd"
dependencies = [
"memchr",
+
]
+
+
[[package]]
+
name = "winreg"
+
version = "0.50.0"
+
source = "registry+https://github.com/rust-lang/crates.io-index"
+
checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1"
+
dependencies = [
+
"cfg-if",
+
"windows-sys 0.48.0",
[[package]]
···
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"
+
dependencies = [
+
"serde",
+
]
[[package]]
name = "zerovec"
+1
Cargo.toml
···
"ufos",
"ufos/fuzz",
"spacedust",
+
"who-am-i",
]
+1 -1
spacedust/static/index.html
···
</nav>
</header>
-
<script id="api-reference" type="application/json" data-url="/openapi""></script>
+
<script id="api-reference" type="application/json" data-url="/openapi"></script>
<script>
var configuration = {
+23
who-am-i/Cargo.toml
···
+
[package]
+
name = "who-am-i"
+
version = "0.1.0"
+
edition = "2024"
+
+
[dependencies]
+
atrium-api = { version = "0.25.4", default-features = false, features = ["tokio", "agent"] }
+
atrium-identity = "0.1.5"
+
atrium-oauth = "0.1.3"
+
clap = { version = "4.5.40", features = ["derive"] }
+
dropshot = "0.16.2"
+
env_logger = "0.11.8"
+
hickory-resolver = "0.25.2"
+
http = "1.3.1"
+
log = "0.4.27"
+
metrics = "0.24.2"
+
schemars = "0.8.22"
+
semver = "1.0.26"
+
serde = { version = "1.0.219", features = ["derive"] }
+
serde_json = "1.0.140"
+
serde_qs = "1.0.0-rc.3"
+
tokio = { version = "1.45.1", features = ["full", "macros"] }
+
tokio-util = "0.7.15"
+34
who-am-i/src/dns_resolver.rs
···
+
// originally from weaver: https://github.com/rsform/weaver/blob/ee08213a85e09889b9bd66beceecee92ac025801/crates/weaver-common/src/resolver.rs
+
// MPL 2.0: https://github.com/rsform/weaver/blob/ee08213a85e09889b9bd66beceecee92ac025801/LICENSE
+
+
use atrium_identity::handle::DnsTxtResolver;
+
use hickory_resolver::TokioResolver;
+
+
pub struct HickoryDnsTxtResolver {
+
resolver: TokioResolver,
+
}
+
+
impl Default for HickoryDnsTxtResolver {
+
fn default() -> Self {
+
Self {
+
resolver: TokioResolver::builder_tokio()
+
.expect("failed to create resolver")
+
.build(),
+
}
+
}
+
}
+
+
impl DnsTxtResolver for HickoryDnsTxtResolver {
+
async fn resolve(
+
&self,
+
query: &str,
+
) -> core::result::Result<Vec<String>, Box<dyn std::error::Error + Send + Sync>> {
+
Ok(self
+
.resolver
+
.txt_lookup(query)
+
.await?
+
.iter()
+
.map(|txt| txt.to_string())
+
.collect())
+
}
+
}
+7
who-am-i/src/lib.rs
···
+
mod dns_resolver;
+
mod oauth;
+
mod server;
+
+
pub use dns_resolver::HickoryDnsTxtResolver;
+
pub use server::serve;
+
pub use oauth::{Client, client, authorize};
+10
who-am-i/src/main.rs
···
+
use who_am_i::serve;
+
use tokio_util::sync::CancellationToken;
+
+
#[tokio::main]
+
async fn main() {
+
env_logger::init();
+
+
let server_shutdown = CancellationToken::new();
+
serve(server_shutdown).await.unwrap();
+
}
+68
who-am-i/src/oauth.rs
···
+
use atrium_identity::{
+
did::{CommonDidResolver, CommonDidResolverConfig, DEFAULT_PLC_DIRECTORY_URL},
+
handle::{AtprotoHandleResolver, AtprotoHandleResolverConfig},
+
};
+
use atrium_oauth::{
+
AuthorizeOptions,
+
store::{session::MemorySessionStore, state::MemoryStateStore},
+
AtprotoLocalhostClientMetadata, DefaultHttpClient, KnownScope, OAuthClient, OAuthClientConfig,
+
OAuthResolverConfig, Scope,
+
};
+
use std::sync::Arc;
+
use crate::HickoryDnsTxtResolver;
+
+
pub type Client = OAuthClient<
+
MemoryStateStore,
+
MemorySessionStore,
+
CommonDidResolver<DefaultHttpClient>,
+
AtprotoHandleResolver<HickoryDnsTxtResolver, DefaultHttpClient>,
+
>;
+
+
pub fn client() -> Client {
+
let http_client = Arc::new(DefaultHttpClient::default());
+
let config = OAuthClientConfig {
+
client_metadata: AtprotoLocalhostClientMetadata {
+
redirect_uris: Some(vec![String::from("http://127.0.0.1:9997/authorized")]),
+
scopes: Some(vec![
+
Scope::Known(KnownScope::Atproto),
+
]),
+
},
+
keys: None,
+
resolver: OAuthResolverConfig {
+
did_resolver: CommonDidResolver::new(CommonDidResolverConfig {
+
plc_directory_url: DEFAULT_PLC_DIRECTORY_URL.to_string(),
+
http_client: Arc::clone(&http_client),
+
}),
+
handle_resolver: AtprotoHandleResolver::new(AtprotoHandleResolverConfig {
+
dns_txt_resolver: HickoryDnsTxtResolver::default(),
+
http_client: Arc::clone(&http_client),
+
}),
+
authorization_server_metadata: Default::default(),
+
protected_resource_metadata: Default::default(),
+
},
+
// A store for saving state data while the user is being redirected to the authorization server.
+
state_store: MemoryStateStore::default(),
+
// A store for saving session data.
+
session_store: MemorySessionStore::default(),
+
};
+
let Ok(client) = OAuthClient::new(config) else {
+
panic!("failed to create oauth client");
+
};
+
client
+
}
+
+
pub async fn authorize(client: &Client, handle: &str) -> String {
+
let Ok(url) = client.authorize(
+
handle,
+
AuthorizeOptions {
+
scopes: vec![
+
Scope::Known(KnownScope::Atproto),
+
],
+
..Default::default()
+
},
+
)
+
.await else {
+
panic!("failed to authorize");
+
};
+
url
+
}
+272
who-am-i/src/server.rs
···
+
+
use atrium_api::agent::SessionManager;
+
use std::error::Error;
+
use metrics::{histogram, counter};
+
use std::sync::Arc;
+
use http::{
+
header::{ORIGIN, USER_AGENT},
+
Response, StatusCode,
+
};
+
use dropshot::{
+
Body, HttpResponseSeeOther, http_response_see_other,
+
ApiDescription, ConfigDropshot, ConfigLogging, ConfigLoggingLevel, RequestContext,
+
ServerBuilder, endpoint, HttpResponse, HttpError, ServerContext, Query,
+
};
+
+
use atrium_oauth::CallbackParams;
+
use schemars::JsonSchema;
+
use serde::{Deserialize, Serialize};
+
use tokio::time::Instant;
+
use tokio_util::sync::CancellationToken;
+
+
use crate::{Client, client, authorize};
+
+
const INDEX_HTML: &str = include_str!("../static/index.html");
+
const FAVICON: &[u8] = include_bytes!("../static/favicon.ico");
+
+
pub async fn serve(
+
shutdown: CancellationToken
+
) -> Result<(), Box<dyn Error + Send + Sync>> {
+
let config_logging = ConfigLogging::StderrTerminal {
+
level: ConfigLoggingLevel::Info,
+
};
+
+
let log = config_logging
+
.to_logger("example-basic")?;
+
+
let mut api = ApiDescription::new();
+
api.register(index).unwrap();
+
api.register(favicon).unwrap();
+
api.register(openapi).unwrap();
+
api.register(start_oauth).unwrap();
+
api.register(finish_oauth).unwrap();
+
+
// TODO: put spec in a once cell / lazy lock thing?
+
let spec = Arc::new(
+
api.openapi(
+
"Who-am-i",
+
env!("CARGO_PKG_VERSION")
+
.parse()
+
.inspect_err(|e| {
+
eprintln!("failed to parse cargo package version for openapi: {e:?}")
+
})
+
.unwrap_or(semver::Version::new(0, 0, 1)),
+
)
+
.description("An atproto identity verifier that is very much not ready for real use")
+
.contact_name("part of @microcosm.blue")
+
.contact_url("https://microcosm.blue")
+
.json()?,
+
);
+
+
let ctx = Context { spec, client: client().into() };
+
+
let server = ServerBuilder::new(api, ctx, log)
+
.config(ConfigDropshot {
+
bind_address: "0.0.0.0:9997".parse().unwrap(),
+
..Default::default()
+
})
+
.start()?;
+
+
tokio::select! {
+
s = server.wait_for_shutdown() => {
+
s?;
+
log::info!("server shut down normally.");
+
},
+
_ = shutdown.cancelled() => {
+
log::info!("shutting down: closing server");
+
server.close().await?;
+
},
+
}
+
Ok(())
+
}
+
+
#[derive(Clone)]
+
struct Context {
+
pub spec: Arc<serde_json::Value>,
+
pub client: Arc<Client>,
+
}
+
+
async fn instrument_handler<T, H, R>(ctx: &RequestContext<T>, handler: H) -> Result<R, HttpError>
+
where
+
R: HttpResponse,
+
H: Future<Output = Result<R, HttpError>>,
+
T: ServerContext,
+
{
+
let start = Instant::now();
+
let result = handler.await;
+
let latency = start.elapsed();
+
let status_code = match &result {
+
Ok(response) => response.status_code(),
+
Err(e) => e.status_code.as_status(),
+
}
+
.as_str() // just the number (.to_string()'s Display does eg `200 OK`)
+
.to_string();
+
let endpoint = ctx.endpoint.operation_id.clone();
+
let headers = ctx.request.headers();
+
let origin = headers
+
.get(ORIGIN)
+
.and_then(|v| v.to_str().ok())
+
.unwrap_or("")
+
.to_string();
+
let ua = headers
+
.get(USER_AGENT)
+
.and_then(|v| v.to_str().ok())
+
.map(|ua| {
+
if ua.starts_with("Mozilla/5.0 ") {
+
"browser"
+
} else {
+
ua
+
}
+
})
+
.unwrap_or("")
+
.to_string();
+
counter!("server_requests_total",
+
"endpoint" => endpoint.clone(),
+
"origin" => origin,
+
"ua" => ua,
+
"status_code" => status_code,
+
)
+
.increment(1);
+
histogram!("server_handler_latency", "endpoint" => endpoint).record(latency.as_micros() as f64);
+
result
+
}
+
+
use dropshot::{HttpResponseHeaders, HttpResponseOk};
+
+
pub type OkCorsResponse<T> = Result<HttpResponseHeaders<HttpResponseOk<T>>, HttpError>;
+
+
/// Helper for constructing Ok responses: return OkCors(T).into()
+
/// (not happy with this yet)
+
pub struct OkCors<T: Serialize + JsonSchema + Send + Sync>(pub T);
+
+
impl<T> From<OkCors<T>> for OkCorsResponse<T>
+
where
+
T: Serialize + JsonSchema + Send + Sync,
+
{
+
fn from(ok: OkCors<T>) -> OkCorsResponse<T> {
+
let mut res = HttpResponseHeaders::new_unnamed(HttpResponseOk(ok.0));
+
res.headers_mut()
+
.insert("access-control-allow-origin", "*".parse().unwrap());
+
Ok(res)
+
}
+
}
+
+
// TODO: cors for HttpError
+
+
+
/// Serve index page as html
+
#[endpoint {
+
method = GET,
+
path = "/",
+
/*
+
* not useful to have this in openapi
+
*/
+
unpublished = true,
+
}]
+
async fn index(ctx: RequestContext<Context>) -> Result<Response<Body>, HttpError> {
+
instrument_handler(&ctx, async {
+
Ok(Response::builder()
+
.status(StatusCode::OK)
+
.header(http::header::CONTENT_TYPE, "text/html")
+
.body(INDEX_HTML.into())?)
+
})
+
.await
+
}
+
+
/// Serve index page as html
+
#[endpoint {
+
method = GET,
+
path = "/favicon.ico",
+
/*
+
* not useful to have this in openapi
+
*/
+
unpublished = true,
+
}]
+
async fn favicon(ctx: RequestContext<Context>) -> Result<Response<Body>, HttpError> {
+
instrument_handler(&ctx, async {
+
Ok(Response::builder()
+
.status(StatusCode::OK)
+
.header(http::header::CONTENT_TYPE, "image/x-icon")
+
.body(FAVICON.to_vec().into())?)
+
})
+
.await
+
}
+
+
/// Meta: get the openapi spec for this api
+
#[endpoint {
+
method = GET,
+
path = "/openapi",
+
/*
+
* not useful to have this in openapi
+
*/
+
unpublished = true,
+
}]
+
async fn openapi(ctx: RequestContext<Context>) -> OkCorsResponse<serde_json::Value> {
+
instrument_handler(&ctx, async {
+
let spec = (*ctx.context().spec).clone();
+
OkCors(spec).into()
+
})
+
.await
+
}
+
+
#[derive(Debug, Deserialize, JsonSchema)]
+
struct BeginOauthQuery {
+
handle: String,
+
}
+
#[endpoint {
+
method = GET,
+
path = "/auth",
+
}]
+
async fn start_oauth(
+
ctx: RequestContext<Context>,
+
query: Query<BeginOauthQuery>,
+
) -> Result<HttpResponseSeeOther, HttpError> {
+
let BeginOauthQuery { handle } = query.into_inner();
+
+
instrument_handler(&ctx, async {
+
let Context { client, .. } = ctx.context();
+
+
let auth_url = authorize(client, &handle).await;
+
+
http_response_see_other(auth_url)
+
})
+
.await
+
}
+
+
#[derive(Debug, Deserialize, JsonSchema)]
+
struct AuthorizedCallbackQuery {
+
code: String,
+
state: Option<String>,
+
iss: Option<String>,
+
}
+
impl From<AuthorizedCallbackQuery> for CallbackParams {
+
fn from(q: AuthorizedCallbackQuery) -> Self {
+
let AuthorizedCallbackQuery { code, state, iss } = q;
+
Self { code, state, iss }
+
}
+
}
+
#[endpoint {
+
method = GET,
+
path = "/authorized",
+
}]
+
async fn finish_oauth(
+
ctx: RequestContext<Context>,
+
query: Query<AuthorizedCallbackQuery>,
+
) -> Result<Response<Body>, HttpError> {
+
instrument_handler(&ctx, async {
+
let Context { client, .. } = ctx.context();
+
let params = query.into_inner();
+
+
let Ok((oauth_session, _)) = client.callback(params.into()).await else {
+
panic!("failed to do client callback");
+
};
+
+
let did = oauth_session.did().await.expect("a did to be present");
+
+
Ok(Response::builder()
+
.status(StatusCode::OK)
+
.header(http::header::CONTENT_TYPE, "text/html")
+
.body(format!("sup: {did:?}").into())?)
+
})
+
.await
+
}
who-am-i/static/favicon.ico

This is a binary file and will not be displayed.

+53
who-am-i/static/index.html
···
+
<!doctype html>
+
<html lang="en">
+
<head>
+
<meta charset="utf-8" />
+
<title>Who-am-i documentation</title>
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
+
<meta name="description" content="API Documentation who-am-i, a read-only atproto identity verifier" />
+
<style>
+
.custom-header {
+
height: 42px;
+
background-color: #221828;
+
box-shadow: inset 0 -1px 0 var(--scalar-border-color);
+
color: var(--scalar-color-1);
+
font-size: var(--scalar-font-size-3);
+
font-family: 'Iowan Old Style', 'Palatino Linotype', 'URW Palladio L', P052, serif;
+
padding: 0 18px;
+
justify-content: space-between;
+
}
+
.custom-header,
+
.custom-header nav {
+
display: flex;
+
align-items: center;
+
gap: 18px;
+
}
+
.custom-header a:hover {
+
color: var(--scalar-color-2);
+
}
+
</style>
+
</head>
+
<body>
+
<header class="custom-header scalar-app">
+
<p>
+
<a href="https://ufos.microcosm.blue">Launch who-am-i [todo]</a>
+
</p>
+
<nav>
+
<b>a <a href="https://microcosm.blue">microcosm</a> project</b>
+
<a href="https://bsky.app/profile/microcosm.blue">@microcosm.blue</a>
+
<a href="https://github.com/at-microcosm">github</a>
+
</nav>
+
</header>
+
+
<script id="api-reference" type="application/json" data-url="/openapi"></script>
+
+
<script>
+
var configuration = {
+
theme: 'purple',
+
}
+
document.getElementById('api-reference').dataset.configuration = JSON.stringify(configuration)
+
</script>
+
+
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
+
</body>
+
</html>