Sync shared snapshot from df68167
This commit is contained in:
1 parent
588ef139a6
commit
06efc832ca
79 files changed
+10035
-3
No files matched your search
@@ -0,0 +1,15 @@
|
||||
"""Opaque session-token generation and storage hashing."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import secrets
|
||||
|
||||
|
||||
def new_session_token() -> tuple[str, str]:
|
||||
token = secrets.token_urlsafe(32)
|
||||
return token, hash_token(token)
|
||||
|
||||
|
||||
def hash_token(token: str) -> str:
|
||||
return hashlib.sha256(token.encode("utf-8")).hexdigest()
|
||||
Reference in new issue
Block a user