pub struct StalkerSession { /* private fields */ }Expand description
Active session state after successful authentication.
Extended with device identity and token expiry tracking.
Implementations§
Source§impl StalkerSession
impl StalkerSession
Sourcepub fn new(
token: String,
portal_url: String,
mac_address: String,
token_validity_secs: Option<u64>,
timezone: Option<&str>,
) -> Self
pub fn new( token: String, portal_url: String, mac_address: String, token_validity_secs: Option<u64>, timezone: Option<&str>, ) -> Self
Create a new session with device identity derived from MAC.
timezone defaults to "Europe/Paris" when None.
Build the Cookie header value for Stalker requests.
Format: mac={percent_encoded_mac}; stb_lang=en; timezone={encoded_tz}
Build the Cookie header with token included.
Used for most requests (except get_profile on stalker_portal endpoints).
Sourcepub fn auth_header(&self) -> String
pub fn auth_header(&self) -> String
Build the Authorization header value.
Sourcepub fn is_token_expired(&self) -> bool
pub fn is_token_expired(&self) -> bool
Check whether the token has expired.
Python: (current_time - self.token_timestamp) > self.token_validity_period
TypeScript: (currentTimestamp - this.tokenTimestamp) > STALKER_TOKEN_VALIDITY_SECONDS
Sourcepub fn refresh_token(&mut self, new_token: String)
pub fn refresh_token(&mut self, new_token: String)
Update the token after a refresh (handshake + profile).
Sourcepub fn hw_version_2(&self) -> String
pub fn hw_version_2(&self) -> String
Generate hw_version_2 (SHA-1 of MAC).
Sourcepub fn mac_to_device_id(mac: &str) -> String
pub fn mac_to_device_id(mac: &str) -> String
Derive the device ID from a MAC address (legacy: colon-stripped uppercase).
00:1A:79:XX:XX:XX -> 001A79XXXXXX
Trait Implementations§
Source§impl Clone for StalkerSession
impl Clone for StalkerSession
Source§fn clone(&self) -> StalkerSession
fn clone(&self) -> StalkerSession
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more