miden_node_utils/
signer.rs1use core::convert::Infallible;
2use core::error;
3
4use miden_protocol::block::BlockHeader;
5use miden_protocol::crypto::dsa::ecdsa_k256_keccak::{PublicKey, SecretKey, Signature};
6
7pub trait BlockSigner {
15 type Error: error::Error + Send + Sync + 'static;
16 fn sign(
17 &self,
18 header: &BlockHeader,
19 ) -> impl Future<Output = Result<Signature, Self::Error>> + Send;
20 fn public_key(&self) -> PublicKey;
21}
22
23impl BlockSigner for SecretKey {
27 type Error = Infallible;
28
29 async fn sign(&self, header: &BlockHeader) -> Result<Signature, Self::Error> {
30 Ok(self.sign(header.commitment()))
31 }
32
33 fn public_key(&self) -> PublicKey {
34 self.public_key()
35 }
36}