Archived
Simplify pending setup secrets
This commit is contained in:
1 parent
5fee087b60
commit
8f07bbde84
6 files changed
+29
-23
No files matched your search
@@ -15,6 +15,7 @@ from .settings import DdnsSettings
|
||||
DASHBOARD_UNLOCK_COOKIE = "ddns_dashboard_unlock"
|
||||
DASHBOARD_UNLOCK_DEFAULT_SECONDS = 24 * 60 * 60
|
||||
DASHBOARD_UNLOCK_STAY_SIGNED_IN_SECONDS = 30 * 24 * 60 * 60
|
||||
BEARER_SECRET_PREFIX = "karl_"
|
||||
PRIVATE_PROXY_NETWORKS = tuple(
|
||||
ip_network(network)
|
||||
for network in (
|
||||
@@ -62,6 +63,10 @@ def hash_lookup_token(token: str) -> str:
|
||||
return hashlib.sha256(token.encode("utf-8")).hexdigest()
|
||||
|
||||
|
||||
def new_bearer_secret() -> str:
|
||||
return f"{BEARER_SECRET_PREFIX}{secrets.token_urlsafe(32)}"
|
||||
|
||||
|
||||
def sign_dashboard_unlock_cookie(
|
||||
hostname: str,
|
||||
management_slug: str,
|
||||
|
||||
Reference in new issue
Block a user