Refactor: Modularize lib_general.py by extracting core functionalities.
- Extracted Email functions to app/lib_email.py. - Extracted Export functions to app/lib_export.py. - Extracted JWT utilities to app/lib_jwt.py. - Extracted Hash utilities to app/lib_hash.py. - Updated app/lib_general.py to import from these new modules for backward compatibility. - Updated V3 Frontend API Guide with latest security and site_domain exception details.
This commit is contained in:
16
app/lib_hash.py
Normal file
16
app/lib_hash.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from passlib.hash import argon2
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
# Moved from lib_general.py 2026-01-07
|
||||
def secure_hash_string(string: str) -> str:
|
||||
string_hash = argon2.using(rounds=14, memory_cost=1536, parallelism=2).hash(string)
|
||||
return string_hash
|
||||
|
||||
# Moved from lib_general.py 2026-01-07
|
||||
def verify_secure_hash_string(string: str, string_hash: str) -> bool:
|
||||
if argon2.verify(string, string_hash):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
Reference in New Issue
Block a user