pub struct AuthState {
pub access_token: String,
pub refresh_token: String,
pub expires_in: u64,
pub obtained_at: u64,
pub scope: String,
}Expand description
Authentication state storing OAuth tokens.
Fields§
§access_token: StringAccess token for API requests.
refresh_token: StringRefresh token for obtaining new access tokens.
expires_in: u64Token expiration time in seconds from authentication.
obtained_at: u64Timestamp when tokens were obtained (Unix milliseconds).
scope: StringScope used for authentication.
Implementations§
Source§impl AuthState
impl AuthState
Sourcepub fn from_auth_result(result: &DeribitAuthResult, obtained_at: u64) -> Self
pub fn from_auth_result(result: &DeribitAuthResult, obtained_at: u64) -> Self
Creates a new AuthState from an authentication result.
Sourcepub fn expires_at_ms(&self) -> u64
pub fn expires_at_ms(&self) -> u64
Returns the expiration timestamp in Unix milliseconds.
Sourcepub fn is_expired(&self, current_time_ms: u64) -> bool
pub fn is_expired(&self, current_time_ms: u64) -> bool
Returns whether the token is expired or near expiry (within 60 seconds).
Sourcepub fn is_session_scoped(&self) -> bool
pub fn is_session_scoped(&self) -> bool
Returns whether this is a session-scoped authentication.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AuthState
impl RefUnwindSafe for AuthState
impl Send for AuthState
impl Sync for AuthState
impl Unpin for AuthState
impl UnwindSafe for AuthState
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)§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