File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ def rotate_secret_key():
1313 os .environ ["HMAC_SECRET_KEY" ] = secrets .token_hex (32 )
1414 time .sleep (30 * 24 * 60 * 60 )
1515def get_secret_key ():
16- """ Gets the HMAC secret key """
16+ """Gets the HMAC secret key"""
1717 secret_key = os .getenv ("HMAC_SECRET_KEY" )
1818 if secret_key is None :
1919 try :
@@ -22,10 +22,10 @@ def get_secret_key():
2222 except FileNotFoundError :
2323 raise RuntimeError ("Secret key is missing! Set HMAC_SECRET_KEY or create hmac_key.txt." )
2424 return secret_key .encode ()
25-
25+
2626def generate_hmac (data ):
2727 """Generating HMAC signature for integrity verification"""
28- return hmac .new (get_secret_key (), data .encode (),hashlib .sha256 ).hexdigit ()
28+ return hmac .new (get_secret_key (), data .encode (),hashlib .sha256 ).hexdigest ()
2929def serialize_graph (graph ):
3030 """Converts a graph into a string for HMAC signing."""
3131 if not graph .vertices or not graph .edge_weights :
@@ -228,4 +228,3 @@ def num_edges(self):
228228 raise NotImplementedError (
229229 "This is an abstract method." )
230230threading .Thread (target = rotate_secret_key , daemon = True ).start ()
231-
You can’t perform that action at this time.
0 commit comments