seismic_enclave/client/
mod.rs1#![allow(async_fn_in_trait)]
7pub mod http_client;
8pub mod mock_server;
9
10use crate::{
11 nonce::Nonce,
12 request_types::{coco_aa::*, coco_as::*, genesis::*, signing::*, tx_io::*},
13};
14
15pub use schnorrkel::keys::Keypair as SchnorrkelKeypair;
16
17pub trait TeeAPI {
18 async fn genesis_data(
19 &self,
20 _payload: GenesisData,
21 ) -> Result<GenesisDataResponse, anyhow::Error> {
22 Err(anyhow::Error::msg("Unimplemented"))
23 }
24
25 async fn attestation_get_evidence(
26 &self,
27 _payload: AttestationGetEvidenceRequest,
28 ) -> Result<AttestationGetEvidenceResponse, anyhow::Error> {
29 Err(anyhow::Error::msg("Unimplemented"))
30 }
31
32 async fn attestation_eval_evidence(
33 &self,
34 _payload: AttestationEvalEvidenceRequest,
35 ) -> Result<AttestationEvalEvidenceResponse, anyhow::Error> {
36 Err(anyhow::Error::msg("Unimplemented"))
37 }
38
39 async fn signing_sign(
40 &self,
41 _payload: Secp256k1SignRequest,
42 ) -> Result<Secp256k1SignResponse, anyhow::Error> {
43 Err(anyhow::Error::msg("Unimplemented"))
44 }
45
46 async fn signing_verify(
47 &self,
48 _payload: Secp256k1VerifyRequest,
49 ) -> Result<Secp256k1VerifyResponse, anyhow::Error> {
50 Err(anyhow::Error::msg("Unimplemented"))
51 }
52
53 async fn tx_io_encrypt(
54 &self,
55 _payload: IoEncryptionRequest,
56 ) -> Result<IoEncryptionResponse, anyhow::Error> {
57 Err(anyhow::Error::msg("Unimplemented"))
58 }
59
60 async fn tx_io_decrypt(
61 &self,
62 _payload: IoDecryptionRequest,
63 ) -> Result<IoDecryptionResponse, anyhow::Error> {
64 Err(anyhow::Error::msg("Unimplemented"))
65 }
66
67 async fn get_eph_rng_keypair(&self) -> Result<SchnorrkelKeypair, anyhow::Error> {
68 Err(anyhow::Error::msg("Unimplemented"))
69 }
70}
71
72pub trait WalletAPI {
73 fn encrypt(
74 &self,
75 data: Vec<u8>,
76 nonce: impl Into<Nonce>,
77 private_key: &secp256k1::SecretKey,
78 ) -> Result<Vec<u8>, anyhow::Error>;
79
80 fn decrypt(
81 &self,
82 data: Vec<u8>,
83 nonce: impl Into<Nonce>,
84 private_key: &secp256k1::SecretKey,
85 ) -> Result<Vec<u8>, anyhow::Error>;
86}