sos_protocol/
constants.rs

1//! Constants for the networking protocols.
2
3/// Name for GUI IPC sockets.
4pub const IPC_GUI_SOCKET_NAME: &str = "com.saveoursecrets.gui.sock";
5
6/// Name for CLI IPC sockets.
7pub const IPC_CLI_SOCKET_NAME: &str = "com.saveoursecrets.cli.sock";
8
9/// Constants for MIME types.
10mod mime {
11    /// Mime type for protocol buffers.
12    pub const MIME_TYPE_PROTOBUF: &str = "application/x-protobuf";
13
14    /// Mime type for JSON.
15    pub const MIME_TYPE_JSON: &str = "application/json";
16}
17
18/// Constants for header names or values.
19mod header {
20    /// Header name used to specify an account address.
21    pub const X_SOS_ACCOUNT_ID: &str = "x-sos-account-id";
22
23    /// Header name used to specify a request id.
24    pub const X_SOS_REQUEST_ID: &str = "x-sos-request-id";
25}
26
27/// Route paths.
28pub mod routes {
29    /// Routes for v1.
30    pub mod v1 {
31
32        /// List accounts; local IPC server only.
33        pub const ACCOUNTS_LIST: &str = "/api/v1/accounts";
34
35        /// Route for syncing account data.
36        pub const SYNC_ACCOUNT: &str = "/api/v1/sync/account";
37
38        /// Route for sync account status.
39        pub const SYNC_ACCOUNT_STATUS: &str = "/api/v1/sync/account/status";
40
41        /// Route for syncing account events.
42        pub const SYNC_ACCOUNT_EVENTS: &str = "/api/v1/sync/account/events";
43    }
44}
45
46pub use header::*;
47pub use mime::*;