Skip to main content

SigningStrategy

Trait SigningStrategy 

Source
pub trait SigningStrategy: Send + Sync {
    // Required methods
    fn prepare_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 mut SigningContext,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn add_auth_headers(&self, headers: &mut HeaderMap, ctx: &SigningContext);
}
Expand description

Trait for exchange-specific request signing strategies.

Implementors define how to:

  • Generate timestamps in exchange-specific format
  • Compute request signatures
  • Add authentication headers

Required Methods§

Source

fn prepare_request<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 mut SigningContext, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Prepare the request for signing.

This method should:

  1. Generate timestamp in exchange-specific format
  2. Compute signature based on method, path, params, body
  3. Update ctx.timestamp and ctx.signature
  4. Optionally modify ctx.params (e.g., add timestamp param)
Source

fn add_auth_headers(&self, headers: &mut HeaderMap, ctx: &SigningContext)

Add authentication headers to the request.

Called after prepare_request(). Should add all required authentication headers (API key, signature, timestamp, etc.)

Implementors§