CleverSwarm API invocation example

This commit is contained in:
Stanislav Hejny
2025-02-25 20:35:20 +00:00
parent 286a4986b3
commit eb26eec767
36 changed files with 1269 additions and 126 deletions
+20
View File
@@ -0,0 +1,20 @@
from passlib.context import CryptContext
CRIPTO = CryptContext(schemes=['bcrypt'], deprecated='auto') # Automatically workaround deprecated APIs
def validate_pass(password: str, hash_pass: str) -> bool:
"""
Verifies if a given password matches the expected hash.
It compares the user provided text password with the stored hash of the expected password, that
is currently stored in the system.
"""
return CRIPTO.verify(password, hash_pass)
def create_password_hash(password: str) -> str:
"""
Return the hash of the password
"""
return CRIPTO.hash(password)