1use serde::{Deserialize, Serialize};
2use std::collections::HashMap;
3
4use crate::network::NagaEndpoints;
5
6#[derive(Clone, Debug)]
7pub struct Endpoints {
8 pub naga: NagaEndpoints,
9}
10
11#[derive(Debug, Deserialize, Serialize, Clone)]
12#[serde(rename_all = "camelCase")]
13pub struct HandshakeRequestData {
14 pub client_public_key: String,
15 pub challenge: String,
16 #[serde(skip_serializing_if = "Option::is_none")]
17 pub epoch: Option<u64>,
18}
19
20#[derive(Debug, Deserialize, Serialize, Clone)]
21#[serde(rename_all = "camelCase")]
22pub struct RawHandshakeResponse {
23 pub server_public_key: String,
24 pub subnet_public_key: String,
25 pub network_public_key: String,
26 pub network_public_key_set: String,
27 pub client_sdk_version: String,
28 pub hd_root_pubkeys: Vec<String>,
29 #[serde(default)]
30 pub attestation: Option<serde_json::Value>,
31 pub latest_blockhash: String,
32 pub node_version: String,
33 pub epoch: u64,
34 pub node_identity_key: String,
35}
36
37#[derive(Debug, Deserialize, Serialize, Clone)]
38#[serde(rename_all = "camelCase")]
39pub struct ResolvedHandshakeResponse {
40 pub subnet_pub_key: String,
41 pub network_pub_key: String,
42 pub network_pub_key_set: String,
43 pub hd_root_pubkeys: Vec<String>,
44 pub latest_blockhash: String,
45}
46
47#[derive(Debug, Clone)]
48pub struct OrchestrateHandshakeResponse {
49 pub server_keys: HashMap<String, RawHandshakeResponse>,
50 pub connected_nodes: Vec<String>,
51 pub core_node_config: ResolvedHandshakeResponse,
52 pub threshold: usize,
53 pub epoch: u64,
54}
55
56#[derive(Debug, Clone)]
57pub struct EncryptParams {
58 pub data_to_encrypt: Vec<u8>,
59 pub unified_access_control_conditions: Option<serde_json::Value>,
60 pub hashed_access_control_conditions_hex: Option<String>,
61 pub metadata: Option<serde_json::Value>,
62}
63
64#[derive(Debug, Clone)]
65pub struct EncryptResponse {
66 pub ciphertext_base64: String,
67 pub data_to_encrypt_hash_hex: String,
68 pub metadata: Option<serde_json::Value>,
69}
70
71#[derive(Debug, Clone)]
72pub struct DecryptParams {
73 pub ciphertext_base64: String,
74 pub data_to_encrypt_hash_hex: String,
75 pub unified_access_control_conditions: Option<serde_json::Value>,
76 pub hashed_access_control_conditions_hex: Option<String>,
77}
78
79#[derive(Debug, Clone)]
80pub struct DecryptResponse {
81 pub decrypted_data: Vec<u8>,
82 pub metadata: Option<serde_json::Value>,
83}
84
85#[derive(Debug, Clone)]
86pub struct ExecuteJsResponse {
87 pub success: bool,
88 pub signatures: HashMap<String, serde_json::Value>,
89 pub response: serde_json::Value,
90 pub logs: String,
91}