mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-26 05:51:29 +00:00
refactor(services): make local secret setting public
This commit is contained in:
parent
65acd3173a
commit
fa360655fe
|
@ -23,10 +23,14 @@ class LocalBackupSecret:
|
|||
LocalBackupSecret.reset()
|
||||
return redis.get(REDIS_KEY)
|
||||
|
||||
@staticmethod
|
||||
def set(secret: str):
|
||||
redis.set(REDIS_KEY, secret)
|
||||
|
||||
@staticmethod
|
||||
def reset():
|
||||
new_secret = LocalBackupSecret._generate()
|
||||
LocalBackupSecret._store(new_secret)
|
||||
LocalBackupSecret.set(new_secret)
|
||||
|
||||
@staticmethod
|
||||
def exists() -> bool:
|
||||
|
@ -35,7 +39,3 @@ class LocalBackupSecret:
|
|||
@staticmethod
|
||||
def _generate() -> str:
|
||||
return secrets.token_urlsafe(256)
|
||||
|
||||
@staticmethod
|
||||
def _store(secret: str):
|
||||
redis.set(REDIS_KEY, secret)
|
||||
|
|
Loading…
Reference in a new issue