Secrets encryption #4
1 changed files with 2 additions and 2 deletions
|
@ -7,8 +7,8 @@ from pssecret_server.models import Secret
|
||||||
|
|
||||||
|
|
||||||
def encrypt_secret(data: Secret, fernet: Fernet) -> Secret:
|
def encrypt_secret(data: Secret, fernet: Fernet) -> Secret:
|
||||||
data.data = fernet.encrypt(data.data.encode()).decode()
|
encrypted = fernet.encrypt(data.data.encode()).decode()
|
||||||
return data
|
return Secret(data=encrypted)
|
||||||
|
|
||||||
|
|
||||||
def decrypt_secret(secret: bytes, fernet: Fernet) -> bytes:
|
def decrypt_secret(secret: bytes, fernet: Fernet) -> bytes:
|
||||||
|
|
Loading…
Reference in a new issue