Trait ExchangeAuthentication

Source
pub trait ExchangeAuthentication:
    Send
    + Sync
    + Debug {
    // Required methods
    fn generate_authentication_headers(
        &self,
        method: &str,
        path: &str,
        parameters: Option<(&str, &str)>,
    ) -> Result<FxHashMap<SmartString, SmartString>>;
    fn generate_websocket_authentication(&self) -> Result<SmartString>;
    fn api_key(&self) -> &str;

    // Provided method
    fn generate_authentication_headers_with_body(
        &self,
        method: &str,
        path: &str,
        parameters: Option<(&str, &str)>,
        _body: Option<&str>,
    ) -> Result<FxHashMap<SmartString, SmartString>> { ... }
}
Expand description

Common trait for exchange authentication

Required Methods§

Source

fn generate_authentication_headers( &self, method: &str, path: &str, parameters: Option<(&str, &str)>, ) -> Result<FxHashMap<SmartString, SmartString>>

Generate authentication headers for a request

Source

fn generate_websocket_authentication(&self) -> Result<SmartString>

Generate WebSocket authentication message

Source

fn api_key(&self) -> &str

Get API key

Provided Methods§

Source

fn generate_authentication_headers_with_body( &self, method: &str, path: &str, parameters: Option<(&str, &str)>, _body: Option<&str>, ) -> Result<FxHashMap<SmartString, SmartString>>

Generate authentication headers for a request with body Default implementation calls generate_authentication_headers without body

Implementors§