pub struct Credentials { /* private fields */ }Expand description
API credentials for one account on one venue.
Construct with Credentials::new and, where the venue requires it, add a
passphrase or private key. The secret fields are crate-private: exchange
modules read them to sign requests, but they are never exposed to consumers.
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn new(
api_key: impl Into<String>,
api_secret: impl Into<String>,
) -> Credentials
pub fn new( api_key: impl Into<String>, api_secret: impl Into<String>, ) -> Credentials
Build credentials from an API key and secret.
Sourcepub fn with_passphrase(self, passphrase: impl Into<String>) -> Credentials
pub fn with_passphrase(self, passphrase: impl Into<String>) -> Credentials
Attach the passphrase required by OKX, Bitget and KuCoin.
Sourcepub fn with_private_key(self, private_key: impl Into<String>) -> Credentials
pub fn with_private_key(self, private_key: impl Into<String>) -> Credentials
Attach the private key used for Coinbase’s per-request JWT signing.
Sourcepub fn validate(&self) -> Result<(), Error>
pub fn validate(&self) -> Result<(), Error>
Validate that the non-secret invariants hold: a non-empty key and secret.
§Errors
Returns Error::InvalidCredentials if the key or secret is empty.
Sourcepub fn has_passphrase(&self) -> bool
pub fn has_passphrase(&self) -> bool
Whether a passphrase is present (without revealing it).
Sourcepub fn has_private_key(&self) -> bool
pub fn has_private_key(&self) -> bool
Whether a private key is present (without revealing it).
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Credentials
impl Debug for Credentials
Source§impl Drop for Credentials
impl Drop for Credentials
Auto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnsafeUnpin for Credentials
impl UnwindSafe for Credentials
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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