Skip to content

Commit

Permalink
Prepare for 1.1.0 release
Browse files Browse the repository at this point in the history
- 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
danielberkompas committed Jun 5, 2021
1 parent ffe73ca commit 5d22cb8
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 13 deletions.
5 changes: 4 additions & 1 deletion .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ blocks:
- name: "Build"
matrix:
- env_var: ELIXIR_VERSION
values: ["1.11.3"]
values: ["1.11.3", "1.12.1"]
- env_var: ERLANG_VERSION
values: ["23.3", "24.0"]
commands:
- sem-version erlang $ERLANG_VERSION
- sem-version elixir $ELIXIR_VERSION
- checkout
- cache restore
Expand Down
6 changes: 3 additions & 3 deletions lib/cloak/crypto.ex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Cloak.Crypto do
@moduledoc ~S"""
Interface for mapping encrypt/decrypt actions to different versions of Erlang's `:crypto` API
"""
@moduledoc false
# Interface for mapping encrypt/decrypt actions to different versions of Erlang's `:crypto` API.
# See `Cloak.Crypto.Interface` for details on the included functions.

@behaviour Cloak.Crypto.Interface

Expand Down
45 changes: 37 additions & 8 deletions lib/cloak/crypto/interface.ex
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
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ defmodule Cloak.Mixfile do
def project do
[
app: :cloak,
version: "1.0.3",
version: "1.1.0",
elixir: "~> 1.0",
build_embedded: Mix.env() == :prod,
start_permanent: Mix.env() == :prod,
Expand Down

0 comments on commit 5d22cb8

Please sign in to comment.