Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,25 @@ before_install:
- sudo apt-get install -y haveged
language: elixir
elixir:
- 1.4.2
- 1.5.3
- 1.6.6
- 1.7.2
- 1.8.2
- 1.9.4
otp_release:
- 18.2.1
- 20.1
- 20.3
- 21.3
- 22.2
script:
- mix compile --warnings-as-errors
- mix test --trace
matrix:
include:
- elixir: 1.4.5
otp_release: 20.1
script: mix test --trace
exclude:
- elixir: 1.5.3
otp_release: 21.3
- elixir: 1.5.3
otp_release: 22.2
- elixir: 1.6.6
otp_release: 22.2
27 changes: 13 additions & 14 deletions lib/ex_crypto.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@ defmodule ExCrypto do
end

defp normalize_error(kind, error, key_and_iv \\ nil) do
key_error = test_key_and_iv_bitlength(key_and_iv)
try do
key_error = test_key_and_iv_bitlength(key_and_iv)

normalized_result = Exception.normalize(kind, error)
cond do
key_error ->
key_error

cond do
key_error ->
key_error
%{message: message} = Exception.normalize(kind, error) ->
{:error, message}

%{term: %{message: message}} = normalized_result ->
{:error, message}

%{message: message} = normalized_result ->
{:error, message}

x = Exception.normalize(kind, error) ->
{kind, x, System.stacktrace()}
end
rescue
x ->
normalized = Exception.normalize(kind, x)
{kind, normalized, System.stacktrace()}
end
end

Expand Down Expand Up @@ -98,7 +97,7 @@ defmodule ExCrypto do
iex> assert(rand_int < 21)
true

iex> rand_int = ExCrypto.rand_int(23, 99)
iex> rand_int = ExCrypto.rand_int(23, 98)
iex> assert(rand_int > 22)
true
iex> assert(rand_int < 99)
Expand Down
8 changes: 4 additions & 4 deletions lib/ex_public_key.ex
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ defmodule ExPublicKey do
end

def normalize_error(kind, error) do
case Exception.normalize(kind, error) do
%{message: message} ->
{:error, message}

try do
%{message: message} = Exception.normalize(kind, error)
{:error, message}
rescue
x ->
{kind, x, System.stacktrace()}
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ex_public_key/ex_rsa_public_key.ex
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ defmodule ExPublicKey.RSAPublicKey do
case String.valid?(data) do
true ->
String.splitter(data, "", trim: true)
|> Enum.chunk(2)
|> Enum.chunk_every(2)
|> Enum.map(fn(chunk_list) ->
Enum.join(chunk_list, "")
end)
Expand Down