pub trait Authenticated: Send + Sync {
// Required methods
fn set_credentials(&mut self, creds: ExchangeCredentials);
fn is_authenticated(&self) -> bool;
fn credential_type(&self) -> Option<CredentialKind>;
}Expand description
Marks a connector as credential-aware and capable of authenticated requests.
Connectors that ONLY support public endpoints (e.g. read-only data feeds) do NOT implement this trait.
§Auth is internal
Connectors sign requests internally. This trait only controls
credential storage and the ability to check authentication state.
Callers use set_credentials once at construction time and then
call the trading/account trait methods normally.
Required Methods§
Sourcefn set_credentials(&mut self, creds: ExchangeCredentials)
fn set_credentials(&mut self, creds: ExchangeCredentials)
Store credentials in the connector for use in all subsequent requests.
Calling this replaces any previously stored credentials.
The connector validates the credential variant matches its expected
type and returns ExchangeError::InvalidCredentials if mismatched.
Sourcefn is_authenticated(&self) -> bool
fn is_authenticated(&self) -> bool
Returns true if credentials have been set and the connector
is ready to make authenticated requests.
Sourcefn credential_type(&self) -> Option<CredentialKind>
fn credential_type(&self) -> Option<CredentialKind>
Returns the credential scheme this connector accepts, or None
if the connector only supports public (unauthenticated) requests.