refactor: untangle lnd's macaroon encryption with AESCipher class (#3152)

This commit is contained in:
dni ⚡
2025-05-13 12:07:38 +02:00
committed by GitHub
parent 7bea591879
commit 3b350858c7
7 changed files with 207 additions and 124 deletions
+20
View File
@@ -0,0 +1,20 @@
import pytest
from lnbits.utils.crypto import AESCipher
@pytest.mark.anyio
@pytest.mark.parametrize(
"key",
[
"normal_string",
b"normal_bytes",
b"hex_string".hex(),
],
)
async def test_aes_encrypt_decrypt(key):
aes = AESCipher(key)
original_text = "Hello, World!"
encrypted_text = aes.encrypt(original_text.encode())
decrypted_text = aes.decrypt(encrypted_text)
assert original_text == decrypted_text