pub struct BithumbAuth { /* private fields */ }Expand description
Bithumb authentication handler
Implementations§
Source§impl BithumbAuth
impl BithumbAuth
Sourcepub const fn new(api_key: SmartString, api_secret: SmartString) -> Self
pub const fn new(api_key: SmartString, api_secret: SmartString) -> Self
Create new Bithumb auth instance
Sourcepub fn build_param_string_optimized(
params: &[(&str, &str)],
) -> Result<SmartString>
pub fn build_param_string_optimized( params: &[(&str, &str)], ) -> Result<SmartString>
Optimized parameter string building using SmallVec for stack allocation Uses SmallVec<[SmartString; 8]> to avoid heap allocation for typical parameter counts Enhanced with auth module’s optimized implementation
Important: Bithumb’s API specification requires parameters to be sorted alphabetically by key name for signature verification. This implementation processes parameters in their input order for performance optimization.
Note: Ensure parameters are pre-sorted before calling this function if signature verification is required, as mandated by Bithumb’s API.
Sourcepub fn generate_nonce() -> SmartString
pub fn generate_nonce() -> SmartString
Generate API nonce (UUID v4)
Sourcepub fn generate_timestamp() -> u64
pub fn generate_timestamp() -> u64
Generate timestamp in milliseconds
Sourcepub fn generate_timestamp_nanos() -> u128
pub fn generate_timestamp_nanos() -> u128
Generate timestamp in nanoseconds for high-precision timing
Sourcepub fn encode_params_zero_copy(
params: &str,
buffer: &mut SmartString,
) -> Result<()>
pub fn encode_params_zero_copy( params: &str, buffer: &mut SmartString, ) -> Result<()>
URL-encode the provided parameter string using a pre-allocated buffer.
This performs zero-copy encoding to avoid unpredictable heap allocations on critical paths.
Sourcepub fn generate_headers(
&self,
_method: &str,
_path: &str,
params: Option<&[(&str, &str)]>,
) -> Result<FxHashMap<SmartString, SmartString>>
pub fn generate_headers( &self, _method: &str, _path: &str, params: Option<&[(&str, &str)]>, ) -> Result<FxHashMap<SmartString, SmartString>>
Generates authentication headers for a request.
Sourcepub fn generate_headers_for_json_body(
&self,
json_body: &str,
) -> Result<FxHashMap<SmartString, SmartString>>
pub fn generate_headers_for_json_body( &self, json_body: &str, ) -> Result<FxHashMap<SmartString, SmartString>>
Generate headers for JSON body requests (POST/PUT/DELETE)
Bithumb API requires:
- Request body in JSON format
- Authentication hash calculated from URL-encoded representation of JSON parameters
- Content-Type: application/json; charset=utf-8
Sourcepub fn build_query_string(params: &[(&str, &str)]) -> Result<SmartString>
pub fn build_query_string(params: &[(&str, &str)]) -> Result<SmartString>
Generate query string from parameters (optimized version using auth module)
Important: Bithumb’s API specification requires parameters to be sorted alphabetically by key name for signature verification. However, this implementation currently uses natural order (no sorting) for performance optimization.
Note: If signature verification fails, ensure parameters are pre-sorted before calling this function, as required by Bithumb’s API documentation.
Sourcepub fn param_count(params: Option<&[(&str, &str)]>) -> usize
pub fn param_count(params: Option<&[(&str, &str)]>) -> usize
Fast parameter count for pre-allocation decisions
Sourcepub fn generate_ws_auth(&self) -> Result<SmartString>
pub fn generate_ws_auth(&self) -> Result<SmartString>
Generate WebSocket authentication message Bithumb WebSocket uses PING/PONG for connection management
Sourcepub fn generate_joined_param(params: &[(&str, &str)]) -> Option<SmartString>
pub fn generate_joined_param(params: &[(&str, &str)]) -> Option<SmartString>
Generate joined parameter string (for backward compatibility)
Trait Implementations§
Source§impl Clone for BithumbAuth
impl Clone for BithumbAuth
Source§fn clone(&self) -> BithumbAuth
fn clone(&self) -> BithumbAuth
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read more