Streamline sealed boxes

This commit is contained in:
Jesper Louis Andersen
2020-02-04 12:44:47 +01:00
parent c791f602e9
commit 71832cce4c
4 changed files with 11 additions and 10 deletions
+2 -5
View File
@@ -685,7 +685,7 @@ box_secret_key_bytes() ->
%% keypair and then uses `box'. Ephemeral public key will sent to other party. Returns the
%% enciphered message `SealedCipherText' which includes ephemeral public key at head.
%% @end
-spec box_seal(Msg, PK) -> SealedCipherText
-spec box_seal(Msg, PK) -> {ok, SealedCipherText} | {error, term()}
when
Msg :: iodata(),
PK :: binary(),
@@ -706,10 +706,7 @@ box_seal(Msg, PK) ->
SK :: binary(),
Msg :: binary().
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) -> {ok, Bin}
end.
enacl_nif:crypto_box_seal_open(SealedCipherText, PK, SK).
%% @doc secretbox/3 encrypts a message with a key
%%