Skip to content

Commit 818d1d7

Browse files
committed
Fix formatting
1 parent 8b57933 commit 818d1d7

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

lib/cadet_web/helpers/ai_comments_helpers.ex

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ defmodule CadetWeb.AICommentsHelpers do
1212

1313
case Base.decode64(encrypted_key) do
1414
{:ok, decoded} ->
15-
with [iv, tag, ciphertext] <- :binary.split(decoded, <<"|">>, [:global]) do
16-
case :crypto.crypto_one_time_aead(:aes_gcm, key, iv, ciphertext, "", tag, false) do
17-
plain_text when is_binary(plain_text) -> {:ok, plain_text}
18-
_ -> {:decrypt_error, :decryption_failed}
19-
end
20-
else
21-
_ -> {:error, :invalid_format}
15+
case :binary.split(decoded, <<"|">>, [:global]) do
16+
[iv, tag, ciphertext] ->
17+
case :crypto.crypto_one_time_aead(:aes_gcm, key, iv, ciphertext, "", tag, false) do
18+
plain_text when is_binary(plain_text) -> {:ok, plain_text}
19+
_ -> {:decrypt_error, :decryption_failed}
20+
end
21+
22+
_ ->
23+
{:error, :invalid_format}
2224
end
2325

2426
_ ->

0 commit comments

Comments
 (0)