-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Test against OTP 23 and 24 on CI - Add a few docs and tweaks to changes from PR #104 - Bump version to 1.1.0
- Loading branch information
1 parent
ffe73ca
commit 5d22cb8
Showing
4 changed files
with
45 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,42 @@ | ||
defmodule Cloak.Crypto.Interface do | ||
@doc ~S""" | ||
Forward to `:crypto.strong_rand_bytes/1` | ||
@moduledoc false | ||
|
||
@type cipher :: atom | ||
@type key :: iodata | ||
@type iv :: iodata | ||
@type aad :: iodata | ||
@type plaintext :: iodata | ||
@type ciphertext :: iodata | ||
@type ciphertag :: iodata | ||
|
||
@doc """ | ||
Alias for `:crypto.strong_rand_bytes/1`. | ||
""" | ||
@callback strong_rand_bytes(non_neg_integer()) :: binary() | ||
@callback encrypt_one_time(atom(), iodata(), iodata(), iodata()) :: binary() | ||
@callback decrypt_one_time(atom(), iodata(), iodata(), iodata()) :: binary() | ||
@callback encrypt_one_time_aead(atom(), iodata(), iodata(), iodata(), iodata()) :: | ||
{binary(), binary()} | ||
@callback decrypt_one_time_aead(atom(), iodata(), iodata(), iodata(), iodata(), iodata()) :: | ||
|
||
@doc """ | ||
Alias for `:crypto.crypto_one_time/5` with `opts[:encrypt]` set to `true`. | ||
""" | ||
@callback encrypt_one_time(cipher, key, iv, plaintext) :: binary() | ||
|
||
@doc """ | ||
Alias for `:crypto.crypto_one_time/5` with `opts[:encrypt]` set to `false`. | ||
""" | ||
@callback decrypt_one_time(cipher, key, iv, ciphertext) :: binary() | ||
|
||
@doc """ | ||
Alias for `:crypto.crypto_one_time_aead/7` with `encFlag` set to `true`. | ||
""" | ||
@callback encrypt_one_time_aead(cipher, key, iv, aad, plaintext) :: {binary(), binary()} | ||
|
||
@doc """ | ||
Alias for `:crypto.crypto_one_time_aead/7` with `encFlag` set to `false`. | ||
""" | ||
@callback decrypt_one_time_aead(cipher, key, iv, aad, ciphertext, ciphertag) :: | ||
binary() | ||
@callback map_cipher(atom()) :: atom() | ||
|
||
@doc """ | ||
Converts a cipher name to a supported cipher name, depending on the crypto library. | ||
""" | ||
@callback map_cipher(atom()) :: cipher | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters