teoat commited on
Commit
ef896d0
·
verified ·
1 Parent(s): 9cdb6e9

Upload core/csrf.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. core/csrf.py +3 -1
core/csrf.py CHANGED
@@ -32,7 +32,9 @@ class CSRFProtection:
32
 
33
  # Recreate signature
34
  message = f"{session_id}:{nonce}".encode()
35
- expected_signature = hmac.new(self.secret_key, message, hashlib.sha256).hexdigest()
 
 
36
 
37
  # Constant-time comparison
38
  return hmac.compare_digest(signature, expected_signature)
 
32
 
33
  # Recreate signature
34
  message = f"{session_id}:{nonce}".encode()
35
+ expected_signature = hmac.new(
36
+ self.secret_key, message, hashlib.sha256
37
+ ).hexdigest()
38
 
39
  # Constant-time comparison
40
  return hmac.compare_digest(signature, expected_signature)