Skip to main content

surface_signature

Function surface_signature 

Source
pub fn surface_signature(surface: &IdentitySurface) -> String
Expand description

Compute a deterministic signature hash from an IdentitySurface.

Wraps crate::freshness::signature_hash so the same input always produces the same "fnv64:<hex>" string. Useful for cross-context signatures that can then be compared against a crate::freshness::FreshnessContract.

ยงExample

use stygian_browser::coherence::{IdentitySurface, surface_signature};

let s = IdentitySurface {
    user_agent: Some("Mozilla/5.0 ...".to_string()),
    platform: Some("MacIntel".to_string()),
    ..IdentitySurface::default()
};
let h1 = surface_signature(&s);
let h2 = surface_signature(&s);
assert_eq!(h1, h2);
assert!(h1.starts_with("fnv64:"));