File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -135,7 +135,14 @@ pub trait MessageSignatureRes {
135135
136136/* --------------------------------------- */
137137#[ cfg( feature = "blocking" ) ]
138- /// A trait about http message signature for request with synchronous signing/verifying key
138+ /// Synchronous counterpart of [`MessageSignatureReq`].
139+ ///
140+ /// Every method delegates to the corresponding async method via `futures::executor::block_on`.
141+ ///
142+ /// # Panics
143+ ///
144+ /// All methods will panic if called from within an async runtime (e.g. a `tokio` task).
145+ /// Use the async [`MessageSignatureReq`] methods instead when you are already in an async context.
139146pub trait MessageSignatureReqSync : MessageSignatureReq {
140147 fn set_message_signature_sync < T > (
141148 & mut self ,
@@ -170,7 +177,14 @@ pub trait MessageSignatureReqSync: MessageSignatureReq {
170177}
171178
172179#[ cfg( feature = "blocking" ) ]
173- /// A trait about http message signature for response with synchronous signing/verifying key
180+ /// Synchronous counterpart of [`MessageSignatureRes`].
181+ ///
182+ /// Every method delegates to the corresponding async method via `futures::executor::block_on`.
183+ ///
184+ /// # Panics
185+ ///
186+ /// All methods will panic if called from within an async runtime (e.g. a `tokio` task).
187+ /// Use the async [`MessageSignatureRes`] methods instead when you are already in an async context.
174188pub trait MessageSignatureResSync : MessageSignatureRes {
175189 fn set_message_signature_sync < T , B > (
176190 & mut self ,
Original file line number Diff line number Diff line change 11//! # httpsig-hyper
22//!
33//! `httpsig-hyper` is a crate that provides a convenient API for `Hyper` users to handle HTTP signatures.
4- //! This crate extends hyper's https request and response messages with the ability to generate and verify HTTP signatures.
4+ //! This crate extends hyper's http request and response messages with the ability to generate and verify HTTP signatures.
55//! Additionally it also provides a way to set and verify content-digest header.
6+ //!
7+ //! ## Async-first design
8+ //!
9+ //! The primary API is fully async, allowing concurrent processing of multiple signatures via
10+ //! [`MessageSignatureReq`] and [`MessageSignatureRes`].
11+ //!
12+ //! ## Blocking API
13+ //!
14+ //! When the `blocking` feature is enabled (on by default), synchronous wrappers are provided via
15+ //! [`MessageSignatureReqSync`] and [`MessageSignatureResSync`]. These use `futures::executor::block_on`
16+ //! internally and are intended **exclusively for non-async contexts**.
17+ //!
18+ //! # Panics
19+ //!
20+ //! Calling any `*_sync` method from within an async runtime (e.g. inside a `tokio::spawn` task)
21+ //! will panic. If you are already in an async context, use the async methods directly.
622
723mod error;
824mod hyper_content_digest;
You can’t perform that action at this time.
0 commit comments