pub struct EcdsaSigner<'a> { /* private fields */ }
Available on crate feature
ecdsa
only.Expand description
Create a signer for ECDSA signatures.
Implementations§
Source§impl<'a> EcdsaSigner<'a>
impl<'a> EcdsaSigner<'a>
Sourcepub fn new(signing_key: Cow<'a, SigningKey>) -> Self
pub fn new(signing_key: Cow<'a, SigningKey>) -> Self
Create a new signer.
Sourcepub fn from_slice(signing_key: &[u8]) -> Result<SigningKey>
pub fn from_slice(signing_key: &[u8]) -> Result<SigningKey>
Initialize a signing key from a byte slice.
Sourcepub fn random() -> SigningKey
pub fn random() -> SigningKey
Generate a random private signing key.
Sourcepub fn sign_recoverable(
&self,
message: &[u8],
) -> Result<(Signature, RecoveryId)>
pub fn sign_recoverable( &self, message: &[u8], ) -> Result<(Signature, RecoveryId)>
Sign the given message, hashing it with the curve’s default digest function, and returning a signature and recovery ID.
Sourcepub fn sign_prehash_recoverable(
&self,
prehash: &[u8],
) -> Result<(Signature, RecoveryId)>
pub fn sign_prehash_recoverable( &self, prehash: &[u8], ) -> Result<(Signature, RecoveryId)>
Sign the given message prehash, returning a signature and recovery ID.
Sourcepub fn verifying_key(&self) -> &VerifyingKey
pub fn verifying_key(&self) -> &VerifyingKey
Verifying key for this signer.
Sourcepub fn verify_prehash(
&self,
prehash: &[u8],
signature: &Signature,
) -> Result<()>
pub fn verify_prehash( &self, prehash: &[u8], signature: &Signature, ) -> Result<()>
Verify a prehash message.
Sourcepub fn sign_eth(&self, message: &[u8]) -> Result<(Signature, RecoveryId)>
pub fn sign_eth(&self, message: &[u8]) -> Result<(Signature, RecoveryId)>
Sign a message for Ethereum first hashing the message with the Keccak256 digest.
Sourcepub fn sign_eth_message<B: AsRef<[u8]>>(
&self,
message: B,
) -> Result<(Signature, RecoveryId)>
pub fn sign_eth_message<B: AsRef<[u8]>>( &self, message: B, ) -> Result<(Signature, RecoveryId)>
Sign an Ethereum message.
Sourcepub fn recover(
message: &[u8],
signature: RecoverableSignature,
) -> Result<VerifyingKey>
pub fn recover( message: &[u8], signature: RecoverableSignature, ) -> Result<VerifyingKey>
Recover the public key from a signature and recovery identifier.
Auto Trait Implementations§
impl<'a> Freeze for EcdsaSigner<'a>
impl<'a> RefUnwindSafe for EcdsaSigner<'a>
impl<'a> Send for EcdsaSigner<'a>
impl<'a> Sync for EcdsaSigner<'a>
impl<'a> Unpin for EcdsaSigner<'a>
impl<'a> UnwindSafe for EcdsaSigner<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more