From 8f04c5e5bdbd1aaa812655e3a607b5572c582c95 Mon Sep 17 00:00:00 2001 From: Orual Date: Wed, 8 Oct 2025 01:22:22 -0400 Subject: [PATCH] version bump, need to do proper tests before release --- Cargo.lock | 13 ---------- Cargo.toml | 19 ++++++++++++++- crates/jacquard-api/Cargo.toml | 2 +- crates/jacquard-common/Cargo.toml | 14 +++++------ crates/jacquard-identity/Cargo.toml | 8 +++---- crates/jacquard-oauth/Cargo.toml | 18 +++++++------- crates/jacquard-oauth/src/request.rs | 36 +++++++++++++++++++--------- crates/jacquard/Cargo.toml | 24 +++++++++---------- crates/jacquard/tests/oauth_flow.rs | 2 +- 9 files changed, 76 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 021a82ea9..2b3222e85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -843,18 +843,6 @@ dependencies = [ "syn 2.0.106", ] -[[package]] -name = "enum_dispatch" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa18ce2bc66555b3218614519ac839ddb759a7d6720732f979ef8d13be147ecd" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.106", -] - [[package]] name = "equivalent" version = "1.0.2" @@ -1587,7 +1575,6 @@ dependencies = [ "chrono", "cid", "ed25519-dalek", - "enum_dispatch", "http", "ipld-core", "k256", diff --git a/Cargo.toml b/Cargo.toml index 10d1f68ad..5af47f1b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ members = ["crates/*"] [workspace.package] edition = "2024" -version = "0.2.0" +version = "0.3.0" authors = ["Orual "] repository = "https://tangled.org/@nonbinary.computer/jacquard" keywords = ["atproto", "at", "bluesky", "api", "client"] @@ -57,3 +57,20 @@ prettyplease = "0.2" # HTTP http = "1.3" reqwest = { version = "0.12", default-features = false } + +# Async and runtimes +async-trait = "0.1" +tokio = "1" + +# Encoding and crypto building blocks +base64 = "0.22" +percent-encoding = "2.3" +urlencoding = "2.1.3" +rand_core = "0.6" + +# Time +chrono = "0.4" + +# Crypto curves and JOSE +p256 = "0.13" +jose-jwk = "0.1" diff --git a/crates/jacquard-api/Cargo.toml b/crates/jacquard-api/Cargo.toml index 1bc0fd3a9..56e0923fe 100644 --- a/crates/jacquard-api/Cargo.toml +++ b/crates/jacquard-api/Cargo.toml @@ -22,7 +22,7 @@ com_atproto = [] tools_ozone = [] [dependencies] -bon = "3" +bon.workspace = true bytes = { workspace = true, features = ["serde"] } jacquard-common = { version = "0.2.0", path = "../jacquard-common" } jacquard-derive = { version = "0.2.0", path = "../jacquard-derive" } diff --git a/crates/jacquard-common/Cargo.toml b/crates/jacquard-common/Cargo.toml index 84b32b36b..5d2d04b29 100644 --- a/crates/jacquard-common/Cargo.toml +++ b/crates/jacquard-common/Cargo.toml @@ -13,12 +13,11 @@ license.workspace = true [dependencies] -bon = "3" -base64 = "0.22.1" +bon.workspace = true +base64.workspace = true bytes.workspace = true -chrono = "0.4.42" +chrono.workspace = true cid = { version = "0.11.1", features = ["serde", "std"] } -enum_dispatch = "0.3.13" ipld-core = { version = "0.4.2", features = ["serde"] } langtag = { version = "0.4.0", features = ["serde"] } miette.workspace = true @@ -36,8 +35,8 @@ smol_str.workspace = true thiserror.workspace = true url.workspace = true http.workspace = true -async-trait = "0.1" -tokio = { version = "1", features = ["sync"] } +async-trait.workspace = true +tokio = { workspace = true, features = ["sync"] } reqwest = { workspace = true, optional = true, features = ["charset", "http2", "json", "system-proxy", "gzip", "rustls-tls"] } serde_ipld_dagcbor.workspace = true trait-variant.workspace = true @@ -63,9 +62,8 @@ default-features = false features = ["arithmetic"] [dependencies.p256] -version = "0.13" +workspace = true optional = true -default-features = false features = ["arithmetic"] [package.metadata.docs.rs] diff --git a/crates/jacquard-identity/Cargo.toml b/crates/jacquard-identity/Cargo.toml index 1d49939df..f2a5c214c 100644 --- a/crates/jacquard-identity/Cargo.toml +++ b/crates/jacquard-identity/Cargo.toml @@ -16,14 +16,14 @@ description.workspace = true dns = ["dep:hickory-resolver"] [dependencies] -async-trait = "0.1.89" +async-trait.workspace = true bon.workspace = true bytes.workspace = true jacquard-common = { version = "0.2", path = "../jacquard-common" } -percent-encoding = "2.3.2" +percent-encoding.workspace = true reqwest.workspace = true url.workspace = true -tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs"] } +tokio = { workspace = true, features = ["macros", "rt-multi-thread", "fs"] } hickory-resolver = { optional = true, version = "0.24", default-features = false, features = ["system-config", "tokio-runtime"]} serde.workspace = true serde_json.workspace = true @@ -32,4 +32,4 @@ miette.workspace = true http.workspace = true jacquard-api = { version = "0.2.0", path = "../jacquard-api" } serde_html_form.workspace = true -urlencoding = "2.1.3" +urlencoding.workspace = true diff --git a/crates/jacquard-oauth/Cargo.toml b/crates/jacquard-oauth/Cargo.toml index 72bcae9d6..d77072330 100644 --- a/crates/jacquard-oauth/Cargo.toml +++ b/crates/jacquard-oauth/Cargo.toml @@ -1,35 +1,35 @@ [package] name = "jacquard-oauth" -version = "0.1.0" +version = "0.3.0" edition = "2024" description = "AT Protocol OAuth 2.1 core types and helpers for Jacquard" license = "MPL-2.0" [dependencies] -jacquard-common = { version = "0.2.0", path = "../jacquard-common" } +jacquard-common = { version = "0.3.0", path = "../jacquard-common" } serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } url = { workspace = true } smol_str = { workspace = true } -base64 = { version = "0.22" } +base64.workspace = true sha2 = { version = "0.10" } thiserror = { workspace = true } serde_html_form = { workspace = true } miette = { workspace = true } uuid = { version = "1", features = ["v4","std"] } -p256 = { version = "0.13", features = ["ecdsa"] } +p256 = { workspace = true, features = ["ecdsa"] } signature = "2" -rand_core = "0.6" +rand_core.workspace = true jose-jwa = "0.1" -jose-jwk = { version = "0.1", features = ["p256"] } -chrono = "0.4" +jose-jwk = { workspace = true, features = ["p256"] } +chrono.workspace = true elliptic-curve = "0.13.8" http.workspace = true bytes.workspace = true rand = { version = "0.8.5", features = ["small_rng"] } -async-trait = "0.1.89" +async-trait.workspace = true dashmap = "6.1.0" -tokio = { version = "1.47.1", features = ["sync"] } +tokio = { workspace = true, features = ["sync"] } reqwest.workspace = true trait-variant.workspace = true diff --git a/crates/jacquard-oauth/src/request.rs b/crates/jacquard-oauth/src/request.rs index d30cae25c..5b3b80b4e 100644 --- a/crates/jacquard-oauth/src/request.rs +++ b/crates/jacquard-oauth/src/request.rs @@ -43,7 +43,10 @@ const CLIENT_ASSERTION_TYPE_JWT_BEARER: &str = #[derive(Error, Debug, miette::Diagnostic)] pub enum RequestError { #[error("no {0} endpoint available")] - #[diagnostic(code(jacquard_oauth::request::no_endpoint), help("server does not advertise this endpoint"))] + #[diagnostic( + code(jacquard_oauth::request::no_endpoint), + help("server does not advertise this endpoint") + )] NoEndpoint(CowStr<'static>), #[error("token response verification failed")] #[diagnostic(code(jacquard_oauth::request::token_verification))] @@ -51,7 +54,9 @@ pub enum RequestError { #[error("unsupported authentication method")] #[diagnostic( code(jacquard_oauth::request::unsupported_auth_method), - help("server must support `private_key_jwt` or `none`; configure client metadata accordingly") + help( + "server must support `private_key_jwt` or `none`; configure client metadata accordingly" + ) )] UnsupportedAuthMethod, #[error("no refresh token available")] @@ -76,10 +81,16 @@ pub enum RequestError { #[diagnostic(code(jacquard_oauth::request::http_build))] Http(#[from] http::Error), #[error("http status: {0}")] - #[diagnostic(code(jacquard_oauth::request::http_status), help("see server response for details"))] + #[diagnostic( + code(jacquard_oauth::request::http_status), + help("see server response for details") + )] HttpStatus(StatusCode), #[error("http status: {0}, body: {1:?}")] - #[diagnostic(code(jacquard_oauth::request::http_status_body), help("server returned error JSON; inspect fields like `error`, `error_description`"))] + #[diagnostic( + code(jacquard_oauth::request::http_status_body), + help("server returned error JSON; inspect fields like `error`, `error_description`") + )] HttpStatusWithBody(StatusCode, Value), #[error(transparent)] #[diagnostic(code(jacquard_oauth::request::identity))] @@ -134,8 +145,8 @@ impl OAuthRequest<'_> { mod tests { use super::*; use crate::types::{OAuthAuthorizationServerMetadata, OAuthClientMetadata}; - use http::{Response as HttpResponse, StatusCode}; use bytes::Bytes; + use http::{Response as HttpResponse, StatusCode}; use jacquard_common::http_client::HttpClient; use jacquard_identity::resolver::IdentityResolver; use std::sync::Arc; @@ -249,7 +260,7 @@ mod tests { async fn refresh_no_refresh_token() { let client = MockClient::default(); let meta = base_metadata(); - let mut session = ClientSessionData { + let session = ClientSessionData { account_did: jacquard_common::types::string::Did::new_static("did:plc:alice").unwrap(), session_id: CowStr::from("state"), host_url: url::Url::parse("https://pds").unwrap(), @@ -284,11 +295,14 @@ mod tests { *client.resp.lock().await = Some( HttpResponse::builder() .status(StatusCode::OK) - .body(serde_json::to_vec(&serde_json::json!({ - "access_token":"tok", - "token_type":"DPoP", - "expires_in": 3600 - })).unwrap()) + .body( + serde_json::to_vec(&serde_json::json!({ + "access_token":"tok", + "token_type":"DPoP", + "expires_in": 3600 + })) + .unwrap(), + ) .unwrap(), ); let meta = base_metadata(); diff --git a/crates/jacquard/Cargo.toml b/crates/jacquard/Cargo.toml index 5b45e0fe1..d30eb4486 100644 --- a/crates/jacquard/Cargo.toml +++ b/crates/jacquard/Cargo.toml @@ -2,7 +2,7 @@ name = "jacquard" description.workspace = true edition.workspace = true -version = "0.2.1" +version = "0.3.0" authors.workspace = true repository.workspace = true keywords.workspace = true @@ -30,14 +30,14 @@ path = "src/main.rs" [dependencies] -bon = "3" -async-trait = "0.1" +bon.workspace = true +async-trait.workspace = true bytes.workspace = true clap.workspace = true http.workspace = true -jacquard-api = { version = "0.2.0", path = "../jacquard-api" } -jacquard-common = { version = "0.2.0", path = "../jacquard-common", features = ["reqwest-client"] } -jacquard-oauth = { version = "0.1.0", path = "../jacquard-oauth" } +jacquard-api = { version = "0.3.0", path = "../jacquard-api" } +jacquard-common = { version = "0.3.0", path = "../jacquard-common", features = ["reqwest-client"] } +jacquard-oauth = { version = "0.3.0", path = "../jacquard-oauth" } jacquard-derive = { version = "0.2.0", path = "../jacquard-derive", optional = true } miette = { workspace = true } reqwest = { workspace = true, features = ["charset", "http2", "json", "system-proxy", "gzip", "rustls-tls"] } @@ -46,13 +46,13 @@ serde_html_form.workspace = true serde_ipld_dagcbor.workspace = true serde_json.workspace = true thiserror.workspace = true -tokio = { version = "1", features = ["macros", "rt-multi-thread", "fs"] } +tokio = { workspace = true, features = ["macros", "rt-multi-thread", "fs"] } url.workspace = true smol_str.workspace = true -percent-encoding = "2" -urlencoding = "2" -jose-jwk = { version = "0.1", features = ["p256"] } -p256 = { version = "0.13", features = ["ecdsa"] } -rand_core = "0.6" +percent-encoding.workspace = true +urlencoding.workspace = true +jose-jwk = { workspace = true, features = ["p256"] } +p256 = { workspace = true, features = ["ecdsa"] } +rand_core.workspace = true rouille = { version = "3.6.2", optional = true } jacquard-identity = { version = "0.2.0", path = "../jacquard-identity" } diff --git a/crates/jacquard/tests/oauth_flow.rs b/crates/jacquard/tests/oauth_flow.rs index 1a2df772a..08e384b7d 100644 --- a/crates/jacquard/tests/oauth_flow.rs +++ b/crates/jacquard/tests/oauth_flow.rs @@ -239,7 +239,7 @@ async fn oauth_end_to_end_mock_flow() { keyset: None, }; let login_hint = identity.map(|_| jacquard::CowStr::from("alice.bsky.social")); - let mut auth_req = jacquard_oauth::request::par(client.as_ref(), login_hint, None, &metadata) + let auth_req = jacquard_oauth::request::par(client.as_ref(), login_hint, None, &metadata) .await .unwrap(); // Construct authorization URL as OAuthClient::start_auth would do -- 2.51.2