Skip to main content

issue_csrf_token

Function issue_csrf_token 

Source
pub fn issue_csrf_token(secret: &[u8], nonce: &str) -> String
Expand description

Issues a stateless HMAC-SHA256 signed CSRF token "<nonce>.<hex_mac>".

§Arguments

  • &[u8] - Server-side CSRF HMAC secret.
  • &str - Caller-supplied unique nonce (must not contain '.').

§Returns

  • String - Signed CSRF token suitable for double-submit cookie and header transport.