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