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,7 +429,7 @@ box_secret_key_bytes() ->
PK :: binary(), PK :: binary(),
SealedCipherText :: binary(). SealedCipherText :: binary().
seal_box(Msg, PK) -> 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. %% @doc seal_box_open/3 decrypts+check message integrity from an unknown sender.
%% %%
@ -443,7 +443,10 @@ seal_box(Msg, PK) ->
SK :: binary(), SK :: binary(),
Msg :: binary(). Msg :: binary().
seal_box_open(SealedCipherText, PK, SK) -> 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 %% @doc secretbox/3 encrypts a message with a key
%% %%