correct enacl:seal_box_open return value

This commit is contained in:
Amir Ghassemi Nasr 2015-08-09 17:24:12 +04:30
parent 64c03a1425
commit 233c924b70

View File

@ -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
%%