diff --git a/Cargo.lock b/Cargo.lock index e9cda1e..30951c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -306,8 +306,28 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46355d3245edc7b3160b2a45fe55d09a6963ebd3eee0252feb6b72fb0eb71463" dependencies = [ - "atrium-common", - "atrium-xrpc", + "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-api" +version = "0.25.4" +source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" +dependencies = [ + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", "chrono", "http", "ipld-core", @@ -336,15 +356,44 @@ dependencies = [ "web-time", ] +[[package]] +name = "atrium-common" +version = "0.1.2" +source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" +dependencies = [ + "dashmap", + "lru", + "moka", + "thiserror 1.0.69", + "tokio", + "trait-variant", + "web-time", +] + [[package]] name = "atrium-identity" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c9e2d42bb4dbea038f4f5f45e3af2a89d61a9894a75f06aa550b74a60d2be380" dependencies = [ - "atrium-api", - "atrium-common", - "atrium-xrpc", + "atrium-api 0.25.4 (registry+https://github.com/rust-lang/crates.io-index)", + "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-identity" +version = "0.1.5" +source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" +dependencies = [ + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", "serde", "serde_html_form", "serde_json", @@ -358,10 +407,38 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca22dc4eaf77fd9bf050b21192ac58cd654a437d28e000ec114ebd93a51d36f5" dependencies = [ - "atrium-api", - "atrium-common", - "atrium-identity", - "atrium-xrpc", + "atrium-api 0.25.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atrium-identity 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "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-oauth" +version = "0.1.3" +source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" +dependencies = [ + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-identity 0.1.5 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", "base64 0.22.1", "chrono", "dashmap", @@ -395,6 +472,19 @@ dependencies = [ "trait-variant", ] +[[package]] +name = "atrium-xrpc" +version = "0.12.3" +source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" +dependencies = [ + "http", + "serde", + "serde_html_form", + "serde_json", + "thiserror 1.0.69", + "trait-variant", +] + [[package]] name = "auto_enums" version = "0.8.7" @@ -2642,7 +2732,7 @@ version = "0.1.1" dependencies = [ "anyhow", "async-trait", - "atrium-api", + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", "chrono", "clap", "futures-util", @@ -4916,10 +5006,10 @@ dependencies = [ name = "slingshot" version = "0.1.0" dependencies = [ - "atrium-api", - "atrium-common", - "atrium-identity", - "atrium-oauth", + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-identity 0.1.5 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", + "atrium-oauth 0.1.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", "clap", "ctrlc", "foyer", @@ -6009,10 +6099,10 @@ dependencies = [ name = "who-am-i" version = "0.1.0" dependencies = [ - "atrium-api", - "atrium-common", - "atrium-identity", - "atrium-oauth", + "atrium-api 0.25.4 (registry+https://github.com/rust-lang/crates.io-index)", + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "atrium-identity 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "atrium-oauth 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "axum", "axum-extra", "axum-template", diff --git a/jetstream/Cargo.toml b/jetstream/Cargo.toml index 96bd42d..1eadecd 100644 --- a/jetstream/Cargo.toml +++ b/jetstream/Cargo.toml @@ -10,7 +10,7 @@ readme = "README.md" [dependencies] async-trait = "0.1.83" -atrium-api = { version = "0.25.4", default-features = false, features = [ +atrium-api = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace", default-features = false, features = [ "namespace-appbsky", ] } tokio = { version = "1.44.2", features = ["full", "sync", "time"] } diff --git a/slingshot/Cargo.toml b/slingshot/Cargo.toml index 06a97a5..9991b65 100644 --- a/slingshot/Cargo.toml +++ b/slingshot/Cargo.toml @@ -4,10 +4,10 @@ version = "0.1.0" edition = "2024" [dependencies] -atrium-api = { version = "0.25.4", default-features = false } -atrium-common = "0.1.2" -atrium-identity = "0.1.5" -atrium-oauth = "0.1.3" +atrium-api = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace", default-features = false } +atrium-common = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace" } +atrium-identity = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace" } +atrium-oauth = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace" } clap = { version = "4.5.41", features = ["derive"] } ctrlc = "3.4.7" foyer = { version = "0.18.0", features = ["serde"] } diff --git a/slingshot/src/identity.rs b/slingshot/src/identity.rs index 1abd0d0..80e5286 100644 --- a/slingshot/src/identity.rs +++ b/slingshot/src/identity.rs @@ -240,9 +240,10 @@ impl Identity { Err(atrium_identity::Error::NotFound) => { Ok(IdentityVal(UtcDateTime::now(), IdentityData::NotFound)) } - Err(other) => Err(foyer::Error::Other(Box::new( - IdentityError::ResolutionFailed(other), - ))), + Err(other) => Err(foyer::Error::Other(Box::new({ + log::debug!("other error resolving handle: {other:?}"); + IdentityError::ResolutionFailed(other) + }))), } } }) diff --git a/slingshot/src/server.rs b/slingshot/src/server.rs index 9066da1..5abec05 100644 --- a/slingshot/src/server.rs +++ b/slingshot/src/server.rs @@ -439,17 +439,22 @@ impl Xrpc { let Ok(alleged_handle) = Handle::new(identifier) else { return invalid("identifier was not a valid DID or handle"); }; - if let Ok(res) = self.identity.handle_to_did(alleged_handle.clone()).await { - if let Some(did) = res { - // we did it joe - unverified_handle = Some(alleged_handle); - did - } else { - return invalid("Could not resolve handle identifier to a DID"); + + match self.identity.handle_to_did(alleged_handle.clone()).await { + Ok(res) => { + if let Some(did) = res { + // we did it joe + unverified_handle = Some(alleged_handle); + did + } else { + return invalid("Could not resolve handle identifier to a DID"); + } + } + Err(e) => { + log::debug!("failed to resolve handle: {e}"); + // TODO: ServerError not BadRequest + return invalid("errored while trying to resolve handle to DID"); } - } else { - // TODO: ServerError not BadRequest - return invalid("errored while trying to resolve handle to DID"); } } }; @@ -514,20 +519,24 @@ impl Xrpc { "repo was not a valid DID or handle", )); }; - if let Ok(res) = self.identity.handle_to_did(handle).await { - if let Some(did) = res { - did - } else { - return GetRecordResponse::BadRequest(xrpc_error( - "InvalidRequest", - "Could not resolve handle repo to a DID", + match self.identity.handle_to_did(handle).await { + Ok(res) => { + if let Some(did) = res { + did + } else { + return GetRecordResponse::BadRequest(xrpc_error( + "InvalidRequest", + "Could not resolve handle repo to a DID", + )); + } + } + Err(e) => { + log::debug!("handle resolution failed: {e}"); + return GetRecordResponse::ServerError(xrpc_error( + "ResolutionFailed", + "errored while trying to resolve handle to DID", )); } - } else { - return GetRecordResponse::ServerError(xrpc_error( - "ResolutionFailed", - "errored while trying to resolve handle to DID", - )); } } };