pub trait Signer<C: Curve>: Sync + Send {
type Error: Debug + Display;
// Required methods
fn public_key(&self) -> C::PublicKey;
fn sign(
&self,
msg: &[u8],
) -> impl Future<Output = Result<C::Signature, Self::Error>> + Send;
// Provided method
fn cache_public_key(self) -> CachePublicKey<C, Self>
where Self: Sized { ... }
}Expand description
A signer capable of producing signatures for a specific Curve.
Required Associated Types§
Required Methods§
Sourcefn public_key(&self) -> C::PublicKey
fn public_key(&self) -> C::PublicKey
Public key of the signer
Sourcefn sign(
&self,
msg: &[u8],
) -> impl Future<Output = Result<C::Signature, Self::Error>> + Send
fn sign( &self, msg: &[u8], ) -> impl Future<Output = Result<C::Signature, Self::Error>> + Send
Sign a given message and return a signature.
NOTE: implementations MAY require msg to be prehash (i.e. output
of cryptographic hash function) of a fixed length and return
an error otherwise. Check corresponding docs before using.
Provided Methods§
fn cache_public_key(self) -> CachePublicKey<C, Self>where
Self: Sized,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl Signer<P256> for SigningKey
impl Signer<P256> for SigningKey
Source§async fn sign(
&self,
prehash: &[u8],
) -> Result<<P256 as Curve>::Signature, Self::Error>
async fn sign( &self, prehash: &[u8], ) -> Result<<P256 as Curve>::Signature, Self::Error>
Sign 32-byte prehash (i.e. output of cryptographic hash function).
If given prehash is of different length, an error will be returned.
type Error = Error
fn public_key(&self) -> <P256 as Curve>::PublicKey
Source§impl Signer<Secp256k1> for SigningKey
impl Signer<Secp256k1> for SigningKey
Source§async fn sign(
&self,
prehash: &[u8],
) -> Result<<Secp256k1 as Curve>::Signature, Self::Error>
async fn sign( &self, prehash: &[u8], ) -> Result<<Secp256k1 as Curve>::Signature, Self::Error>
Sign 32-byte prehash (i.e. output of cryptographic hash function).
If given prehash is of different length, an error will be returned.