feat: improve user admin (#2777)

This commit is contained in:
Vlad Stan
2024-11-19 10:33:57 +02:00
committed by GitHub
parent 8c5c455f1c
commit af568d0f31
22 changed files with 1167 additions and 655 deletions
+10
View File
@@ -186,6 +186,16 @@ def is_valid_username(username: str) -> bool:
return re.fullmatch(username_regex, username) is not None
def is_valid_pubkey(pubkey: str) -> bool:
if len(pubkey) != 64:
return False
try:
int(pubkey, 16)
return True
except Exception as _:
return False
def create_access_token(data: dict):
expire = datetime.now(timezone.utc) + timedelta(
minutes=settings.auth_token_expire_minutes