pub struct IdentitySurface {
pub user_agent: Option<String>,
pub platform: Option<String>,
pub languages: Option<String>,
pub hardware_concurrency: Option<u32>,
pub device_memory: Option<u32>,
pub timezone: Option<String>,
pub screen_width: Option<u32>,
pub screen_height: Option<u32>,
pub color_depth: Option<u32>,
pub webdriver: Option<bool>,
}Expand description
Identity surface probed in a single browser context.
All fields are optional so partial probe results (e.g. a context
where navigator.deviceMemory is undefined) round-trip cleanly.
§Example
use stygian_browser::coherence::IdentitySurface;
let s = IdentitySurface {
user_agent: Some("Mozilla/5.0 ...".to_string()),
platform: Some("MacIntel".to_string()),
languages: Some("en-US,en".to_string()),
hardware_concurrency: Some(8),
device_memory: None,
timezone: Some("America/Los_Angeles".to_string()),
screen_width: Some(1920),
screen_height: Some(1080),
color_depth: Some(24),
webdriver: Some(false),
};
assert_eq!(s.user_agent.as_deref(), Some("Mozilla/5.0 ..."));Fields§
§user_agent: Option<String>navigator.userAgent.
platform: Option<String>navigator.platform.
languages: Option<String>navigator.languages joined by "," for stable comparisons.
hardware_concurrency: Option<u32>navigator.hardwareConcurrency (allowed to drift for workers).
device_memory: Option<u32>navigator.deviceMemory (often undefined in workers).
timezone: Option<String>Intl.DateTimeFormat().resolvedOptions().timeZone.
screen_width: Option<u32>screen.width (Document + same-origin iframe only).
screen_height: Option<u32>screen.height (Document + same-origin iframe only).
color_depth: Option<u32>screen.colorDepth (Document + same-origin iframe only).
webdriver: Option<bool>navigator.webdriver (Some(false) on a clean browser).
Implementations§
Source§impl IdentitySurface
impl IdentitySurface
Sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
true when no field is populated — useful for asserting a
context was probed but produced no observations.
Sourcepub fn signature_parts(&self) -> Vec<String>
pub fn signature_parts(&self) -> Vec<String>
Build a deterministic signature for crate::freshness::signature_hash.
Concatenates the fields most likely to be anti-bot detection
targets: user_agent, platform, languages, timezone,
screen_width, screen_height, color_depth. Missing
fields emit "-" so signatures are stable across partial
observations.
Trait Implementations§
Source§impl Clone for IdentitySurface
impl Clone for IdentitySurface
Source§fn clone(&self) -> IdentitySurface
fn clone(&self) -> IdentitySurface
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IdentitySurface
impl Debug for IdentitySurface
Source§impl Default for IdentitySurface
impl Default for IdentitySurface
Source§fn default() -> IdentitySurface
fn default() -> IdentitySurface
Source§impl<'de> Deserialize<'de> for IdentitySurface
impl<'de> Deserialize<'de> for IdentitySurface
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for IdentitySurface
Source§impl PartialEq for IdentitySurface
impl PartialEq for IdentitySurface
Source§fn eq(&self, other: &IdentitySurface) -> bool
fn eq(&self, other: &IdentitySurface) -> bool
self and other values to be equal, and is used by ==.