Skip to content

Commit 165193f

Browse files
Add function for key rotation
1 parent e0cc572 commit 165193f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pydatastructs/graphs/graph.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,16 @@
22
from pydatastructs.utils.misc_util import Backend, raise_if_backend_is_not_python
33
from pydatastructs.utils.misc_util import GraphEdge
44
from pydatastructs.utils import AdjacencyListGraphNode
5-
6-
5+
import hmac
6+
import hashlib
7+
import os
8+
import secrets
9+
import threading
10+
def rotate_secret_key():
11+
""" Automatically rotates secret key after 30 days """
12+
while True:
13+
os.environ["HMAC_SECRET_KEY"] = secrets.token_hax(32)
14+
time.sleep(30 * 24 * 60 * 60)
715
__all__ = [
816
'Graph'
917
]

0 commit comments

Comments
 (0)