|
| 1 | +use serde::{Deserialize, Serialize}; |
| 2 | + |
| 3 | +/// Custom HTTP header used for specifying a whitelisted API key. |
| 4 | +pub const X_API_KEY_HEADER: &str = "X-API-Key"; |
| 5 | + |
| 6 | +/// Types of client that the prover is using. |
| 7 | +#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)] |
| 8 | +pub enum ClientType { |
| 9 | + /// Client that has access to the transport layer. |
| 10 | + Tcp, |
| 11 | + /// Client that cannot directly access the transport layer, e.g. browser |
| 12 | + /// extension. |
| 13 | + Websocket, |
| 14 | +} |
| 15 | + |
| 16 | +/// Request object of the /session API. |
| 17 | +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] |
| 18 | +#[serde(rename_all = "camelCase")] |
| 19 | +pub struct NotarizationSessionRequest { |
| 20 | + pub client_type: ClientType, |
| 21 | + /// Maximum data that can be sent by the prover. |
| 22 | + pub max_sent_data: Option<usize>, |
| 23 | + /// Maximum data that can be received by the prover. |
| 24 | + pub max_recv_data: Option<usize>, |
| 25 | +} |
| 26 | + |
| 27 | +/// Response object of the /session API. |
| 28 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 29 | +#[serde(rename_all = "camelCase")] |
| 30 | +pub struct NotarizationSessionResponse { |
| 31 | + /// Unique session id that is generated by the notary and shared to the |
| 32 | + /// prover. |
| 33 | + pub session_id: String, |
| 34 | +} |
0 commit comments