parent
3f541a2dcb
commit
4ae27db51e
@ -0,0 +1,17 @@
|
||||
import json
|
||||
|
||||
from cryptography.fernet import Fernet
|
||||
|
||||
|
||||
class Auth:
|
||||
|
||||
def get_key(self, client_id):
|
||||
return Fernet.generate_key()
|
||||
|
||||
def decrypt(self, cyphertext, client_id) -> dict:
|
||||
return json.loads(
|
||||
Fernet(self.get_key(client_id)).decrypt(cyphertext).decode())
|
||||
|
||||
def encrypt(self, data, client_id) -> bytes:
|
||||
return Fernet(self.get_key(client_id)).encrypt(
|
||||
json.dumps(data).encode('utf-8'))
|
@ -1,5 +1,6 @@
|
||||
flask==3.0.2
|
||||
flask-login==0.6.3
|
||||
cryptography==42.0.5
|
||||
flask-bcrypt==1.0.1
|
||||
flask-login==0.6.3
|
||||
flask-wtf==1.2.1
|
||||
flask==3.0.2
|
||||
pyyaml==6.0.1
|
||||
|
Loading…
Reference in new issue