fast init

This commit is contained in:
ivankirpichnikov
2025-10-16 23:03:50 +03:00
parent b84e0370d6
commit 652da07d12
50 changed files with 1012 additions and 0 deletions
@@ -0,0 +1,25 @@
import argon2
from cryptography.fernet import Fernet
from dishka import Provider, Scope, WithParents, provide, provide_all
from template_project.adapters.access_token.cryptographer import FernetAccessTokenCryptographer
from template_project.adapters.password_utils import ArgonPasswordHasher, ArgonPasswordVerifying
from template_project.web_api.configuration import AccessTokenConfiguration
class CryptographerProvider(Provider):
scope = Scope.APP
@provide
def argon_password_hasher(self) -> argon2.PasswordHasher:
return argon2.PasswordHasher()
@provide
def fernet(self, configuration: AccessTokenConfiguration) -> Fernet:
return Fernet(configuration.crypto_key)
access_token_cryptographer = provide(WithParents[FernetAccessTokenCryptographer])
password_utils = provide_all(
WithParents[ArgonPasswordHasher],
WithParents[ArgonPasswordVerifying],
)