pub struct WalletAuth {
pub api_key_id: String,
pub api_key_secret: String,
pub wallet_secret: Option<String>,
pub debug: bool,
pub source: String,
pub source_version: Option<String>,
pub expires_in: u64,
}Expand description
Configuration options for the CDP Wallet Auth client
Fields§
§api_key_id: StringThe API key ID
api_key_secret: StringThe API key secret
wallet_secret: Option<String>The wallet secret
debug: boolWhether to enable debugging
source: StringThe source identifier for requests
source_version: Option<String>The version of the source making requests
expires_in: u64JWT expiration time in seconds
Implementations§
Source§impl WalletAuth
impl WalletAuth
Sourcepub fn generate_jwt(
&self,
method: &str,
host: &str,
path: &str,
expires_in: u64,
) -> Result<String, CdpError>
pub fn generate_jwt( &self, method: &str, host: &str, path: &str, expires_in: u64, ) -> Result<String, CdpError>
Generates a JWT (Bearer token) for authenticating with the CDP REST APIs.
Uses the api_key_id and api_key_secret from this WalletAuth instance
to sign the JWT. For a standalone function that doesn’t require a WalletAuth
instance, see generate_jwt.
§Arguments
method- The HTTP method (e.g. “GET”, “POST”)host- The request host (e.g. “api.cdp.coinbase.com”)path- The request path (e.g. “/platform/v2/evm/accounts”)expires_in- JWT expiration time in seconds
§Returns
The signed JWT string.
§Errors
Returns CdpError::Auth if the key format is invalid or signing fails.
pub fn generate_wallet_jwt( &self, method: &str, host: &str, path: &str, body: &[u8], ) -> Result<String, CdpError>
pub fn builder() -> WalletAuthBuilder
Trait Implementations§
Source§impl Clone for WalletAuth
impl Clone for WalletAuth
Source§fn clone(&self) -> WalletAuth
fn clone(&self) -> WalletAuth
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 moreSource§impl Debug for WalletAuth
impl Debug for WalletAuth
Source§impl Default for WalletAuth
impl Default for WalletAuth
Source§fn default() -> WalletAuth
fn default() -> WalletAuth
Returns the “default value” for a type. Read more
Source§impl Middleware for WalletAuth
impl Middleware for WalletAuth
Source§fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: Request,
extensions: &'life1 mut Extensions,
next: Next<'life2>,
) -> Pin<Box<dyn Future<Output = Result<Response>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Invoked with a request before sending it. If you want to continue processing the request,
you should explicitly call
next.run(req, extensions). Read moreAuto Trait Implementations§
impl Freeze for WalletAuth
impl RefUnwindSafe for WalletAuth
impl Send for WalletAuth
impl Sync for WalletAuth
impl Unpin for WalletAuth
impl UnsafeUnpin for WalletAuth
impl UnwindSafe for WalletAuth
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