Skip to main content

verify_signed_cookie

Function verify_signed_cookie 

Source
pub fn verify_signed_cookie(signed: &str, secret: &[u8]) -> Option<String>
Expand description

Verifies a cookie value produced by signed_cookie. Returns the original value on success. Returns None on any failure — missing separator, malformed hex, or a signature mismatch (tampering, or the wrong secret).

Splits on the last . so a value that itself contains dots is handled correctly — the hex-encoded HMAC signature never contains one.