Skip to main content

signed_cookie

Function signed_cookie 

Source
pub fn signed_cookie(value: &str, secret: &[u8]) -> String
Available on crate feature crypto only.
Expand description

Signs value with HMAC-SHA256 keyed by secret. Returns "<value>.<hex-signature>" — store the result directly as a cookie value (e.g. SetCookie::new("prefs", signed_cookie(value, secret))).

The value itself remains plain-text and readable by the client; only tampering is detected, by verify_signed_cookie.