File tree 1 file changed +3
-4
lines changed
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():
13
13
os .environ ["HMAC_SECRET_KEY" ] = secrets .token_hex (32 )
14
14
time .sleep (30 * 24 * 60 * 60 )
15
15
def get_secret_key ():
16
- """ Gets the HMAC secret key """
16
+ """Gets the HMAC secret key"""
17
17
secret_key = os .getenv ("HMAC_SECRET_KEY" )
18
18
if secret_key is None :
19
19
try :
@@ -22,10 +22,10 @@ def get_secret_key():
22
22
except FileNotFoundError :
23
23
raise RuntimeError ("Secret key is missing! Set HMAC_SECRET_KEY or create hmac_key.txt." )
24
24
return secret_key .encode ()
25
-
25
+
26
26
def generate_hmac (data ):
27
27
"""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 ()
29
29
def serialize_graph (graph ):
30
30
"""Converts a graph into a string for HMAC signing."""
31
31
if not graph .vertices or not graph .edge_weights :
@@ -228,4 +228,3 @@ def num_edges(self):
228
228
raise NotImplementedError (
229
229
"This is an abstract method." )
230
230
threading .Thread (target = rotate_secret_key , daemon = True ).start ()
231
-
You can’t perform that action at this time.
0 commit comments