From b272b4e3b87a95e962d3a6743908ada40ef6e92a Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Thu, 18 Apr 2024 16:08:41 +0900 Subject: [PATCH 1/3] add header doc --- httpsig-hyper/src/lib.rs | 6 ++++++ httpsig/src/lib.rs | 7 +++++++ httpsig/src/signature_base.rs | 1 + 3 files changed, 14 insertions(+) diff --git a/httpsig-hyper/src/lib.rs b/httpsig-hyper/src/lib.rs index 6fdb012..a3fb303 100644 --- a/httpsig-hyper/src/lib.rs +++ b/httpsig-hyper/src/lib.rs @@ -1,3 +1,9 @@ +//! # httpsig-hyper +//! +//! `httpsig-hyper` is a crate that provides a convenient API for `Hyper` users to handle HTTP signatures. +//! This crate extends hyper's https request and response messages with the ability to generate and verify HTTP signatures. +//! Additionally it also provides a way to set and verify content-digest header. + mod error; mod hyper_content_digest; mod hyper_http; diff --git a/httpsig/src/lib.rs b/httpsig/src/lib.rs index ddc9f36..e45b7ea 100644 --- a/httpsig/src/lib.rs +++ b/httpsig/src/lib.rs @@ -1,3 +1,10 @@ +//! # httpsig +//! +//! `httpsig` is a library for raw HTTP Signature. +//! It provides a simple API for signing and verifying HTTP messages, and does not depends on any HTTP framework. +//! It simply handles header keys and values in `String` or `&str` as HTTP message components, which means it can be used in any HTTP framework but requires complicated handling of HTTP headers. +//! We thus recommend to use [`httpsig-hyper`](https://crates.io/crates/httpsig-hyper) for `Hyper`` users, which provides a more convenient API. + mod crypto; mod error; mod message_component; diff --git a/httpsig/src/signature_base.rs b/httpsig/src/signature_base.rs index b32b0f4..04da34a 100644 --- a/httpsig/src/signature_base.rs +++ b/httpsig/src/signature_base.rs @@ -119,6 +119,7 @@ impl HttpSignatureHeaders { } #[derive(Debug, Clone)] +/// Wrapper struct of raw signature bytes pub struct HttpSignature(Vec); impl std::fmt::Display for HttpSignature { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { From 32ac2f5c8a0ac8ab5ea85eadaa39f7dd370bcf60 Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Tue, 30 Apr 2024 13:55:58 +0900 Subject: [PATCH 2/3] chore: deps --- httpsig-hyper/Cargo.toml | 2 +- httpsig/Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/httpsig-hyper/Cargo.toml b/httpsig-hyper/Cargo.toml index c3bdf27..285c095 100644 --- a/httpsig-hyper/Cargo.toml +++ b/httpsig-hyper/Cargo.toml @@ -15,7 +15,7 @@ rust-version.workspace = true [dependencies] httpsig = { path = "../httpsig", version = "0.0.15" } -thiserror = { version = "1.0.58" } +thiserror = { version = "1.0.59" } tracing = { version = "0.1.40" } futures = { version = "0.3.30", default-features = false, features = [ "std", diff --git a/httpsig/Cargo.toml b/httpsig/Cargo.toml index 8acb9c3..bd29983 100644 --- a/httpsig/Cargo.toml +++ b/httpsig/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -thiserror = { version = "1.0.58" } +thiserror = { version = "1.0.59" } tracing = { version = "0.1.40" } rustc-hash = { version = "1.1.0" } indexmap = { version = "2.2.6" } From 3b77805a43905e02f063a5405c22eac39390d085 Mon Sep 17 00:00:00 2001 From: Jun Kurihara Date: Wed, 5 Jun 2024 11:50:31 +0900 Subject: [PATCH 3/3] chore: deps --- httpsig-hyper/Cargo.toml | 6 +++--- httpsig-hyper/src/hyper_http.rs | 4 ++-- httpsig/Cargo.toml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/httpsig-hyper/Cargo.toml b/httpsig-hyper/Cargo.toml index 285c095..241b112 100644 --- a/httpsig-hyper/Cargo.toml +++ b/httpsig-hyper/Cargo.toml @@ -15,7 +15,7 @@ rust-version.workspace = true [dependencies] httpsig = { path = "../httpsig", version = "0.0.15" } -thiserror = { version = "1.0.59" } +thiserror = { version = "1.0.61" } tracing = { version = "0.1.40" } futures = { version = "0.3.30", default-features = false, features = [ "std", @@ -28,7 +28,7 @@ sha2 = { version = "0.10.8", default-features = false } sfv = { version = "0.9.4" } # encoding -base64 = { version = "0.22.0" } +base64 = { version = "0.22.1" } # for request and response headers http = { version = "1.1.0" } @@ -38,7 +38,7 @@ bytes = { version = "1.6.0" } [dev-dependencies] -tokio = { version = "1.37.0", default-features = false, features = [ +tokio = { version = "1.38.0", default-features = false, features = [ "macros", "rt-multi-thread", ] } # testing only diff --git a/httpsig-hyper/src/hyper_http.rs b/httpsig-hyper/src/hyper_http.rs index 938c092..7317d54 100644 --- a/httpsig-hyper/src/hyper_http.rs +++ b/httpsig-hyper/src/hyper_http.rs @@ -176,7 +176,7 @@ where T: SigningKey + Sync, { self - .set_message_signatures(&[(&signature_params, signing_key, signature_name)]) + .set_message_signatures(&[(signature_params, signing_key, signature_name)]) .await } @@ -293,7 +293,7 @@ where B: Sync, { self - .set_message_signatures(&[(&signature_params, signing_key, signature_name)], req_for_param) + .set_message_signatures(&[(signature_params, signing_key, signature_name)], req_for_param) .await } diff --git a/httpsig/Cargo.toml b/httpsig/Cargo.toml index bd29983..59e7119 100644 --- a/httpsig/Cargo.toml +++ b/httpsig/Cargo.toml @@ -13,7 +13,7 @@ rust-version.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -thiserror = { version = "1.0.59" } +thiserror = { version = "1.0.61" } tracing = { version = "0.1.40" } rustc-hash = { version = "1.1.0" } indexmap = { version = "2.2.6" } @@ -43,7 +43,7 @@ sha2 = { version = "0.10.8", default-features = false } bytes = { version = "1.6.0" } # encoding -base64 = { version = "0.22.0" } +base64 = { version = "0.22.1" } # for rfc8941 structured field values sfv = { version = "0.9.4" }