@@ -20,79 +20,16 @@ pub use signature::{self, Error};
2020#[ cfg( feature = "digest" ) ]
2121pub use signature:: digest:: { self , Digest } ;
2222
23- #[ cfg( feature = "rand_core" ) ]
24- use signature:: rand_core:: CryptoRngCore ;
25-
26- /// Asynchronously sign the provided message bytestring using `Self`
27- /// (e.g. client for a Cloud KMS or HSM), returning a digital signature.
28- ///
29- /// This trait is an async equivalent of the [`signature::Signer`] trait.
30- #[ allow( async_fn_in_trait) ]
31- pub trait AsyncSigner < S > {
32- /// Attempt to sign the given message, returning a digital signature on
33- /// success, or an error if something went wrong.
34- ///
35- /// The main intended use case for signing errors is when communicating
36- /// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.
37- async fn sign_async ( & self , msg : & [ u8 ] ) -> Result < S , Error > ;
38- }
23+ #[ deprecated( since = "0.6.0" , note = "use `signature::AsyncSigner` instead" ) ]
24+ pub use signature:: AsyncSigner ;
3925
40- impl < S , T > AsyncSigner < S > for T
41- where
42- T : signature:: Signer < S > ,
43- {
44- async fn sign_async ( & self , msg : & [ u8 ] ) -> Result < S , Error > {
45- self . try_sign ( msg)
46- }
47- }
48-
49- /// Asynchronously sign the given prehashed message [`Digest`] using `Self`.
50- ///
51- /// This trait is an async equivalent of the [`signature::DigestSigner`] trait.
5226#[ cfg( feature = "digest" ) ]
53- #[ allow( async_fn_in_trait) ]
54- pub trait AsyncDigestSigner < D , S >
55- where
56- D : Digest ,
57- {
58- /// Attempt to sign the given prehashed message [`Digest`], returning a
59- /// digital signature on success, or an error if something went wrong.
60- async fn sign_digest_async ( & self , digest : D ) -> Result < S , Error > ;
61- }
27+ #[ deprecated( since = "0.6.0" , note = "use `signature::AsyncDigestSigner` instead" ) ]
28+ pub use signature:: AsyncDigestSigner ;
6229
63- /// Sign the given message using the provided external randomness source.
6430#[ cfg( feature = "rand_core" ) ]
65- #[ allow( async_fn_in_trait) ]
66- pub trait AsyncRandomizedSigner < S > {
67- /// Sign the given message and return a digital signature
68- async fn sign_with_rng_async ( & self , rng : & mut impl CryptoRngCore , msg : & [ u8 ] ) -> S {
69- self . try_sign_with_rng_async ( rng, msg)
70- . await
71- . expect ( "signature operation failed" )
72- }
73-
74- /// Attempt to sign the given message, returning a digital signature on
75- /// success, or an error if something went wrong.
76- ///
77- /// The main intended use case for signing errors is when communicating
78- /// with external signers, e.g. cloud KMS, HSMs, or other hardware tokens.
79- async fn try_sign_with_rng_async (
80- & self ,
81- rng : & mut impl CryptoRngCore ,
82- msg : & [ u8 ] ,
83- ) -> Result < S , Error > ;
84- }
85-
86- #[ cfg( feature = "rand_core" ) ]
87- impl < S , T > AsyncRandomizedSigner < S > for T
88- where
89- T : signature:: RandomizedSigner < S > ,
90- {
91- async fn try_sign_with_rng_async (
92- & self ,
93- rng : & mut impl CryptoRngCore ,
94- msg : & [ u8 ] ,
95- ) -> Result < S , Error > {
96- self . try_sign_with_rng ( rng, msg)
97- }
98- }
31+ #[ deprecated(
32+ since = "0.6.0" ,
33+ note = "use `signature::AsyncRandomizedSigner` instead"
34+ ) ]
35+ pub use signature:: AsyncRandomizedSigner ;
0 commit comments