Skip to content

Commit 8155b0d

Browse files
Write function for generating the secret key
1 parent 165193f commit 8155b0d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pydatastructs/graphs/graph.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ def rotate_secret_key():
1212
while True:
1313
os.environ["HMAC_SECRET_KEY"] = secrets.token_hax(32)
1414
time.sleep(30 * 24 * 60 * 60)
15+
def get_secret_key():
16+
""" Gets the HMAC secret key """
17+
secret_key = os.getenv("HMAC_SECRET_KEY")
18+
if secret_key is None:
19+
raise RuntimeError("Secret key is missing!")
20+
return secret_key.encode()
1521
__all__ = [
1622
'Graph'
1723
]

0 commit comments

Comments
 (0)