From d53e00b191721f6117b57a6b507ba9c0a4ea835b Mon Sep 17 00:00:00 2001 From: Anaz Date: Thu, 9 Jan 2025 09:09:29 +0100 Subject: [PATCH] =?UTF-8?q?T=C3=A9l=C3=A9verser=20les=20fichiers=20vers=20?= =?UTF-8?q?"utils"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/helpers.py | Bin 0 -> 1024 bytes utils/logging.py | Bin 0 -> 1024 bytes utils/security.cpython-311.pyc | Bin 0 -> 1719 bytes utils/security.py | 18 ++++++++++++++++++ 4 files changed, 18 insertions(+) create mode 100644 utils/helpers.py create mode 100644 utils/logging.py create mode 100644 utils/security.cpython-311.pyc create mode 100644 utils/security.py diff --git a/utils/helpers.py b/utils/helpers.py new file mode 100644 index 0000000000000000000000000000000000000000..06d7405020018ddf3cacee90fd4af10487da3d20 GIT binary patch literal 1024 ScmZQz7zLvtFd70QH3R?z00031 literal 0 HcmV?d00001 diff --git a/utils/logging.py b/utils/logging.py new file mode 100644 index 0000000000000000000000000000000000000000..06d7405020018ddf3cacee90fd4af10487da3d20 GIT binary patch literal 1024 ScmZQz7zLvtFd70QH3R?z00031 literal 0 HcmV?d00001 diff --git a/utils/security.cpython-311.pyc b/utils/security.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..35ca365168807a06e4b7ee7a9a944f4dafe6300c GIT binary patch literal 1719 zcma(ROK2NMbVfT~eb$nkL$#n5<+om3?;qzP?g5$vdBAQX_Z~Am>E@3 zk->)^O3A@31^cK=+ywht$g!8+B_psHFcf-eZwB9T%A3_nSP7IqcHWzLpLw5oZ+}at zQwZSc@^0lUhS1;oFa|T)T>b=`14I$U9`bPsW4(`gG2bW|;ok6wPfEm}Db0ju;+cND z6vrrr7^X87OwE({5!`q-o&I(hN&SI$1bp z=v)!yul=j9$YV9T!P^bF5!5AnF5zs{S~4F~30js+x;|4$jVbeF8Keopq;%^Qq0DVZ z8!A$6$^Z=F!l^Q!36-L(!I=Z*R3#c^AzA^a%H&KodELQL=$aVOy8H|_2S{pO1l_B8 zVFe& zrR#};U`~^}vc1}9t7{b|?Qy`izJ=ca^Mtbi!~ZZwA@~md^e1A)x=4cLz_ud=c?180TYr4u~?pW8B?o!|^5@ zxsFz7kBf`^x|U~0@<}-S4sb24bsJEW*u7Kh-eLV!(6`nG)>@CO@tn3L&6G3fKk7+F#A8Q~ab>$NZ%roY~{s%w|JR zB-g#8OjdUS%2W#47v{=-#@c)V1bKts)$*ha>`28N-6M3Ii{o~<0akFCebpiV7&J1l z1O>E*hI6@tlBy#er4qkz&|hoB6ED>Y?-8 z?bT?6xeiv5S|CRGh6M`?rLv&1<5pJ3zoD>lqZu%S str: + return pwd_context.hash(password) + +def verify_password(plain_password: str, hashed_password: str) -> bool: + return pwd_context.verify(plain_password, hashed_password) + +def create_access_token(data: dict) -> str: + to_encode = data.copy() + expire = datetime.utcnow() + timedelta(minutes=settings.access_token_expire_minutes) + to_encode.update({"exp": expire}) + return jwt.encode(to_encode, settings.secret_key, algorithm=settings.algorithm) \ No newline at end of file