Argon2 password hashing, JWT session issuing/verification (auth/security.py), register/login routes, the bearer-token get_current_user dependency, and GET /users/me for address + balance. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
14 lines
444 B
Python
14 lines
444 B
Python
from app.auth import security
|
|
|
|
|
|
def test_password_hash_roundtrip():
|
|
hashed = security.hash_password("s3cret!")
|
|
assert security.verify_password("s3cret!", hashed)
|
|
assert not security.verify_password("wrong", hashed)
|
|
|
|
|
|
def test_jwt_roundtrip(monkeypatch):
|
|
monkeypatch.setattr(security.settings, "jwt_secret", "test-secret")
|
|
token = security.create_access_token(user_id=42)
|
|
assert security.decode_access_token(token) == 42
|