Commit 233c924b authored by Amir Ghassemi Nasr's avatar Amir Ghassemi Nasr
Browse files

correct enacl:seal_box_open return value

parent 64c03a14
......@@ -429,8 +429,8 @@ box_secret_key_bytes() ->
PK :: binary(),
SealedCipherText :: binary().
seal_box(Msg, PK) ->
enacl_nif:crypto_box_seal(Msg, PK).
enacl_nif:crypto_box_seal(Msg, PK).
%% @doc seal_box_open/3 decrypts+check message integrity from an unknown sender.
%%
%% Decrypt a `SealedCipherText' which contains an ephemeral public key from another party
......@@ -443,7 +443,10 @@ seal_box(Msg, PK) ->
SK :: binary(),
Msg :: binary().
seal_box_open(SealedCipherText, PK, SK) ->
enacl_nif:crypto_box_seal_open(SealedCipherText, PK, SK).
case enacl_nif:crypto_box_seal_open(SealedCipherText, PK, SK) of
{error, Err} -> {error, Err};
Bin when is_binary(Bin) -> Bin
end.
%% @doc secretbox/3 encrypts a message with a key
%%
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment