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

log a few errors that were dropped + atrium fork

atrium fork for the https handle method fix

Changed files
+148 -48
jetstream
slingshot
+108 -18
Cargo.lock
··· 306 306 source = "registry+https://github.com/rust-lang/crates.io-index" 307 307 checksum = "46355d3245edc7b3160b2a45fe55d09a6963ebd3eee0252feb6b72fb0eb71463" 308 308 dependencies = [ 309 - "atrium-common", 310 - "atrium-xrpc", 309 + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 310 + "atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 311 + "chrono", 312 + "http", 313 + "ipld-core", 314 + "langtag", 315 + "regex", 316 + "serde", 317 + "serde_bytes", 318 + "serde_json", 319 + "thiserror 1.0.69", 320 + "tokio", 321 + "trait-variant", 322 + ] 323 + 324 + [[package]] 325 + name = "atrium-api" 326 + version = "0.25.4" 327 + source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" 328 + dependencies = [ 329 + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 330 + "atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 311 331 "chrono", 312 332 "http", 313 333 "ipld-core", ··· 337 357 ] 338 358 339 359 [[package]] 360 + name = "atrium-common" 361 + version = "0.1.2" 362 + source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" 363 + dependencies = [ 364 + "dashmap", 365 + "lru", 366 + "moka", 367 + "thiserror 1.0.69", 368 + "tokio", 369 + "trait-variant", 370 + "web-time", 371 + ] 372 + 373 + [[package]] 340 374 name = "atrium-identity" 341 375 version = "0.1.5" 342 376 source = "registry+https://github.com/rust-lang/crates.io-index" 343 377 checksum = "c9e2d42bb4dbea038f4f5f45e3af2a89d61a9894a75f06aa550b74a60d2be380" 344 378 dependencies = [ 345 - "atrium-api", 346 - "atrium-common", 347 - "atrium-xrpc", 379 + "atrium-api 0.25.4 (registry+https://github.com/rust-lang/crates.io-index)", 380 + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 381 + "atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 382 + "serde", 383 + "serde_html_form", 384 + "serde_json", 385 + "thiserror 1.0.69", 386 + "trait-variant", 387 + ] 388 + 389 + [[package]] 390 + name = "atrium-identity" 391 + version = "0.1.5" 392 + source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" 393 + dependencies = [ 394 + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 395 + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 396 + "atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 348 397 "serde", 349 398 "serde_html_form", 350 399 "serde_json", ··· 358 407 source = "registry+https://github.com/rust-lang/crates.io-index" 359 408 checksum = "ca22dc4eaf77fd9bf050b21192ac58cd654a437d28e000ec114ebd93a51d36f5" 360 409 dependencies = [ 361 - "atrium-api", 362 - "atrium-common", 363 - "atrium-identity", 364 - "atrium-xrpc", 410 + "atrium-api 0.25.4 (registry+https://github.com/rust-lang/crates.io-index)", 411 + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 412 + "atrium-identity 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 413 + "atrium-xrpc 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)", 414 + "base64 0.22.1", 415 + "chrono", 416 + "dashmap", 417 + "ecdsa", 418 + "elliptic-curve", 419 + "jose-jwa", 420 + "jose-jwk", 421 + "p256", 422 + "rand 0.8.5", 423 + "reqwest", 424 + "serde", 425 + "serde_html_form", 426 + "serde_json", 427 + "sha2", 428 + "thiserror 1.0.69", 429 + "tokio", 430 + "trait-variant", 431 + ] 432 + 433 + [[package]] 434 + name = "atrium-oauth" 435 + version = "0.1.3" 436 + source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" 437 + dependencies = [ 438 + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 439 + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 440 + "atrium-identity 0.1.5 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 441 + "atrium-xrpc 0.12.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 365 442 "base64 0.22.1", 366 443 "chrono", 367 444 "dashmap", ··· 396 473 ] 397 474 398 475 [[package]] 476 + name = "atrium-xrpc" 477 + version = "0.12.3" 478 + source = "git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace#80a355991ac9b48ba3f559d12aac74f071fc638c" 479 + dependencies = [ 480 + "http", 481 + "serde", 482 + "serde_html_form", 483 + "serde_json", 484 + "thiserror 1.0.69", 485 + "trait-variant", 486 + ] 487 + 488 + [[package]] 399 489 name = "auto_enums" 400 490 version = "0.8.7" 401 491 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 2642 2732 dependencies = [ 2643 2733 "anyhow", 2644 2734 "async-trait", 2645 - "atrium-api", 2735 + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 2646 2736 "chrono", 2647 2737 "clap", 2648 2738 "futures-util", ··· 4916 5006 name = "slingshot" 4917 5007 version = "0.1.0" 4918 5008 dependencies = [ 4919 - "atrium-api", 4920 - "atrium-common", 4921 - "atrium-identity", 4922 - "atrium-oauth", 5009 + "atrium-api 0.25.4 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 5010 + "atrium-common 0.1.2 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 5011 + "atrium-identity 0.1.5 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 5012 + "atrium-oauth 0.1.3 (git+https://github.com/uniphil/atrium.git?branch=fix%2Fresolve-handle-https-accept-whitespace)", 4923 5013 "clap", 4924 5014 "ctrlc", 4925 5015 "foyer", ··· 6009 6099 name = "who-am-i" 6010 6100 version = "0.1.0" 6011 6101 dependencies = [ 6012 - "atrium-api", 6013 - "atrium-common", 6014 - "atrium-identity", 6015 - "atrium-oauth", 6102 + "atrium-api 0.25.4 (registry+https://github.com/rust-lang/crates.io-index)", 6103 + "atrium-common 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 6104 + "atrium-identity 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 6105 + "atrium-oauth 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 6016 6106 "axum", 6017 6107 "axum-extra", 6018 6108 "axum-template",
+1 -1
jetstream/Cargo.toml
··· 10 10 11 11 [dependencies] 12 12 async-trait = "0.1.83" 13 - atrium-api = { version = "0.25.4", default-features = false, features = [ 13 + atrium-api = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace", default-features = false, features = [ 14 14 "namespace-appbsky", 15 15 ] } 16 16 tokio = { version = "1.44.2", features = ["full", "sync", "time"] }
+4 -4
slingshot/Cargo.toml
··· 4 4 edition = "2024" 5 5 6 6 [dependencies] 7 - atrium-api = { version = "0.25.4", default-features = false } 8 - atrium-common = "0.1.2" 9 - atrium-identity = "0.1.5" 10 - atrium-oauth = "0.1.3" 7 + atrium-api = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace", default-features = false } 8 + atrium-common = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace" } 9 + atrium-identity = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace" } 10 + atrium-oauth = { git = "https://github.com/uniphil/atrium.git", branch = "fix/resolve-handle-https-accept-whitespace" } 11 11 clap = { version = "4.5.41", features = ["derive"] } 12 12 ctrlc = "3.4.7" 13 13 foyer = { version = "0.18.0", features = ["serde"] }
+4 -3
slingshot/src/identity.rs
··· 240 240 Err(atrium_identity::Error::NotFound) => { 241 241 Ok(IdentityVal(UtcDateTime::now(), IdentityData::NotFound)) 242 242 } 243 - Err(other) => Err(foyer::Error::Other(Box::new( 244 - IdentityError::ResolutionFailed(other), 245 - ))), 243 + Err(other) => Err(foyer::Error::Other(Box::new({ 244 + log::debug!("other error resolving handle: {other:?}"); 245 + IdentityError::ResolutionFailed(other) 246 + }))), 246 247 } 247 248 } 248 249 })
+31 -22
slingshot/src/server.rs
··· 439 439 let Ok(alleged_handle) = Handle::new(identifier) else { 440 440 return invalid("identifier was not a valid DID or handle"); 441 441 }; 442 - if let Ok(res) = self.identity.handle_to_did(alleged_handle.clone()).await { 443 - if let Some(did) = res { 444 - // we did it joe 445 - unverified_handle = Some(alleged_handle); 446 - did 447 - } else { 448 - return invalid("Could not resolve handle identifier to a DID"); 442 + 443 + match self.identity.handle_to_did(alleged_handle.clone()).await { 444 + Ok(res) => { 445 + if let Some(did) = res { 446 + // we did it joe 447 + unverified_handle = Some(alleged_handle); 448 + did 449 + } else { 450 + return invalid("Could not resolve handle identifier to a DID"); 451 + } 452 + } 453 + Err(e) => { 454 + log::debug!("failed to resolve handle: {e}"); 455 + // TODO: ServerError not BadRequest 456 + return invalid("errored while trying to resolve handle to DID"); 449 457 } 450 - } else { 451 - // TODO: ServerError not BadRequest 452 - return invalid("errored while trying to resolve handle to DID"); 453 458 } 454 459 } 455 460 }; ··· 514 519 "repo was not a valid DID or handle", 515 520 )); 516 521 }; 517 - if let Ok(res) = self.identity.handle_to_did(handle).await { 518 - if let Some(did) = res { 519 - did 520 - } else { 521 - return GetRecordResponse::BadRequest(xrpc_error( 522 - "InvalidRequest", 523 - "Could not resolve handle repo to a DID", 522 + match self.identity.handle_to_did(handle).await { 523 + Ok(res) => { 524 + if let Some(did) = res { 525 + did 526 + } else { 527 + return GetRecordResponse::BadRequest(xrpc_error( 528 + "InvalidRequest", 529 + "Could not resolve handle repo to a DID", 530 + )); 531 + } 532 + } 533 + Err(e) => { 534 + log::debug!("handle resolution failed: {e}"); 535 + return GetRecordResponse::ServerError(xrpc_error( 536 + "ResolutionFailed", 537 + "errored while trying to resolve handle to DID", 524 538 )); 525 539 } 526 - } else { 527 - return GetRecordResponse::ServerError(xrpc_error( 528 - "ResolutionFailed", 529 - "errored while trying to resolve handle to DID", 530 - )); 531 540 } 532 541 } 533 542 };