pub struct CoinbaseCredential { /* private fields */ }Expand description
CDP API key pair with zeroization on drop.
Implementations§
Source§impl CoinbaseCredential
impl CoinbaseCredential
Sourcepub fn new(api_key: String, api_secret: String) -> Self
pub fn new(api_key: String, api_secret: String) -> Self
Creates a new CoinbaseCredential instance.
Sourcepub fn resolve(api_key: Option<&str>, api_secret: Option<&str>) -> Option<Self>
pub fn resolve(api_key: Option<&str>, api_secret: Option<&str>) -> Option<Self>
Resolves credentials from provided values or credential_env_vars,
returning None when neither yields a complete pair.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Loads credentials from environment variables.
§Errors
Returns Error::Auth if the environment variables are unset or empty.
Sourcepub fn api_secret(&self) -> &str
pub fn api_secret(&self) -> &str
Returns the PEM-encoded API secret.
Sourcepub fn build_rest_jwt(&self, uri: &str) -> Result<String>
pub fn build_rest_jwt(&self, uri: &str) -> Result<String>
Generates a JWT for REST API authentication.
The uri format is "{METHOD} {host}{path}", e.g.
"GET api.coinbase.com/api/v3/brokerage/accounts".
Sourcepub fn build_ws_jwt(&self) -> Result<String>
pub fn build_ws_jwt(&self) -> Result<String>
Generates a JWT for WebSocket authentication (no URI claim).
Trait Implementations§
Source§impl Clone for CoinbaseCredential
impl Clone for CoinbaseCredential
Source§fn clone(&self) -> CoinbaseCredential
fn clone(&self) -> CoinbaseCredential
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 CoinbaseCredential
impl Debug for CoinbaseCredential
Source§impl Display for CoinbaseCredential
impl Display for CoinbaseCredential
Source§impl Drop for CoinbaseCredential
impl Drop for CoinbaseCredential
Auto Trait Implementations§
impl Freeze for CoinbaseCredential
impl RefUnwindSafe for CoinbaseCredential
impl Send for CoinbaseCredential
impl Sync for CoinbaseCredential
impl Unpin for CoinbaseCredential
impl UnsafeUnpin for CoinbaseCredential
impl UnwindSafe for CoinbaseCredential
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.