fuel_core_interfaces/
signer.rs1use crate::common::fuel_types::Bytes32;
2use async_trait::async_trait;
3use thiserror::Error;
4
5#[async_trait]
8pub trait Signer {
9 async fn sign(&self, hash: &Bytes32) -> Result<Bytes32, SignerError>;
10}
11
12#[derive(Error, Debug)]
13pub enum SignerError {
14 #[error("Private key not loaded")]
15 KeyNotLoaded,
16}
17
18#[cfg(any(test, feature = "test-helpers"))]
19pub mod helpers {
20 use super::*;
21
22 pub struct DummySigner {}
23
24 #[async_trait]
25 impl Signer for DummySigner {
26 async fn sign(&self, hash: &Bytes32) -> Result<Bytes32, SignerError> {
27 Ok(*hash)
28 }
29 }
30}