pub struct AuthConfig {
pub api_key: Option<String>,
pub secret_key: Option<String>,
}Expand description
Authentication configuration
Configures how the client authenticates with the Noah API. Supports API key authentication, JWT signing, or both.
§Examples
use noah_sdk::AuthConfig;
// API key only
let auth = AuthConfig::with_api_key("your-api-key".to_string());
// JWT signing only
let auth = AuthConfig::with_secret_key("your-secret-key".to_string());
// Both methods
let auth = AuthConfig::with_both(
"your-api-key".to_string(),
"your-secret-key".to_string()
);Fields§
§api_key: Option<String>API key for X-Api-Key header
secret_key: Option<String>Secret key for JWT signing
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn with_api_key(api_key: String) -> Self
pub fn with_api_key(api_key: String) -> Self
Sourcepub fn with_secret_key(secret_key: String) -> Self
pub fn with_secret_key(secret_key: String) -> Self
Create new auth config with JWT secret key only
This method uses JWT signing for authentication. The client will automatically
generate and sign JWTs for each request using the Api-Signature header.
§Arguments
secret_key- Your Noah secret key for JWT signing
§Examples
use noah_sdk::AuthConfig;
let auth = AuthConfig::with_secret_key("your-secret-key".to_string());Sourcepub fn with_both(api_key: String, secret_key: String) -> Self
pub fn with_both(api_key: String, secret_key: String) -> Self
Create new auth config with both API key and secret key
This method uses both API key authentication and JWT signing. Both headers will be included in requests.
§Arguments
api_key- Your Noah API keysecret_key- Your Noah secret key for JWT signing
§Examples
use noah_sdk::AuthConfig;
let auth = AuthConfig::with_both(
"your-api-key".to_string(),
"your-secret-key".to_string()
);Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnwindSafe for AuthConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more