Skip to content

Commit

Permalink
fix: ruff formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
danielgrittner committed Aug 21, 2024
1 parent 0338122 commit 0dc8305
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 4 additions & 2 deletions admyral/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,16 @@ def get_temporal_daemon_log_file() -> str:
ENV_ADMYRAL_WEBHOOK_SIGNING_SECRET = "ADMYRAL_WEBHOOK_SIGNING_SECRET"
WEBHOOK_SIGNING_SECRET = bytes.fromhex(
os.getenv(
ENV_ADMYRAL_WEBHOOK_SIGNING_SECRET, "ebedd9f0c10b01acb9fd097cdf34a2b38bb554f2c7f68f0d9f534eff5c6ef5d9"
ENV_ADMYRAL_WEBHOOK_SIGNING_SECRET,
"ebedd9f0c10b01acb9fd097cdf34a2b38bb554f2c7f68f0d9f534eff5c6ef5d9",
)
)

ENV_ADMYRAL_SECRETS_ENCRYPTION_KEY = "ADMYRAL_SECRETS_ENCRYPTION_KEY"
SECRETS_ENCRYPTION_KEY = bytes.fromhex(
os.getenv(
ENV_ADMYRAL_SECRETS_ENCRYPTION_KEY, "834f01cf391c972f1e6def3d7f315f8194bb10048e5cf282aa4cba63b239d8fb"
ENV_ADMYRAL_SECRETS_ENCRYPTION_KEY,
"834f01cf391c972f1e6def3d7f315f8194bb10048e5cf282aa4cba63b239d8fb",
)
)

Expand Down
12 changes: 9 additions & 3 deletions tests/utils/test_crypto.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
from admyral.utils.crypto import encrypt_aes256_gcm, decrypt_aes256_gcm, _generate_hs256


TEST_SECRET = bytes.fromhex("834f01cf391c972f1e6def3d7f315f8194bb10048e5cf282aa4cba63b239d8fb")
TEST_SECRET = bytes.fromhex(
"834f01cf391c972f1e6def3d7f315f8194bb10048e5cf282aa4cba63b239d8fb"
)


def test_encrypt_decrypt():
msg = "this is my encrypted message - hello world!"
ciphertext = encrypt_aes256_gcm(TEST_SECRET, "this is my encrypted message - hello world!")
ciphertext = encrypt_aes256_gcm(
TEST_SECRET, "this is my encrypted message - hello world!"
)
deciphered = decrypt_aes256_gcm(TEST_SECRET, ciphertext)
assert deciphered == msg


def test_hs256():
h = _generate_hs256(TEST_SECRET, "this is my securely hashed message - hello world!")
h = _generate_hs256(
TEST_SECRET, "this is my securely hashed message - hello world!"
)
assert h is not None

0 comments on commit 0dc8305

Please sign in to comment.