Initial commit: Robot ökoszisztéma v2.0 - Stabilizált jármű és szerviz robotok

This commit is contained in:
Kincses
2026-03-04 02:03:03 +01:00
commit 250f4f4b8f
7942 changed files with 449625 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
import os
from datetime import datetime, timedelta
from typing import Any, Union
from jose import jwt
from passlib.context import CryptContext
# Jelszó titkosítás beállítása
pwd_context = CryptContext(schemes=["bcrypt"], deprecated="auto")
# Környezeti változók (idővel menjenek a config.py-ba)
SECRET_KEY = os.getenv("SECRET_KEY", "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7")
ALGORITHM = "HS256"
def verify_password(plain_password: str, hashed_password: str) -> bool:
"""Ellenőrzi, hogy a megadott jelszó egyezik-e a hash-elt változattal."""
return pwd_context.verify(plain_password, hashed_password)
def get_password_hash(password: str) -> str:
"""Létrehozza a jelszó biztonságos hash-ét."""
return pwd_context.hash(password)
def create_access_token(data: dict, expires_delta: Union[timedelta, None] = None) -> str:
"""Létrehoz egy JWT tokent."""
to_encode = data.copy()
if expires_delta:
expire = datetime.utcnow() + expires_delta
else:
expire = datetime.utcnow() + timedelta(minutes=1440) # 1 nap alapértelmezett
to_encode.update({"exp": expire})
encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
return encoded_jwt

View File

@@ -0,0 +1 @@
{"version":1,"resource":"vscode-remote://192.168.100.43:8443/home/coder/project/backend/app/core/security.py","entries":[{"id":"Krug.py","timestamp":1769041965907},{"id":"gq3x.py","timestamp":1769042450084}]}

View File

@@ -0,0 +1,36 @@
import os
import bcrypt
from datetime import datetime, timedelta
from typing import Any, Union
from jose import jwt
# Titkosítási beállítások
SECRET_KEY = os.getenv("SECRET_KEY", "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7")
ALGORITHM = "HS256"
def verify_password(plain_password: str, hashed_password: str) -> bool:
"""Ellenőrzi a jelszót közvetlenül a bcrypt használatával."""
# A bcrypt byte-okat vár, ezért konvertáljuk le
password_bytes = plain_password.encode('utf-8')
hashed_bytes = hashed_password.encode('utf-8')
return bcrypt.checkpw(password_bytes, hashed_bytes)
def get_password_hash(password: str) -> str:
"""Létrehozza a jelszó hash-ét közvetlenül a bcrypt használatával."""
# Salt generálás és hash-elés
salt = bcrypt.gensalt()
password_bytes = password.encode('utf-8')
hashed = bcrypt.hashpw(password_bytes, salt)
return hashed.decode('utf-8')
def create_access_token(data: dict, expires_delta: Union[timedelta, None] = None) -> str:
"""JWT token generálása."""
to_encode = data.copy()
if expires_delta:
expire = datetime.utcnow() + expires_delta
else:
expire = datetime.utcnow() + timedelta(minutes=1440)
to_encode.update({"exp": expire})
encoded_jwt = jwt.encode(to_encode, SECRET_KEY, algorithm=ALGORITHM)
return encoded_jwt