1use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct TeeRequest {
6 pub id: String,
7 pub method: String,
8 pub params: serde_json::Value,
9 pub timestamp: i64,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct TeeResponse {
14 pub id: String,
15 pub success: bool,
16 pub data: Option<serde_json::Value>,
17 pub signature: Option<String>,
18 pub error: Option<String>,
19}
20
21impl TeeResponse {
22 pub fn success(id: String, data: serde_json::Value) -> Self {
23 Self { id, success: true, data: Some(data), signature: None, error: None }
24 }
25
26 pub fn error(id: String, error: String) -> Self {
27 Self { id, success: false, data: None, signature: None, error: Some(error) }
28 }
29}